Skip to content

Commit 3041d49

Browse files
authored
Merge pull request #157 from hknet/add-api_rectify-handling
add api_rectify handling for zones
2 parents c10009e + de04298 commit 3041d49

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace Exonet\Powerdns\Transformers;
4+
5+
class ApiRectifyTransformer extends Transformer
6+
{
7+
/**
8+
* {@inheritdoc}
9+
*/
10+
public function transform()
11+
{
12+
return (object) [
13+
'api_rectify' => $this->data['api_rectify'],
14+
];
15+
}
16+
}

src/Zone.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Exonet\Powerdns\Transformers\RRSetTransformer;
1212
use Exonet\Powerdns\Transformers\SoaEditApiTransformer;
1313
use Exonet\Powerdns\Transformers\SoaEditTransformer;
14+
use Exonet\Powerdns\Transformers\ApiRectifyTransformer;
1415
use Exonet\Powerdns\Transformers\Transformer;
1516

1617
class Zone extends AbstractZone
@@ -299,6 +300,41 @@ public function setSoaEditApi(string $value): bool
299300
return $this->put(new SoaEditApiTransformer(['soa_edit_api' => $value]));
300301
}
301302

303+
/**
304+
* Enable api_rectify for this zone.
305+
*
306+
* @return bool True when enabled.
307+
*/
308+
public function enableApiRectify(): bool
309+
{
310+
return $this->setApiRectify(true);
311+
}
312+
313+
/**
314+
* Disable api_rectify for this zone.
315+
*
316+
* @return bool True when disabled.
317+
*/
318+
public function disableApiRectify(): bool
319+
{
320+
return $this->setApiRectify(false);
321+
}
322+
323+
/**
324+
* Enable or disable api_rectify for this zone.
325+
*
326+
* @param bool $state True to enable, false to disable.
327+
*
328+
* @return bool True when the request succeeded.
329+
*/
330+
public function setApiRectify(bool $state): bool
331+
{
332+
return $this->put(new ApiRectifyTransformer(['api_rectify' => $state]));
333+
}
334+
335+
/**
336+
337+
302338
/**
303339
* Set the kind of zone: Native, Master or Slave.
304340
*

0 commit comments

Comments
 (0)