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

62 lines
2.1 KiB
PHP
Raw Normal View History

2023-01-05 12:55:52 +01:00
<?php
namespace DigiComp\HetznerDnsApi\Endpoint;
class DeleteZone extends \DigiComp\HetznerDnsApi\Runtime\Client\BaseEndpoint implements \DigiComp\HetznerDnsApi\Runtime\Client\Endpoint
{
protected $ZoneID;
/**
* Deletes a zone.
*
* @param string $zoneID ID of zone to be deleted
*/
public function __construct(string $zoneID)
{
$this->ZoneID = $zoneID;
}
use \DigiComp\HetznerDnsApi\Runtime\Client\EndpointTrait;
public function getMethod() : string
{
return 'DELETE';
}
public function getUri() : string
{
return str_replace(array('{ZoneID}'), array($this->ZoneID), '/zones/{ZoneID}');
}
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null) : array
{
return array(array(), null);
}
/**
* {@inheritdoc}
*
* @throws \DigiComp\HetznerDnsApi\Exception\DeleteZoneUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\DeleteZoneForbiddenException
* @throws \DigiComp\HetznerDnsApi\Exception\DeleteZoneNotFoundException
* @throws \DigiComp\HetznerDnsApi\Exception\DeleteZoneNotAcceptableException
*
* @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\DeleteZoneUnauthorizedException();
}
if (403 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\DeleteZoneForbiddenException();
}
if (404 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\DeleteZoneNotFoundException();
}
if (406 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\DeleteZoneNotAcceptableException();
}
}
public function getAuthenticationScopes() : array
{
return array('Auth-API-Token');
}
}