hetzner-ts
    Preparing search index...

    Server Actions API

    Actions are the individual operations that can be performed on a server. https://docs.hetzner.cloud/#server-actions

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    baseUrl: string
    token: string

    Methods

    • Add a server to a placement group

      Parameters

      • serverId: number

        The ID of the server to add to the placement group

      • placementGroupId: number

        The ID of the placement group to add the server to

      Returns Promise<
          | { response: { action: BaseAction }; success: true }
          | { response: APIError; success: false },
      >

    • Attach an ISO to a server

      Parameters

      • serverId: number

        The ID of the server to attach the ISO to

      • iso: string

        The ID or name of ISO to attach to the Server

      Returns Promise<
          | { response: { action: BaseAction }; success: true }
          | { response: APIError; success: false },
      >

    • Attach a server to a network

      Parameters

      • serverId: number

        The ID of the server to attach to the network

      • networkId: number

        The ID of the network to attach the server to

      • Optionalip: string

        Optional IP to assign to the server

      • OptionalaliasIps: string[]

        Optional array of alias IPs to assign to the server

      Returns Promise<
          | { response: { action: BaseAction }; success: true }
          | { response: APIError; success: false },
      >

    • Change alias IP of network

      Parameters

      • serverId: number

        The ID of the server to change the alias IP of

      • networkId: number

        The ID of the network to change the alias IP of

      • aliasIps: string[]

        The new alias IPs to assign to the server

      Returns Promise<
          | { response: { action: BaseAction }; success: true }
          | { response: APIError; success: false },
      >

    • Change reverse DNS entry for this Server

      Parameters

      • serverId: number

        The ID of the server to change the reverse DNS entry of

      • ip: string

        The IP to change the reverse DNS entry of

      • dnsPtr: null | string

        The new reverse DNS entry to assign to the server

      Returns Promise<
          | { response: { action: BaseAction }; success: true }
          | { response: APIError; success: false },
      >

    • Change Server Protection

      Parameters

      • serverId: number

        The ID of the server to change the protection of

      • Optionalprotect: boolean

        Whether to protect the server or not

      • Optionalrebuild: boolean

      Returns Promise<
          | { response: { action: BaseAction }; success: true }
          | { response: APIError; success: false },
      >

    • Change the Type of a Server

      Parameters

      • serverId: number

        The ID of the server to change the type of

      • serverType: string

        The new server type to change to

      • upgradeDisk: boolean

        Whether to upgrade the disk during type change

      Returns Promise<
          | { response: { action: BaseAction }; success: true }
          | { response: APIError; success: false },
      >

    • Create Image from Server

      Parameters

      • serverId: number

        The ID of the server to create an image from

      • Optionaltype: "snapshot" | "backup"
      • Optionaldescription: string

        The description of the image to create

      • Optionallabels: Record<string, string>

      Returns Promise<
          | { response: { action: BaseAction; image: Image }; success: true }
          | { response: APIError; success: false },
      >

    • Detach an ISO from a Server

      Parameters

      • serverId: number

        The ID of the server to detach the ISO from

      Returns Promise<
          | { response: { action: BaseAction }; success: true }
          | { response: APIError; success: false },
      >

    • Detach a server from a network

      Parameters

      • serverId: number

        The ID of the server to detach from the network

      • networkId: number

        The ID of the network to detach the server from

      Returns Promise<
          | { response: { action: BaseAction }; success: true }
          | { response: APIError; success: false },
      >

    • Disable Backups for a Server

      Parameters

      • serverId: number

        The ID of the server to disable backups for

      Returns Promise<
          | { response: { action: BaseAction }; success: true }
          | { response: APIError; success: false },
      >

    • Disable Rescue Mode for a Server

      Parameters

      • serverId: number

        The ID of the server to disable rescue mode for

      Returns Promise<
          | { response: { action: BaseAction }; success: true }
          | { response: APIError; success: false },
      >

    • Enables and configures the automatic daily backup option

      Parameters

      • serverId: number

        The ID of the server to enable and configure backups for

      Returns Promise<
          | { response: { action: BaseAction }; success: true }
          | { response: APIError; success: false },
      >

    • Enable Rescue Mode for a Server

      Parameters

      • serverId: number

        The ID of the server to enable rescue mode for

      • Optionaltype: "linux64"
      • OptionalsshKeys: number[]

      Returns Promise<
          | { response: { action: BaseAction }; success: true }
          | { response: APIError; success: false },
      >

    • Get a specific action by ID

      Parameters

      • id: number

        The ID of the action to get

      Returns Promise<
          | { response: { action: BaseAction }; success: true }
          | { response: APIError; success: false },
      >

    • Get an action for a server

      Parameters

      • serverId: number

        The ID of the server to get the action for

      • actionId: number

        The ID of the action to get

      Returns Promise<
          | { response: { action: BaseAction }; success: true }
          | { response: APIError; success: false },
      >

    • Power off a server

      Parameters

      • serverId: number

        The ID of the server to power off

      Returns Promise<
          | { response: { action: BaseAction }; success: true }
          | { response: APIError; success: false },
      >

    • Power on a server

      Parameters

      • serverId: number

        The ID of the server to power on

      Returns Promise<
          | { response: { action: BaseAction }; success: true }
          | { response: APIError; success: false },
      >

    • Rebuild a Server from an Image

      Parameters

      • serverId: number

        The ID of the server to rebuild

      • image: string

        The ID or name of the image to rebuild the server from

      Returns Promise<
          | { response: { action: BaseAction }; success: true }
          | { response: APIError; success: false },
      >

    • Remove from placement group

      Parameters

      • serverId: number

        The ID of the server to remove from the placement group

      Returns Promise<
          | { response: { action: BaseAction }; success: true }
          | { response: APIError; success: false },
      >

    • Type Parameters

      • T

      Parameters

      • endpoint: string
      • options: RequestInit = {}

      Returns Promise<{ response: T; success: true } | { response: APIError; success: false }>

    • Request Console for a Server

      Parameters

      • serverId: number

        The ID of the server to request the console for

      Returns Promise<
          | {
              response: { action: BaseAction; password: string; wss_url: string };
              success: true;
          }
          | { response: APIError; success: false },
      >

    • Reset a server

      Parameters

      • serverId: number

        The ID of the server to reset

      Returns Promise<
          | { response: { action: BaseAction }; success: true }
          | { response: APIError; success: false },
      >

    • Reset Root Password

      Parameters

      • serverId: number

        The ID of the server to reset the root password for

      Returns Promise<
          | {
              response: { action: BaseAction; root_password: string };
              success: true;
          }
          | { response: APIError; success: false },
      >

    • Shutdown a server

      Parameters

      • serverId: number

        The ID of the server to shutdown

      Returns Promise<
          | { response: { action: BaseAction }; success: true }
          | { response: APIError; success: false },
      >

    • Soft reboot a server

      Parameters

      • serverId: number

        The ID of the server to soft reboot

      Returns Promise<
          | { response: { action: BaseAction }; success: true }
          | { response: APIError; success: false },
      >