Notifiers.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. namespace Cloudflare\User\LoadBalancers;
  3. use Cloudflare\Api;
  4. use Cloudflare\User;
  5. /**
  6. * CloudFlare API wrapper
  7. *
  8. * CTM Notifiers
  9. * User-level Cloud Traffic Manager Notifier
  10. *
  11. * @author James Bell <james@james-bell.co.uk>
  12. *
  13. * @version 1
  14. */
  15. class Notifiers extends Api
  16. {
  17. /**
  18. * List notifiers
  19. * List configured notifiers for a user
  20. */
  21. public function notifiers()
  22. {
  23. return $this->get('/user/load_balancers/notifiers');
  24. }
  25. /**
  26. * Create a notifier
  27. * Create a configured notifier
  28. *
  29. * @param string $address Notifier address
  30. * @param string|null $type Notifier type
  31. */
  32. public function create($address, $type = null)
  33. {
  34. $data = [
  35. 'address' => $address,
  36. 'type' => $type,
  37. ];
  38. return $this->post('/user/load_balancers/notifiers', $data);
  39. }
  40. /**
  41. * Notifier details
  42. * Fetch a single configured CTM notifier for a user
  43. *
  44. * @param string $identifier
  45. */
  46. public function details($identifier)
  47. {
  48. return $this->get('/user/load_balancers/notifiers/'.$identifier);
  49. }
  50. /**
  51. * Modify a notifier
  52. * Modify a configured notifier
  53. *
  54. * @param string $identifier
  55. * @param string|null $address Notifier address
  56. * @param string|null $type Notifier type
  57. */
  58. public function update($identifier, $address = null, $type = null)
  59. {
  60. $data = [
  61. 'address' => $address,
  62. 'type' => $type,
  63. ];
  64. return $this->patch('/user/load_balancers/notifiers/'.$identifier, $data);
  65. }
  66. /**
  67. * Delete a notifier
  68. * Delete a configured notifier
  69. *
  70. * @param string $identifier
  71. */
  72. public function delete_notifier($identifier)
  73. {
  74. return $this->delete('/user/load_balancers/notifiers/'.$identifier);
  75. }
  76. }