Skip to content

Commit de7ead0

Browse files
authored
Merge pull request #153 from ToshY/feature/152
Add enable/disable DNSSEC endpoints
2 parents a8662a4 + a5a59a1 commit de7ead0

File tree

4 files changed

+110
-0
lines changed

4 files changed

+110
-0
lines changed

docs/base-api.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,22 @@ $baseApi->deleteDnsZone(
663663
);
664664
```
665665

666+
#### [Enable DNSSEC on DNS Zone](https://docs.bunny.net/reference/managednszonednssecendpoint_enablednssecdnszone)
667+
668+
```php
669+
$baseApi->enableDnssecOnDnsZone(
670+
id: 1,
671+
);
672+
```
673+
674+
#### [Disable DNSSEC on DNS Zone](https://docs.bunny.net/reference/managednszonednssecendpoint_disablednssecdnszone)
675+
676+
```php
677+
$baseApi->disableDnssecOnDnsZone(
678+
id: 1,
679+
);
680+
```
681+
666682
#### [Export DNS Zone](https://docs.bunny.net/reference/dnszonepublic_export)
667683

668684
```php

src/BaseAPI.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
use ToshY\BunnyNet\Model\API\Base\DNSZone\CheckDNSZoneAvailability;
3333
use ToshY\BunnyNet\Model\API\Base\DNSZone\DeleteDNSRecord;
3434
use ToshY\BunnyNet\Model\API\Base\DNSZone\DeleteDNSZone;
35+
use ToshY\BunnyNet\Model\API\Base\DNSZone\DisableDNSSECOnDNSZone;
3536
use ToshY\BunnyNet\Model\API\Base\DNSZone\DismissDNSConfigurationNotice;
37+
use ToshY\BunnyNet\Model\API\Base\DNSZone\EnableDNSSECOnDNSZone;
3638
use ToshY\BunnyNet\Model\API\Base\DNSZone\ExportDNSRecords;
3739
use ToshY\BunnyNet\Model\API\Base\DNSZone\GetDNSZone;
3840
use ToshY\BunnyNet\Model\API\Base\DNSZone\GetDNSZoneQueryStatistics;
@@ -1036,6 +1038,40 @@ public function deleteDnsZone(int $id): BunnyClientResponseInterface
10361038
);
10371039
}
10381040

1041+
/**
1042+
* @throws ClientExceptionInterface
1043+
* @throws Exception\BunnyClientResponseException
1044+
* @throws Exception\JSONException
1045+
* @return BunnyClientResponseInterface
1046+
* @param int $id
1047+
*/
1048+
public function enableDnssecOnDnsZone(int $id): BunnyClientResponseInterface
1049+
{
1050+
$endpoint = new EnableDNSSECOnDNSZone();
1051+
1052+
return $this->client->request(
1053+
endpoint: $endpoint,
1054+
parameters: [$id],
1055+
);
1056+
}
1057+
1058+
/**
1059+
* @throws ClientExceptionInterface
1060+
* @throws Exception\BunnyClientResponseException
1061+
* @throws Exception\JSONException
1062+
* @return BunnyClientResponseInterface
1063+
* @param int $id
1064+
*/
1065+
public function disableDnssecOnDnsZone(int $id): BunnyClientResponseInterface
1066+
{
1067+
$endpoint = new DisableDNSSECOnDNSZone();
1068+
1069+
return $this->client->request(
1070+
endpoint: $endpoint,
1071+
parameters: [$id],
1072+
);
1073+
}
1074+
10391075
/**
10401076
* @throws ClientExceptionInterface
10411077
* @throws Exception\BunnyClientResponseException
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace ToshY\BunnyNet\Model\API\Base\DNSZone;
6+
7+
use ToshY\BunnyNet\Enum\Header;
8+
use ToshY\BunnyNet\Enum\Method;
9+
use ToshY\BunnyNet\Model\EndpointInterface;
10+
11+
class DisableDNSSECOnDNSZone implements EndpointInterface
12+
{
13+
public function getMethod(): Method
14+
{
15+
return Method::DELETE;
16+
}
17+
18+
public function getPath(): string
19+
{
20+
return 'dnszone/%d/dnssec';
21+
}
22+
23+
public function getHeaders(): array
24+
{
25+
return [
26+
Header::ACCEPT_JSON,
27+
];
28+
}
29+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace ToshY\BunnyNet\Model\API\Base\DNSZone;
6+
7+
use ToshY\BunnyNet\Enum\Header;
8+
use ToshY\BunnyNet\Enum\Method;
9+
use ToshY\BunnyNet\Model\EndpointInterface;
10+
11+
class EnableDNSSECOnDNSZone implements EndpointInterface
12+
{
13+
public function getMethod(): Method
14+
{
15+
return Method::POST;
16+
}
17+
18+
public function getPath(): string
19+
{
20+
return 'dnszone/%d/dnssec';
21+
}
22+
23+
public function getHeaders(): array
24+
{
25+
return [
26+
Header::ACCEPT_JSON,
27+
];
28+
}
29+
}

0 commit comments

Comments
 (0)