Mandrill_Ips::poolInfo()   A
last analyzed

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