hetzner-dns-api/generated/Endpoint/DeletePrimaryServer.php

62 lines
No EOL
2.2 KiB
PHP

<?php
namespace DigiComp\HetznerDnsApi\Endpoint;
class DeletePrimaryServer extends \DigiComp\HetznerDnsApi\Runtime\Client\BaseEndpoint implements \DigiComp\HetznerDnsApi\Runtime\Client\Endpoint
{
protected $PrimaryServerID;
/**
* Deletes a primary server.
*
* @param string $primaryServerID ID of primary server to be deleted
*/
public function __construct(string $primaryServerID)
{
$this->PrimaryServerID = $primaryServerID;
}
use \DigiComp\HetznerDnsApi\Runtime\Client\EndpointTrait;
public function getMethod() : string
{
return 'DELETE';
}
public function getUri() : string
{
return str_replace(array('{PrimaryServerID}'), array($this->PrimaryServerID), '/primary_servers/{PrimaryServerID}');
}
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null) : array
{
return array(array(), null);
}
/**
* {@inheritdoc}
*
* @throws \DigiComp\HetznerDnsApi\Exception\DeletePrimaryServerUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\DeletePrimaryServerForbiddenException
* @throws \DigiComp\HetznerDnsApi\Exception\DeletePrimaryServerNotFoundException
* @throws \DigiComp\HetznerDnsApi\Exception\DeletePrimaryServerNotAcceptableException
*
* @return null
*/
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
{
if (200 === $status) {
return null;
}
if (401 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\DeletePrimaryServerUnauthorizedException();
}
if (403 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\DeletePrimaryServerForbiddenException();
}
if (404 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\DeletePrimaryServerNotFoundException();
}
if (406 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\DeletePrimaryServerNotAcceptableException();
}
}
public function getAuthenticationScopes() : array
{
return array('Auth-API-Token');
}
}