Maps.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. namespace Cloudflare\User\LoadBalancers;
  3. use Cloudflare\Api;
  4. use Cloudflare\User;
  5. /**
  6. * CloudFlare API wrapper
  7. *
  8. * CTM Map
  9. * User-level Cloud Traffic Manager Map
  10. *
  11. * @author James Bell <james@james-bell.co.uk>
  12. *
  13. * @version 1
  14. */
  15. class Maps extends Api
  16. {
  17. /**
  18. * List maps
  19. * List configured maps
  20. */
  21. public function maps()
  22. {
  23. return $this->get('/user/load_balancers/maps');
  24. }
  25. /**
  26. * Create a map
  27. * Create a new map
  28. *
  29. * @param array $global_pools Sorted list of pool IDs that will be utilized
  30. * if a CF PoP cannot be assigned to a configured region.
  31. * @param string|null $description Object description.
  32. */
  33. public function create($global_pools, $description = null)
  34. {
  35. $data = [
  36. 'global_pools' => $global_pools,
  37. 'description' => $description,
  38. ];
  39. return $this->post('/user/load_balancers/maps', $data);
  40. }
  41. /**
  42. * Map details
  43. * Fetch a single configured map
  44. *
  45. * @param string $identifier
  46. */
  47. public function details($identifier)
  48. {
  49. return $this->get('/user/load_balancers/maps/'.$identifier);
  50. }
  51. /**
  52. * Modify a map
  53. * Modify a configured map
  54. *
  55. * @param string $identifier
  56. * @param array $global_pools Sorted list of pool IDs that will be utilized
  57. * if a CF PoP cannot be assigned to a configured region.
  58. * @param string|null $description Object description.
  59. */
  60. public function update($identifier, $global_pools = null, $description = null)
  61. {
  62. $data = [
  63. 'global_pools' => $global_pools,
  64. 'description' => $description,
  65. ];
  66. return $this->patch('/user/load_balancers/maps/'.$identifier, $data);
  67. }
  68. /**
  69. * Delete a map
  70. * Delete a configured map
  71. *
  72. * @param string $identifier
  73. */
  74. public function delete_map($identifier)
  75. {
  76. return $this->delete('/user/load_balancers/maps/'.$identifier);
  77. }
  78. }