vendor/mandrill/mandrill/src/Mandrill/Ips.php line 5

Open in your IDE?
  1. <?php
  2. class Mandrill_Ips {
  3. public function __construct(Mandrill $master) {
  4. $this->master = $master;
  5. }
  6. /**
  7. * Lists your dedicated IPs.
  8. * @return array an array of structs for each dedicated IP
  9. * - return[] struct information about a single dedicated IP
  10. * - ip string the ip address
  11. * - created_at string the date and time that the dedicated IP was created as a UTC string in YYYY-MM-DD HH:MM:SS format
  12. * - pool string the name of the pool that this dedicated IP belongs to
  13. * - domain string the domain name (reverse dns) of this dedicated IP
  14. * - custom_dns struct information about the ip's custom dns, if it has been configured
  15. * - enabled boolean a boolean indicating whether custom dns has been configured for this ip
  16. * - valid boolean whether the ip's custom dns is currently valid
  17. * - error string if the ip's custom dns is invalid, this will include details about the error
  18. * - warmup struct information about the ip's warmup status
  19. * - warming_up boolean whether the ip is currently in warmup mode
  20. * - start_at string the start time for the warmup process as a UTC string in YYYY-MM-DD HH:MM:SS format
  21. * - end_at string the end date and time for the warmup process as a UTC string in YYYY-MM-DD HH:MM:SS format
  22. */
  23. public function getList() {
  24. $_params = array();
  25. return $this->master->call('ips/list', $_params);
  26. }
  27. /**
  28. * Retrieves information about a single dedicated ip.
  29. * @param string $ip a dedicated IP address
  30. * @return struct Information about the dedicated ip
  31. * - ip string the ip address
  32. * - created_at string the date and time that the dedicated IP was created as a UTC string in YYYY-MM-DD HH:MM:SS format
  33. * - pool string the name of the pool that this dedicated IP belongs to
  34. * - domain string the domain name (reverse dns) of this dedicated IP
  35. * - custom_dns struct information about the ip's custom dns, if it has been configured
  36. * - enabled boolean a boolean indicating whether custom dns has been configured for this ip
  37. * - valid boolean whether the ip's custom dns is currently valid
  38. * - error string if the ip's custom dns is invalid, this will include details about the error
  39. * - warmup struct information about the ip's warmup status
  40. * - warming_up boolean whether the ip is currently in warmup mode
  41. * - start_at string the start time for the warmup process as a UTC string in YYYY-MM-DD HH:MM:SS format
  42. * - end_at string the end date and time for the warmup process as a UTC string in YYYY-MM-DD HH:MM:SS format
  43. */
  44. public function info($ip) {
  45. $_params = array("ip" => $ip);
  46. return $this->master->call('ips/info', $_params);
  47. }
  48. /**
  49. * Requests an additional dedicated IP for your account. Accounts may
  50. have one outstanding request at any time, and provisioning requests
  51. are processed within 24 hours.
  52. * @param boolean $warmup whether to enable warmup mode for the ip
  53. * @param string $pool the id of the pool to add the dedicated ip to, or null to use your account's default pool
  54. * @return struct a description of the provisioning request that was created
  55. * - requested_at string the date and time that the request was created as a UTC timestamp in YYYY-MM-DD HH:MM:SS format
  56. */
  57. public function provision($warmup=false, $pool=null) {
  58. $_params = array("warmup" => $warmup, "pool" => $pool);
  59. return $this->master->call('ips/provision', $_params);
  60. }
  61. /**
  62. * Begins the warmup process for a dedicated IP. During the warmup process,
  63. Mandrill will gradually increase the percentage of your mail that is sent over
  64. the warming-up IP, over a period of roughly 30 days. The rest of your mail
  65. will be sent over shared IPs or other dedicated IPs in the same pool.
  66. * @param string $ip a dedicated ip address
  67. * @return struct Information about the dedicated IP
  68. * - ip string the ip address
  69. * - created_at string the date and time that the dedicated IP was created as a UTC string in YYYY-MM-DD HH:MM:SS format
  70. * - pool string the name of the pool that this dedicated IP belongs to
  71. * - domain string the domain name (reverse dns) of this dedicated IP
  72. * - custom_dns struct information about the ip's custom dns, if it has been configured
  73. * - enabled boolean a boolean indicating whether custom dns has been configured for this ip
  74. * - valid boolean whether the ip's custom dns is currently valid
  75. * - error string if the ip's custom dns is invalid, this will include details about the error
  76. * - warmup struct information about the ip's warmup status
  77. * - warming_up boolean whether the ip is currently in warmup mode
  78. * - start_at string the start time for the warmup process as a UTC string in YYYY-MM-DD HH:MM:SS format
  79. * - end_at string the end date and time for the warmup process as a UTC string in YYYY-MM-DD HH:MM:SS format
  80. */
  81. public function startWarmup($ip) {
  82. $_params = array("ip" => $ip);
  83. return $this->master->call('ips/start-warmup', $_params);
  84. }
  85. /**
  86. * Cancels the warmup process for a dedicated IP.
  87. * @param string $ip a dedicated ip address
  88. * @return struct Information about the dedicated IP
  89. * - ip string the ip address
  90. * - created_at string the date and time that the dedicated IP was created as a UTC string in YYYY-MM-DD HH:MM:SS format
  91. * - pool string the name of the pool that this dedicated IP belongs to
  92. * - domain string the domain name (reverse dns) of this dedicated IP
  93. * - custom_dns struct information about the ip's custom dns, if it has been configured
  94. * - enabled boolean a boolean indicating whether custom dns has been configured for this ip
  95. * - valid boolean whether the ip's custom dns is currently valid
  96. * - error string if the ip's custom dns is invalid, this will include details about the error
  97. * - warmup struct information about the ip's warmup status
  98. * - warming_up boolean whether the ip is currently in warmup mode
  99. * - start_at string the start time for the warmup process as a UTC string in YYYY-MM-DD HH:MM:SS format
  100. * - end_at string the end date and time for the warmup process as a UTC string in YYYY-MM-DD HH:MM:SS format
  101. */
  102. public function cancelWarmup($ip) {
  103. $_params = array("ip" => $ip);
  104. return $this->master->call('ips/cancel-warmup', $_params);
  105. }
  106. /**
  107. * Moves a dedicated IP to a different pool.
  108. * @param string $ip a dedicated ip address
  109. * @param string $pool the name of the new pool to add the dedicated ip to
  110. * @param boolean $create_pool whether to create the pool if it does not exist; if false and the pool does not exist, an Unknown_Pool will be thrown.
  111. * @return struct Information about the updated state of the dedicated IP
  112. * - ip string the ip address
  113. * - created_at string the date and time that the dedicated IP was created as a UTC string in YYYY-MM-DD HH:MM:SS format
  114. * - pool string the name of the pool that this dedicated IP belongs to
  115. * - domain string the domain name (reverse dns) of this dedicated IP
  116. * - custom_dns struct information about the ip's custom dns, if it has been configured
  117. * - enabled boolean a boolean indicating whether custom dns has been configured for this ip
  118. * - valid boolean whether the ip's custom dns is currently valid
  119. * - error string if the ip's custom dns is invalid, this will include details about the error
  120. * - warmup struct information about the ip's warmup status
  121. * - warming_up boolean whether the ip is currently in warmup mode
  122. * - start_at string the start time for the warmup process as a UTC string in YYYY-MM-DD HH:MM:SS format
  123. * - end_at string the end date and time for the warmup process as a UTC string in YYYY-MM-DD HH:MM:SS format
  124. */
  125. public function setPool($ip, $pool, $create_pool=false) {
  126. $_params = array("ip" => $ip, "pool" => $pool, "create_pool" => $create_pool);
  127. return $this->master->call('ips/set-pool', $_params);
  128. }
  129. /**
  130. * Deletes a dedicated IP. This is permanent and cannot be undone.
  131. * @param string $ip the dedicated ip to remove from your account
  132. * @return struct a description of the ip that was removed from your account.
  133. * - ip string the ip address
  134. * - deleted string a boolean indicating whether the ip was successfully deleted
  135. */
  136. public function delete($ip) {
  137. $_params = array("ip" => $ip);
  138. return $this->master->call('ips/delete', $_params);
  139. }
  140. /**
  141. * Lists your dedicated IP pools.
  142. * @return array the dedicated IP pools for your account, up to a maximum of 1,000
  143. * - return[] struct information about each dedicated IP pool
  144. * - name string this pool's name
  145. * - created_at string the date and time that this pool was created as a UTC timestamp in YYYY-MM-DD HH:MM:SS format
  146. * - ips array the dedicated IPs in this pool
  147. * - ips[] struct information about each dedicated IP
  148. * - ip string the ip address
  149. * - created_at string the date and time that the dedicated IP was created as a UTC string in YYYY-MM-DD HH:MM:SS format
  150. * - pool string the name of the pool that this dedicated IP belongs to
  151. * - domain string the domain name (reverse dns) of this dedicated IP
  152. * - custom_dns struct information about the ip's custom dns, if it has been configured
  153. * - enabled boolean a boolean indicating whether custom dns has been configured for this ip
  154. * - valid boolean whether the ip's custom dns is currently valid
  155. * - error string if the ip's custom dns is invalid, this will include details about the error
  156. * - warmup struct information about the ip's warmup status
  157. * - warming_up boolean whether the ip is currently in warmup mode
  158. * - start_at string the start time for the warmup process as a UTC string in YYYY-MM-DD HH:MM:SS format
  159. * - end_at string the end date and time for the warmup process as a UTC string in YYYY-MM-DD HH:MM:SS format
  160. */
  161. public function listPools() {
  162. $_params = array();
  163. return $this->master->call('ips/list-pools', $_params);
  164. }
  165. /**
  166. * Describes a single dedicated IP pool.
  167. * @param string $pool a pool name
  168. * @return struct Information about the dedicated ip pool
  169. * - name string this pool's name
  170. * - created_at string the date and time that this pool was created as a UTC timestamp in YYYY-MM-DD HH:MM:SS format
  171. * - ips array the dedicated IPs in this pool
  172. * - ips[] struct information about each dedicated IP
  173. * - ip string the ip address
  174. * - created_at string the date and time that the dedicated IP was created as a UTC string in YYYY-MM-DD HH:MM:SS format
  175. * - pool string the name of the pool that this dedicated IP belongs to
  176. * - domain string the domain name (reverse dns) of this dedicated IP
  177. * - custom_dns struct information about the ip's custom dns, if it has been configured
  178. * - enabled boolean a boolean indicating whether custom dns has been configured for this ip
  179. * - valid boolean whether the ip's custom dns is currently valid
  180. * - error string if the ip's custom dns is invalid, this will include details about the error
  181. * - warmup struct information about the ip's warmup status
  182. * - warming_up boolean whether the ip is currently in warmup mode
  183. * - start_at string the start time for the warmup process as a UTC string in YYYY-MM-DD HH:MM:SS format
  184. * - end_at string the end date and time for the warmup process as a UTC string in YYYY-MM-DD HH:MM:SS format
  185. */
  186. public function poolInfo($pool) {
  187. $_params = array("pool" => $pool);
  188. return $this->master->call('ips/pool-info', $_params);
  189. }
  190. /**
  191. * Creates a pool and returns it. If a pool already exists with this
  192. name, no action will be performed.
  193. * @param string $pool the name of a pool to create
  194. * @return struct Information about the dedicated ip pool
  195. * - name string this pool's name
  196. * - created_at string the date and time that this pool was created as a UTC timestamp in YYYY-MM-DD HH:MM:SS format
  197. * - ips array the dedicated IPs in this pool
  198. * - ips[] struct information about each dedicated IP
  199. * - ip string the ip address
  200. * - created_at string the date and time that the dedicated IP was created as a UTC string in YYYY-MM-DD HH:MM:SS format
  201. * - pool string the name of the pool that this dedicated IP belongs to
  202. * - domain string the domain name (reverse dns) of this dedicated IP
  203. * - custom_dns struct information about the ip's custom dns, if it has been configured
  204. * - enabled boolean a boolean indicating whether custom dns has been configured for this ip
  205. * - valid boolean whether the ip's custom dns is currently valid
  206. * - error string if the ip's custom dns is invalid, this will include details about the error
  207. * - warmup struct information about the ip's warmup status
  208. * - warming_up boolean whether the ip is currently in warmup mode
  209. * - start_at string the start time for the warmup process as a UTC string in YYYY-MM-DD HH:MM:SS format
  210. * - end_at string the end date and time for the warmup process as a UTC string in YYYY-MM-DD HH:MM:SS format
  211. */
  212. public function createPool($pool) {
  213. $_params = array("pool" => $pool);
  214. return $this->master->call('ips/create-pool', $_params);
  215. }
  216. /**
  217. * Deletes a pool. A pool must be empty before you can delete it, and you cannot delete your default pool.
  218. * @param string $pool the name of the pool to delete
  219. * @return struct information about the status of the pool that was deleted
  220. * - pool string the name of the pool
  221. * - deleted boolean whether the pool was deleted
  222. */
  223. public function deletePool($pool) {
  224. $_params = array("pool" => $pool);
  225. return $this->master->call('ips/delete-pool', $_params);
  226. }
  227. /**
  228. * Tests whether a domain name is valid for use as the custom reverse
  229. DNS for a dedicated IP.
  230. * @param string $ip a dedicated ip address
  231. * @param string $domain the domain name to test
  232. * @return struct validation results for the domain
  233. * - valid string whether the domain name has a correctly-configured A record pointing to the ip address
  234. * - error string if valid is false, this will contain details about why the domain's A record is incorrect
  235. */
  236. public function checkCustomDns($ip, $domain) {
  237. $_params = array("ip" => $ip, "domain" => $domain);
  238. return $this->master->call('ips/check-custom-dns', $_params);
  239. }
  240. /**
  241. * Configures the custom DNS name for a dedicated IP.
  242. * @param string $ip a dedicated ip address
  243. * @param string $domain a domain name to set as the dedicated IP's custom dns name.
  244. * @return struct information about the dedicated IP's new configuration
  245. * - ip string the ip address
  246. * - created_at string the date and time that the dedicated IP was created as a UTC string in YYYY-MM-DD HH:MM:SS format
  247. * - pool string the name of the pool that this dedicated IP belongs to
  248. * - domain string the domain name (reverse dns) of this dedicated IP
  249. * - custom_dns struct information about the ip's custom dns, if it has been configured
  250. * - enabled boolean a boolean indicating whether custom dns has been configured for this ip
  251. * - valid boolean whether the ip's custom dns is currently valid
  252. * - error string if the ip's custom dns is invalid, this will include details about the error
  253. * - warmup struct information about the ip's warmup status
  254. * - warming_up boolean whether the ip is currently in warmup mode
  255. * - start_at string the start time for the warmup process as a UTC string in YYYY-MM-DD HH:MM:SS format
  256. * - end_at string the end date and time for the warmup process as a UTC string in YYYY-MM-DD HH:MM:SS format
  257. */
  258. public function setCustomDns($ip, $domain) {
  259. $_params = array("ip" => $ip, "domain" => $domain);
  260. return $this->master->call('ips/set-custom-dns', $_params);
  261. }
  262. }