Exploriment / hcloud-php

PHP library for the Hetzner Cloud API by Exploriment
MIT License
28 stars 8 forks source link

Servers::changeDnsPtr #3

Closed Vladdy88 closed 6 years ago

Vladdy88 commented 6 years ago

I saw that the method changeDnsPtr from the Servers class is not implemented correctly, or the Hetzner API has changed from the time you implemented it. It should accept as body parameters ip and dns_ptr. I have changed the method to :

/**
     * Changes the hostname that will appear when getting the hostname belonging to the primary IPs (ipv4 and ipv6)
     * of this server.
     * Floating IPs assigned to the server are not affected by this.
     * @see https://docs.hetzner.cloud/#resources-server-actions-post-15
     *
     * @param int $id
     * @param string $ipv4
     * @param null|string $dns_ptr
     * @return Action
     * @throws Exceptions\MalformedResponse
     * @throws \Exception
     * @throws \ReflectionException
     */
    public static function changeDnsPtr($id, $ipv4, $dns_ptr = null)
    {
        return self::action($id, 'change_dns_ptr', [
            'ip' => $ipv4,
            'dns_ptr' => $dns_ptr
        ]);
    }

and in that way it works.

dyhli commented 6 years ago

Looks like the API method was indeed changed, updated in v1.1.0.