Total Complexity | 46 |
Total Lines | 824 |
Duplicated Lines | 0 % |
Changes | 0 |
Complex classes like Environments often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Environments, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
28 | class Environments implements CloudApi |
||
29 | { |
||
30 | |||
31 | /** @var ClientInterface The API client. */ |
||
32 | protected $client; |
||
33 | |||
34 | /** |
||
35 | * Client constructor. |
||
36 | * |
||
37 | * @param ClientInterface $client |
||
38 | */ |
||
39 | public function __construct(ClientInterface $client) |
||
40 | { |
||
41 | $this->client = $client; |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * Shows all databases in an environment. |
||
46 | * |
||
47 | * @param string $environmentUuid |
||
48 | * @return DatabasesResponse |
||
49 | */ |
||
50 | public function getDatabases($environmentUuid) |
||
51 | { |
||
52 | return new DatabasesResponse( |
||
53 | $this->client->request( |
||
|
|||
54 | 'get', |
||
55 | "/environments/${environmentUuid}/databases" |
||
56 | ) |
||
57 | ); |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * Copies a database from an environment to an environment. |
||
62 | * |
||
63 | * @param string $environmentFromUuid |
||
64 | * @param string $dbName |
||
65 | * @param string $environmentToUuid |
||
66 | * @return OperationResponse |
||
67 | */ |
||
68 | public function databaseCopy($environmentFromUuid, $dbName, $environmentToUuid) |
||
69 | { |
||
70 | $options = [ |
||
71 | 'form_params' => [ |
||
72 | 'name' => $dbName, |
||
73 | 'source' => $environmentFromUuid, |
||
74 | ], |
||
75 | ]; |
||
76 | |||
77 | return new OperationResponse( |
||
78 | $this->client->request('post', "/environments/${environmentToUuid}/databases", $options) |
||
79 | ); |
||
80 | } |
||
81 | |||
82 | /** |
||
83 | * Backup a database. |
||
84 | * |
||
85 | * @param string $environmentUuid |
||
86 | * @param string $dbName |
||
87 | * @return OperationResponse |
||
88 | */ |
||
89 | public function createDatabaseBackup($environmentUuid, $dbName) |
||
90 | { |
||
91 | return new OperationResponse( |
||
92 | $this->client->request( |
||
93 | 'post', |
||
94 | "/environments/${environmentUuid}/databases/${dbName}/backups" |
||
95 | ) |
||
96 | ); |
||
97 | } |
||
98 | |||
99 | /** |
||
100 | * Shows all database backups in an environment. |
||
101 | * |
||
102 | * @param string $environmentUuid |
||
103 | * @param string $dbName |
||
104 | * @return BackupsResponse |
||
105 | */ |
||
106 | public function getDatabaseBackups($environmentUuid, $dbName) |
||
107 | { |
||
108 | return new BackupsResponse( |
||
109 | $this->client->request( |
||
110 | 'get', |
||
111 | "/environments/${environmentUuid}/databases/${dbName}/backups" |
||
112 | ) |
||
113 | ); |
||
114 | } |
||
115 | |||
116 | /** |
||
117 | * Gets information about a database backup. |
||
118 | * |
||
119 | * @param string $environmentUuid |
||
120 | * @param string $dbName |
||
121 | * @param int $backupId |
||
122 | * @return BackupResponse |
||
123 | */ |
||
124 | public function getDatabaseBackup($environmentUuid, $dbName, $backupId) |
||
125 | { |
||
126 | return new BackupResponse( |
||
127 | $this->client->request( |
||
128 | 'get', |
||
129 | "/environments/${environmentUuid}/databases/${dbName}/backups/${backupId}" |
||
130 | ) |
||
131 | ); |
||
132 | } |
||
133 | |||
134 | /** |
||
135 | * Restores a database backup to a database in an environment. |
||
136 | * |
||
137 | * @param string $environmentUuid |
||
138 | * @param string $dbName |
||
139 | * @param int $backupId |
||
140 | * @return OperationResponse |
||
141 | */ |
||
142 | public function restoreDatabaseBackup($environmentUuid, $dbName, $backupId) |
||
143 | { |
||
144 | return new OperationResponse( |
||
145 | $this->client->request( |
||
146 | 'post', |
||
147 | "/environments/${environmentUuid}/databases/${dbName}/backups/${backupId}/actions/restore" |
||
148 | ) |
||
149 | ); |
||
150 | } |
||
151 | |||
152 | /** |
||
153 | * Copies files from an environment to another environment. |
||
154 | * |
||
155 | * @param string $environmentUuidFrom |
||
156 | * @param string $environmentUuidTo |
||
157 | * @return OperationResponse |
||
158 | */ |
||
159 | public function copyFiles($environmentUuidFrom, $environmentUuidTo) |
||
160 | { |
||
161 | $options = [ |
||
162 | 'form_params' => [ |
||
163 | 'source' => $environmentUuidFrom, |
||
164 | ], |
||
165 | ]; |
||
166 | |||
167 | return new OperationResponse( |
||
168 | $this->client->request('post', "/environments/${environmentUuidTo}/files", $options) |
||
169 | ); |
||
170 | } |
||
171 | |||
172 | /** |
||
173 | * Deploys a code branch/tag to an environment. |
||
174 | * |
||
175 | * @param string $environmentUuid |
||
176 | * @param string $branch |
||
177 | * @return OperationResponse |
||
178 | */ |
||
179 | public function switchCode($environmentUuid, $branch) |
||
180 | { |
||
181 | |||
182 | $options = [ |
||
183 | 'form_params' => [ |
||
184 | 'branch' => $branch, |
||
185 | ], |
||
186 | ]; |
||
187 | |||
188 | return new OperationResponse( |
||
189 | $this->client->request( |
||
190 | 'post', |
||
191 | "/environments/${environmentUuid}/code/actions/switch", |
||
192 | $options |
||
193 | ) |
||
194 | ); |
||
195 | } |
||
196 | |||
197 | /** |
||
198 | * Deploys code from one environment to another environment. |
||
199 | * |
||
200 | * @param string $environmentFromUuid |
||
201 | * @param string $environmentToUuid |
||
202 | * @param string $commitMessage |
||
203 | */ |
||
204 | public function deployCode($environmentFromUuid, $environmentToUuid, $commitMessage = null) |
||
205 | { |
||
206 | |||
207 | $options = [ |
||
208 | 'form_params' => [ |
||
209 | 'source' => $environmentFromUuid, |
||
210 | 'message' => $commitMessage, |
||
211 | ], |
||
212 | ]; |
||
213 | |||
214 | return new OperationResponse( |
||
215 | $this->client->request( |
||
216 | 'post', |
||
217 | "/environments/${environmentToUuid}/code", |
||
218 | $options |
||
219 | ) |
||
220 | ); |
||
221 | } |
||
222 | |||
223 | /** |
||
224 | * Shows all domains on an environment. |
||
225 | * |
||
226 | * @param string $environmentUuid |
||
227 | * @return DomainsResponse |
||
228 | */ |
||
229 | public function getDomains($environmentUuid) |
||
230 | { |
||
231 | return new DomainsResponse( |
||
232 | $this->client->request( |
||
233 | 'get', |
||
234 | "/environments/${environmentUuid}/domains" |
||
235 | ) |
||
236 | ); |
||
237 | } |
||
238 | |||
239 | /** |
||
240 | * Return details about a domain. |
||
241 | * |
||
242 | * @param string $environmentUuid |
||
243 | * @param string $domain |
||
244 | * @return DomainResponse |
||
245 | */ |
||
246 | public function getDomain($environmentUuid, $domain) |
||
247 | { |
||
248 | return new DomainResponse( |
||
249 | $this->client->request( |
||
250 | 'get', |
||
251 | "/environments/${environmentUuid}/domains/${domain}" |
||
252 | ) |
||
253 | ); |
||
254 | } |
||
255 | |||
256 | /** |
||
257 | * Adds a domain to an environment. |
||
258 | * |
||
259 | * @param string $environmentUuid |
||
260 | * @param string $hostname |
||
261 | * @return OperationResponse |
||
262 | */ |
||
263 | public function createDomain($environmentUuid, $hostname) |
||
264 | { |
||
265 | |||
266 | $options = [ |
||
267 | 'form_params' => [ |
||
268 | 'hostname' => $hostname, |
||
269 | ], |
||
270 | ]; |
||
271 | |||
272 | return new OperationResponse( |
||
273 | $this->client->request('post', "/environments/${environmentUuid}/domains", $options) |
||
274 | ); |
||
275 | } |
||
276 | |||
277 | /** |
||
278 | * Deletes a domain from an environment. |
||
279 | * |
||
280 | * @param string $environmentUuid |
||
281 | * @param string $domain |
||
282 | * @return OperationResponse |
||
283 | */ |
||
284 | public function deleteDomain($environmentUuid, $domain) |
||
285 | { |
||
286 | return new OperationResponse( |
||
287 | $this->client->request('delete', "/environments/${environmentUuid}/domains/${domain}") |
||
288 | ); |
||
289 | } |
||
290 | |||
291 | /** |
||
292 | * Purges varnish for selected domains in an environment. |
||
293 | * |
||
294 | * @param string $environmentUuid |
||
295 | * @param array $domains |
||
296 | * @return OperationResponse |
||
297 | */ |
||
298 | public function purgeVarnishCache($environmentUuid, array $domains) |
||
299 | { |
||
300 | |||
301 | $options = [ |
||
302 | 'form_params' => [ |
||
303 | 'domains' => $domains, |
||
304 | ], |
||
305 | ]; |
||
306 | |||
307 | return new OperationResponse( |
||
308 | $this->client->request( |
||
309 | 'post', |
||
310 | "/environments/${environmentUuid}/domains/actions/clear-varnish", |
||
311 | $options |
||
312 | ) |
||
313 | ); |
||
314 | } |
||
315 | |||
316 | /** |
||
317 | * Gets information about an environment. |
||
318 | * |
||
319 | * @param string $environmentUuid |
||
320 | * @return EnvironmentResponse |
||
321 | */ |
||
322 | public function getEnvironment($environmentUuid) |
||
323 | { |
||
324 | return new EnvironmentResponse( |
||
325 | $this->client->request( |
||
326 | 'get', |
||
327 | "/environments/${environmentUuid}" |
||
328 | ) |
||
329 | ); |
||
330 | } |
||
331 | |||
332 | /** |
||
333 | * Modifies configuration settings for an environment. |
||
334 | * |
||
335 | * @param string $environmentUuid |
||
336 | * @param array $config |
||
337 | * @return OperationResponse |
||
338 | */ |
||
339 | public function modifyEnvironment($environmentUuid, array $config) |
||
340 | { |
||
341 | |||
342 | $options = [ |
||
343 | 'form_params' => $config, |
||
344 | ]; |
||
345 | |||
346 | return new OperationResponse( |
||
347 | $this->client->request( |
||
348 | 'put', |
||
349 | "/environments/${environmentUuid}", |
||
350 | $options |
||
351 | ) |
||
352 | ); |
||
353 | } |
||
354 | |||
355 | /** |
||
356 | * Renames an environment. |
||
357 | * |
||
358 | * @param string $environmentUuid |
||
359 | * @param string $label |
||
360 | * @return OperationResponse |
||
361 | */ |
||
362 | public function renameEnvironment($environmentUuid, $label) |
||
363 | { |
||
364 | |||
365 | $options = [ |
||
366 | 'form_params' => [ |
||
367 | 'label' => $label, |
||
368 | ], |
||
369 | ]; |
||
370 | |||
371 | return new OperationResponse( |
||
372 | $this->client->request( |
||
373 | 'post', |
||
374 | "/environments/${environmentUuid}/actions/change-label", |
||
375 | $options |
||
376 | ) |
||
377 | ); |
||
378 | } |
||
379 | |||
380 | /** |
||
381 | * Show all servers associated with an environment. |
||
382 | * |
||
383 | * @param string $environmentUuid |
||
384 | * @return ServersResponse |
||
385 | */ |
||
386 | public function getServers($environmentUuid) |
||
387 | { |
||
388 | return new ServersResponse( |
||
389 | $this->client->request( |
||
390 | 'get', |
||
391 | "/environments/${environmentUuid}/servers" |
||
392 | ) |
||
393 | ); |
||
394 | } |
||
395 | |||
396 | /** |
||
397 | * Enable livedev mode for an environment. |
||
398 | * |
||
399 | * @param string $environmentUuid |
||
400 | * @return OperationResponse |
||
401 | */ |
||
402 | public function enableLiveDev($environmentUuid) |
||
403 | { |
||
404 | return new OperationResponse( |
||
405 | $this->client->request('post', "/environments/${environmentUuid}/livedev/actions/enable") |
||
406 | ); |
||
407 | } |
||
408 | |||
409 | /** |
||
410 | * Disable livedev mode for an environment. |
||
411 | * |
||
412 | * @param string $environmentUuid |
||
413 | * @return OperationResponse |
||
414 | */ |
||
415 | public function disableLiveDev($environmentUuid) |
||
416 | { |
||
417 | |||
418 | $options = [ |
||
419 | 'form_params' => [ |
||
420 | 'discard' => 1, |
||
421 | ], |
||
422 | ]; |
||
423 | |||
424 | return new OperationResponse( |
||
425 | $this->client->request( |
||
426 | 'post', |
||
427 | "/environments/${environmentUuid}/livedev/actions/disable", |
||
428 | $options |
||
429 | ) |
||
430 | ); |
||
431 | } |
||
432 | |||
433 | /** |
||
434 | * Enable production mode for an environment. |
||
435 | * |
||
436 | * @param string $environmentUuid |
||
437 | * @return OperationResponse |
||
438 | */ |
||
439 | public function enableProductionMode($environmentUuid) |
||
445 | ) |
||
446 | ); |
||
447 | } |
||
448 | |||
449 | /** |
||
450 | * Disable production mode for an environment. |
||
451 | * |
||
452 | * @param string $environmentUuid |
||
453 | * @return OperationResponse |
||
454 | */ |
||
455 | public function disableProductionMode($environmentUuid) |
||
456 | { |
||
457 | return new OperationResponse( |
||
458 | $this->client->request( |
||
459 | 'post', |
||
460 | "/environments/${environmentUuid}/production-mode/actions/disable" |
||
461 | ) |
||
462 | ); |
||
463 | } |
||
464 | |||
465 | /** |
||
466 | * Show all cron tasks for an environment. |
||
467 | * |
||
468 | * @param string $environmentUuid The environment ID |
||
469 | * @return CronsResponse |
||
470 | */ |
||
471 | public function getCrons($environmentUuid) |
||
472 | { |
||
473 | return new CronsResponse( |
||
474 | $this->client->request( |
||
475 | 'get', |
||
476 | "/environments/${environmentUuid}/crons" |
||
477 | ) |
||
478 | ); |
||
479 | } |
||
480 | |||
481 | /** |
||
482 | * Get information about a cron task. |
||
483 | * |
||
484 | * @param string $environmentUuid The environment ID |
||
485 | * @param int $cronId |
||
486 | * @return CronResponse |
||
487 | */ |
||
488 | public function getCron($environmentUuid, $cronId) |
||
489 | { |
||
490 | return new CronResponse( |
||
491 | $this->client->request( |
||
492 | 'get', |
||
493 | "/environments/${environmentUuid}/crons/${cronId}" |
||
494 | ) |
||
495 | ); |
||
496 | } |
||
497 | |||
498 | /** |
||
499 | * Add a cron task. |
||
500 | * |
||
501 | * @param string $environmentUuid |
||
502 | * @param string $command |
||
503 | * @param string $frequency |
||
504 | * @param string $label |
||
505 | * @return OperationResponse |
||
506 | */ |
||
507 | public function createCron($environmentUuid, $command, $frequency, $label) |
||
520 | ); |
||
521 | } |
||
522 | |||
523 | /** |
||
524 | * Delete a cron task. |
||
525 | * |
||
526 | * @param string $environmentUuid |
||
527 | * @param int $cronId |
||
528 | * @return OperationResponse |
||
529 | */ |
||
530 | public function deleteCron($environmentUuid, $cronId) |
||
531 | { |
||
532 | return new OperationResponse( |
||
533 | $this->client->request('delete', "/environments/${environmentUuid}/crons/${cronId}") |
||
534 | ); |
||
535 | } |
||
536 | |||
537 | /** |
||
538 | * Disable a cron task. |
||
539 | * |
||
540 | * @param string $environmentUuid |
||
541 | * @param int $cronId |
||
542 | * @return OperationResponse |
||
543 | */ |
||
544 | public function disableCron($environmentUuid, $cronId) |
||
545 | { |
||
546 | return new OperationResponse( |
||
547 | $this->client->request( |
||
548 | 'post', |
||
549 | "/environments/${environmentUuid}/crons/${cronId}/actions/disable" |
||
550 | ) |
||
551 | ); |
||
552 | } |
||
553 | |||
554 | /** |
||
555 | * Enable a cron task. |
||
556 | * |
||
557 | * @param string $environmentUuid |
||
558 | * @param int $cronId |
||
559 | * @return OperationResponse |
||
560 | */ |
||
561 | public function enableCron($environmentUuid, $cronId) |
||
562 | { |
||
563 | return new OperationResponse( |
||
564 | $this->client->request( |
||
565 | 'post', |
||
566 | "/environments/${environmentUuid}/crons/${cronId}/actions/enable" |
||
567 | ) |
||
568 | ); |
||
569 | } |
||
570 | |||
571 | /** |
||
572 | * Show insights data from a specific environment. |
||
573 | * |
||
574 | * @param string $environmentUuid |
||
575 | * @return InsightsResponse |
||
576 | */ |
||
577 | public function getInsights($environmentUuid) |
||
578 | { |
||
579 | return new InsightsResponse( |
||
580 | $this->client->request('get', "/environments/${environmentUuid}/insight") |
||
581 | ); |
||
582 | } |
||
583 | |||
584 | /** |
||
585 | * Returns logstream WSS stream information. |
||
586 | * |
||
587 | * @return LogstreamResponse |
||
588 | */ |
||
589 | public function getLogstream($environmentUuid) |
||
590 | { |
||
591 | return new LogstreamResponse( |
||
592 | $this->client->request('get', "/environments/${environmentUuid}/logstream") |
||
593 | ); |
||
594 | } |
||
595 | |||
596 | /** |
||
597 | * Returns a list of SSL certificates. |
||
598 | * |
||
599 | * @param string $environmentUuid The environment ID |
||
600 | * @return CertificatesResponse |
||
601 | */ |
||
602 | public function getSslCertificates($environmentUuid) |
||
603 | { |
||
604 | return new CertificatesResponse( |
||
605 | $this->client->request( |
||
606 | 'get', |
||
607 | "/environments/${environmentUuid}/ssl/certificates" |
||
608 | ) |
||
609 | ); |
||
610 | } |
||
611 | |||
612 | /** |
||
613 | * Returns a specific certificate by certificate ID. |
||
614 | * |
||
615 | * @param string $environmentUuid The environment ID |
||
616 | * @param int $certificateId |
||
617 | * @return CertificateResponse |
||
618 | */ |
||
619 | public function getSslCertificate($environmentUuid, $certificateId) |
||
620 | { |
||
621 | return new CertificateResponse( |
||
622 | $this->client->request( |
||
623 | 'get', |
||
624 | "/environments/${environmentUuid}/ssl/certificates/${certificateId}" |
||
625 | ) |
||
626 | ); |
||
627 | } |
||
628 | |||
629 | /** |
||
630 | * Install an SSL certificate. |
||
631 | * |
||
632 | * @param string $envUuid |
||
633 | * @param string $label |
||
634 | * @param string $cert |
||
635 | * @param string $key |
||
636 | * @param string $ca |
||
637 | * @param int $csr |
||
638 | * @param bool $legacy |
||
639 | * @return OperationResponse |
||
640 | */ |
||
641 | public function createSslCertificate($envUuid, $label, $cert, $key, $ca = null, $csr = null, $legacy = false) |
||
642 | { |
||
643 | |||
644 | $options = [ |
||
645 | 'form_params' => [ |
||
646 | 'label' => $label, |
||
647 | 'certificate' => $cert, |
||
648 | 'private_key' => $key, |
||
649 | ], |
||
650 | ]; |
||
651 | |||
652 | if ($ca) { |
||
653 | $options['form_params']['ca_certificates'] = $ca; |
||
654 | } |
||
655 | if ($csr) { |
||
656 | $options['form_params']['csr_id'] = $csr; |
||
657 | } |
||
658 | |||
659 | return new OperationResponse( |
||
660 | $this->client->request('post', "/environments/${envUuid}/ssl/certificates", $options) |
||
661 | ); |
||
662 | } |
||
663 | |||
664 | /** |
||
665 | * Delete a specific certificate by ID. |
||
666 | * |
||
667 | * @param string $environmentUuid |
||
668 | * @param int $certificateId |
||
669 | * @return OperationResponse |
||
670 | */ |
||
671 | public function deleteSslCertificate($environmentUuid, $certificateId) |
||
672 | { |
||
673 | return new OperationResponse( |
||
674 | $this->client->request('delete', "/environments/${environmentUuid}/ssl/certificates/${certificateId}") |
||
675 | ); |
||
676 | } |
||
677 | |||
678 | /** |
||
679 | * Deactivates an active SSL certificate. |
||
680 | * |
||
681 | * @param string $environmentUuid |
||
682 | * @param int $certificateId |
||
683 | * @return OperationResponse |
||
684 | */ |
||
685 | public function deactivateSslCertificate($environmentUuid, $certificateId) |
||
691 | ) |
||
692 | ); |
||
693 | } |
||
694 | |||
695 | /** |
||
696 | * Activates an SSL certificate. |
||
697 | * |
||
698 | * @param string $environmentUuid |
||
699 | * @param int $certificateId |
||
700 | * @return OperationResponse |
||
701 | */ |
||
702 | public function activateSslCertificate($environmentUuid, $certificateId) |
||
703 | { |
||
704 | return new OperationResponse( |
||
705 | $this->client->request( |
||
706 | 'post', |
||
707 | "/environments/${environmentUuid}/ssl/certificate/${certificateId}/actions/activate" |
||
708 | ) |
||
709 | ); |
||
710 | } |
||
711 | |||
712 | /** |
||
713 | * Returns a list of log forwarding destinations. |
||
714 | * |
||
715 | * @param string $environmentUuid The environment ID |
||
716 | * @return LogForwardingDestinationsResponse |
||
717 | */ |
||
718 | public function getLogDestinations($environmentUuid) |
||
719 | { |
||
720 | return new LogForwardingDestinationsResponse( |
||
721 | $this->client->request( |
||
722 | 'get', |
||
723 | "/environments/${environmentUuid}/log-forwarding-destinations" |
||
724 | ) |
||
725 | ); |
||
726 | } |
||
727 | |||
728 | /** |
||
729 | * Returns a specific log forwarding destination. |
||
730 | * |
||
731 | * @param string $environmentUuid The environment ID |
||
732 | * @param int $destinationId |
||
733 | * @return LogForwardingDestinationResponse |
||
734 | */ |
||
735 | public function getLogDestination($environmentUuid, $destinationId) |
||
736 | { |
||
737 | return new LogForwardingDestinationResponse( |
||
738 | $this->client->request( |
||
739 | 'get', |
||
740 | "/environments/${environmentUuid}/log-forwarding-destinations/${destinationId}" |
||
741 | ) |
||
742 | ); |
||
743 | } |
||
744 | |||
745 | /** |
||
746 | * Creates a log forwarding destination. |
||
747 | * |
||
748 | * @param string $environmentUuid |
||
749 | * @param string $label |
||
750 | * @param array $sources |
||
751 | * @param string $consumer |
||
752 | * @param array $credentials |
||
753 | * @param string $address |
||
754 | * @return OperationResponse |
||
755 | */ |
||
756 | public function createLogDestination($environmentUuid, $label, $sources, $consumer, $credentials, $address) |
||
771 | ); |
||
772 | } |
||
773 | |||
774 | /** |
||
775 | * Delete a specific log forwarding destination. |
||
776 | * |
||
777 | * @param string $environmentUuid |
||
778 | * @param int $destId |
||
779 | * @return OperationResponse |
||
780 | */ |
||
781 | public function deleteLogDestination($environmentUuid, $destId) |
||
782 | { |
||
783 | return new OperationResponse( |
||
784 | $this->client->request('delete', "/environments/${environmentUuid}/log-forwarding-destinations/${destId}") |
||
785 | ); |
||
786 | } |
||
787 | |||
788 | /** |
||
789 | * Disables a log forwarding destination. |
||
790 | * |
||
791 | * @param string $environmentUuid |
||
792 | * @param int $destId |
||
793 | * @return OperationResponse |
||
794 | */ |
||
795 | public function disableLogDestination($environmentUuid, $destId) |
||
796 | { |
||
797 | return new OperationResponse( |
||
798 | $this->client->request( |
||
799 | 'post', |
||
800 | "/environments/${environmentUuid}/log-forwarding-destinations/${destId}/actions/disable" |
||
801 | ) |
||
802 | ); |
||
803 | } |
||
804 | |||
805 | /** |
||
806 | * Disables a log forwarding destination. |
||
807 | * |
||
808 | * @param string $environmentUuid |
||
809 | * @param int $destId |
||
810 | * @return OperationResponse |
||
811 | */ |
||
812 | public function enableLogDestination($environmentUuid, $destId) |
||
813 | { |
||
814 | return new OperationResponse( |
||
815 | $this->client->request( |
||
816 | 'post', |
||
817 | "/environments/${environmentUuid}/log-forwarding-destinations/${destId}/actions/enable" |
||
818 | ) |
||
819 | ); |
||
820 | } |
||
821 | |||
822 | /** |
||
823 | * Updates a log forwarding destination. |
||
824 | * |
||
825 | * @param string $environmentUuid |
||
826 | * @param int $destId |
||
827 | * @param string $label |
||
828 | * @param array $sources |
||
829 | * @param string $consumer |
||
830 | * @param array $creds |
||
831 | * @param string $address |
||
832 | * @return OperationResponse |
||
833 | */ |
||
834 | public function updateLogDestination($environmentUuid, $destId, $label, $sources, $consumer, $creds, $address) |
||
852 | ) |
||
853 | ); |
||
854 | } |
||
855 | } |
||
856 |