-
Notifications
You must be signed in to change notification settings - Fork 264
Expand file tree
/
Copy pathDNSSEC.php
More file actions
67 lines (58 loc) · 1.63 KB
/
DNSSEC.php
File metadata and controls
67 lines (58 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
/**
* User: andrasbari
* Date: 2023-02-12
* Time: 17:16
*/
namespace Cloudflare\API\Endpoints;
use Cloudflare\API\Adapter\Adapter;
use Cloudflare\API\Traits\BodyAccessorTrait;
class DNSSEC implements API
{
use BodyAccessorTrait;
private $adapter;
public function __construct(Adapter $adapter)
{
$this->adapter = $adapter;
}
/**
* @param string $zoneID
* @return \stdClass|null
*/
public function getDetails(string $zoneID): ?\stdClass
{
$dnssec = $this->adapter->get('zones/' . $zoneID . '/dnssec');
$this->body = json_decode($dnssec->getBody());
return $this->body->result;
}
/**
* @param string $zoneID
* @return \stdClass|null
*/
public function enable(string $zoneID): ?\stdClass
{
$response = $this->adapter->patch('zones/' . $zoneID. '/dnssec', ['status' => 'active']);
$this->body = json_decode($response->getBody());
return $this->body->result;
}
/**
* @param string $zoneID
* @return \stdClass|null
*/
public function disable(string $zoneID): ?\stdClass
{
$response = $this->adapter->patch('zones/' . $zoneID. '/dnssec', ['status' => 'disabled']);
$this->body = json_decode($response->getBody());
return $this->body->result;
}
/**
* @param string $zoneID
* @return bool true if delete was successful
*/
public function delete(string $zoneID): bool
{
$dnssec = $this->adapter->delete('zones/' . $zoneID . '/dnssec');
$this->body = json_decode($dnssec->getBody());
return $this->body->success;
}
}