Passed
Push — master ( d156dd...acd975 )
by Thomas
04:20 queued 01:05
created

Mandrill_Ips::createPool()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
3
class Mandrill_Ips
4
{
5
6
    public function __construct(Mandrill $master)
7
    {
8
        $this->master = $master;
0 ignored issues
show
Bug Best Practice introduced by
The property master does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
9
    }
10
11
    /**
12
     * Lists your dedicated IPs.
13
     * @return array an array of structs for each dedicated IP
14
     *     - return[] struct information about a single dedicated IP
15
     *         - ip string the ip address
16
     *         - 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
17
     *         - pool string the name of the pool that this dedicated IP belongs to
18
     *         - domain string the domain name (reverse dns) of this dedicated IP
19
     *         - custom_dns struct information about the ip's custom dns, if it has been configured
20
     *             - enabled boolean a boolean indicating whether custom dns has been configured for this ip
21
     *             - valid boolean whether the ip's custom dns is currently valid
22
     *             - error string if the ip's custom dns is invalid, this will include details about the error
23
     *         - warmup struct information about the ip's warmup status
24
     *             - warming_up boolean whether the ip is currently in warmup mode
25
     *             - start_at string the start time for the warmup process as a UTC string in YYYY-MM-DD HH:MM:SS format
26
     *             - end_at string the end date and time for the warmup process as a UTC string in YYYY-MM-DD HH:MM:SS format
27
     */
28
    public function getList()
29
    {
30
        $_params = array();
31
        return $this->master->call('ips/list', $_params);
32
    }
33
34
    /**
35
     * Retrieves information about a single dedicated ip.
36
     * @param string $ip a dedicated IP address
37
     * @return struct Information about the dedicated ip
0 ignored issues
show
Bug introduced by
The type struct was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

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