This repository has been archived by the owner on Nov 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Organizations-level Virtual DNS Management support added
- Loading branch information
1 parent
d554352
commit fdd5c45
Showing
2 changed files
with
103 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
<?php | ||
|
||
namespace Cloudflare\Organizations; | ||
|
||
use Cloudflare\Api; | ||
use Cloudflare\Organizations; | ||
|
||
/** | ||
* CloudFlare API wrapper | ||
* | ||
* Virtual DNS (Organizations) | ||
* Organizations-level Virtual DNS Management | ||
* | ||
* @author James Bell <[email protected]> | ||
* @version 1 | ||
*/ | ||
|
||
class Virtual_Dns extends Api | ||
{ | ||
/** | ||
* Default permissions level | ||
* @var array | ||
*/ | ||
protected $permission_level = array('read' => '#dns_records:read', 'edit' => '#dns_records:edit'); | ||
|
||
/** | ||
* Get Virtual DNS Clusters (permission needed: #dns_records:read) | ||
* List configured Virtual DNS clusters for an organization | ||
* @param string $organization_identifier organization_identifier tag | ||
*/ | ||
public function clusters($organization_identifier) | ||
{ | ||
return $this->get('/organizations/' . $organization_identifier . '/virtual_dns'); | ||
} | ||
|
||
/** | ||
* Create a Virtual DNS Cluster (permission needed: #dns_records:edit) | ||
* Create a configured Virtual DNS Cluster | ||
* @param string $organization_identifier organization_identifier tag | ||
* @param string $name Virtual DNS Cluster Name | ||
* @param array $origin_ips | ||
* @param integer|null $minimum_cache_ttl Minimum DNS Cache TTL | ||
* @param integer|null $maximum_cache_ttl Maximum DNS Cache TTL | ||
* @param bool|null $deprecate_any_request Deprecate the response to ANY requests | ||
*/ | ||
public function create($organization_identifier, $name, $origin_ips, $minimum_cache_ttl = null, $maximum_cache_ttl = null, $deprecate_any_request = null) | ||
{ | ||
$data = array( | ||
'name' => $name, | ||
'origin_ips' => $origin_ips, | ||
'minimum_cache_ttl' => $minimum_cache_ttl, | ||
'maximum_cache_ttl' => $maximum_cache_ttl, | ||
'deprecate_any_request' => $deprecate_any_request | ||
); | ||
return $this->post('/organizations/' . $organization_identifier . '/virtual_dns', $data); | ||
} | ||
|
||
/** | ||
* Get a Virtual DNS Cluster (permission needed: #dns_records:read) | ||
* List a single configured Virtual DNS clusters for an organization | ||
* @param string $organization_identifier organization_identifier tag | ||
* @param string $identifier identifier tag | ||
*/ | ||
public function cluster($organization_identifier, $identifier) | ||
{ | ||
return $this->get('/organizations/' . $organization_identifier . '/virtual_dns/' . $identifier); | ||
} | ||
|
||
/** | ||
* Modify a Virtual DNS Cluster | ||
* Modify a Virtual DNS Cluster configuration (permission needed: #dns_records:edit) | ||
* @param string $organization_identifier organization_identifier tag | ||
* @param string $identifier identifier tag | ||
* @param string $name Virtual DNS Cluster Name | ||
* @param array $origin_ips | ||
* @param integer $minimum_cache_ttl Minimum DNS Cache TTL | ||
* @param integer $maximum_cache_ttl Maximum DNS Cache TTL | ||
* @param bool $deprecate_any_request Deprecate the response to ANY requests | ||
*/ | ||
public function modify($organization_identifier, $identifier, $name, $origin_ips, $minimum_cache_ttl, $maximum_cache_ttl, $deprecate_any_request) | ||
{ | ||
$data = array( | ||
'name' => $name, | ||
'origin_ips' => $origin_ips, | ||
'minimum_cache_ttl' => $minimum_cache_ttl, | ||
'maximum_cache_ttl' => $maximum_cache_ttl, | ||
'deprecate_any_request' => $deprecate_any_request | ||
); | ||
return $this->patch('/organizations/' . $organization_identifier . '/virtual_dns/' . $identifier, $data); | ||
} | ||
|
||
/** | ||
* Delete a Virtual DNS Cluster (permission needed: #dns_records:edit) | ||
* Delete a configured Virtual DNS cluster | ||
* @param string $organization_identifier organization_identifier tag | ||
* @param string $identifier identifier tag | ||
*/ | ||
public function delete_cluster($organization_identifier, $identifier) | ||
{ | ||
return $this->delete('/organizations/' . $organization_identifier . '/virtual_dns/' . $identifier); | ||
} | ||
} |