Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like CloudApiClient 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. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
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 CloudApiClient, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 10 | class CloudApiClient extends Client implements ServiceManagerAware |
||
| 11 | { |
||
| 12 | const BASE_URL = 'https://cloudapi.acquia.com'; |
||
| 13 | const BASE_PATH = '/v1'; |
||
| 14 | |||
| 15 | const INSTALL_MAKEFILE = 'make_url'; |
||
| 16 | const INSTALL_PROJECT = 'distro_url'; |
||
| 17 | |||
| 18 | const LIVEDEV_ENABLE = 'enable'; |
||
| 19 | const LIVEDEV_DISABLE = 'disable'; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * {@inheritdoc} |
||
| 23 | * |
||
| 24 | * @return \Acquia\Cloud\Api\CloudApiClient |
||
| 25 | */ |
||
| 26 | 165 | public static function factory($config = array()) |
|
| 52 | |||
| 53 | /** |
||
| 54 | * {@inheritdoc} |
||
| 55 | */ |
||
| 56 | 3 | public function getBuilderParams() |
|
| 64 | |||
| 65 | /** |
||
| 66 | * @return \Acquia\Cloud\Api\Response\SiteNames |
||
| 67 | * |
||
| 68 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 69 | * |
||
| 70 | * @see http://cloudapi.acquia.com/#GET___sites_-instance_route |
||
| 71 | */ |
||
| 72 | 6 | public function sites() |
|
| 77 | |||
| 78 | /** |
||
| 79 | * @param string $site |
||
| 80 | * |
||
| 81 | * @return \Acquia\Cloud\Api\Response\Site |
||
| 82 | * |
||
| 83 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 84 | * |
||
| 85 | * @see http://cloudapi.acquia.com/#GET__sites__site-instance_route |
||
| 86 | */ |
||
| 87 | 3 | public function site($site) |
|
| 93 | |||
| 94 | /** |
||
| 95 | * @param string $site |
||
| 96 | * |
||
| 97 | * @return \Acquia\Cloud\Api\Response\Environments |
||
| 98 | * |
||
| 99 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 100 | * |
||
| 101 | * @see http://cloudapi.acquia.com/#GET__sites__site_envs-instance_route |
||
| 102 | */ |
||
| 103 | 3 | public function environments($site) |
|
| 109 | |||
| 110 | /** |
||
| 111 | * @param string $site |
||
| 112 | * @param string $env |
||
| 113 | * |
||
| 114 | * @return \Acquia\Cloud\Api\Response\Environment |
||
| 115 | * |
||
| 116 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 117 | * |
||
| 118 | * @see http://cloudapi.acquia.com/#GET__sites__site_envs__env-instance_route |
||
| 119 | */ |
||
| 120 | 3 | View Code Duplication | public function environment($site, $env) |
| 129 | |||
| 130 | /** |
||
| 131 | * @param string $site |
||
| 132 | * @param string $env |
||
| 133 | * @param string $type |
||
| 134 | * @param string $source |
||
| 135 | * |
||
| 136 | * @return \Acquia\Cloud\Api\Response\Task |
||
| 137 | * |
||
| 138 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 139 | * |
||
| 140 | * @see http://cloudapi.acquia.com/#POST__sites__site_envs__env_install__type-instance_route |
||
| 141 | */ |
||
| 142 | public function installDistro($site, $env, $type, $source) |
||
| 153 | |||
| 154 | /** |
||
| 155 | * Install any publicly accessible, standard Drupal distribution. |
||
| 156 | * |
||
| 157 | * @param string $site |
||
| 158 | * @param string $env |
||
| 159 | * @param string $projectName |
||
| 160 | * @param string $version |
||
| 161 | * |
||
| 162 | * @return \Acquia\Cloud\Api\Response\Task |
||
| 163 | * |
||
| 164 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 165 | */ |
||
| 166 | public function installDistroByProject($site, $env, $projectName, $version) |
||
| 171 | |||
| 172 | /** |
||
| 173 | * Install a distro by passing a URL to a Drush makefile. |
||
| 174 | * |
||
| 175 | * @param string $site |
||
| 176 | * @param string $env |
||
| 177 | * @param string $makefileUrl |
||
| 178 | * |
||
| 179 | * @return \Acquia\Cloud\Api\Response\Task |
||
| 180 | * |
||
| 181 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 182 | */ |
||
| 183 | public function installDistroByMakefile($site, $env, $makefileUrl) |
||
| 187 | |||
| 188 | /** |
||
| 189 | * @param string $site |
||
| 190 | * @param string $env |
||
| 191 | * |
||
| 192 | * @return \Acquia\Cloud\Api\Response\Servers |
||
| 193 | * |
||
| 194 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 195 | * |
||
| 196 | * @see http://cloudapi.acquia.com/#GET__sites__site_envs__env_servers-instance_route |
||
| 197 | */ |
||
| 198 | 3 | View Code Duplication | public function servers($site, $env) |
| 207 | |||
| 208 | /** |
||
| 209 | * @param string $site |
||
| 210 | * @param string $env |
||
| 211 | * @param string $server |
||
| 212 | * |
||
| 213 | * @return \Acquia\Cloud\Api\Response\Server |
||
| 214 | * |
||
| 215 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 216 | * |
||
| 217 | * @see http://cloudapi.acquia.com/#GET__sites__site_envs__env_servers__server-instance_route |
||
| 218 | */ |
||
| 219 | 3 | public function server($site, $env, $server) |
|
| 229 | |||
| 230 | /** |
||
| 231 | * @param string $site |
||
| 232 | * |
||
| 233 | * @return \Acquia\Cloud\Api\Response\SshKeys |
||
| 234 | * |
||
| 235 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 236 | * |
||
| 237 | * @see http://cloudapi.acquia.com/#GET__sites__site_sshkeys-instance_route |
||
| 238 | */ |
||
| 239 | 3 | public function sshKeys($site) |
|
| 245 | |||
| 246 | /** |
||
| 247 | * @param string $site |
||
| 248 | * @param int $keyId |
||
| 249 | * |
||
| 250 | * @return \Acquia\Cloud\Api\Response\SshKey |
||
| 251 | * |
||
| 252 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 253 | * |
||
| 254 | * @see http://cloudapi.acquia.com/#GET__sites__site_sshkeys__sshkeyid-instance_route |
||
| 255 | */ |
||
| 256 | 3 | public function sshKey($site, $keyId) |
|
| 265 | |||
| 266 | /** |
||
| 267 | * @param string $site |
||
| 268 | * @param string $publicKey |
||
| 269 | * @param string $nickname |
||
| 270 | * @param bool $shellAccess |
||
| 271 | * @param bool $vcsAccess |
||
| 272 | * @param array $blacklist |
||
| 273 | * |
||
| 274 | * @return \Acquia\Cloud\Api\Response\Task |
||
| 275 | * |
||
| 276 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 277 | * |
||
| 278 | * @see http://cloudapi.acquia.com/#POST__sites__site_sshkeys-instance_route |
||
| 279 | */ |
||
| 280 | 3 | public function addSshKey($site, $publicKey, $nickname, $shellAccess = true, $vcsAccess = true, $blacklist = array()) |
|
| 296 | |||
| 297 | /** |
||
| 298 | * @param string $site |
||
| 299 | * @param int $keyId |
||
| 300 | * |
||
| 301 | * @return \Acquia\Cloud\Api\Response\Task |
||
| 302 | * |
||
| 303 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException|\InvalidArgumentException |
||
| 304 | * |
||
| 305 | * @see http://cloudapi.acquia.com/#DELETE__sites__site_sshkeys__sshkeyid-instance_route |
||
| 306 | */ |
||
| 307 | 9 | public function deleteSshKey($site, $keyId) |
|
| 322 | |||
| 323 | /** |
||
| 324 | * @param string $site |
||
| 325 | * |
||
| 326 | * @return \Acquia\Cloud\Api\Response\SvnUsers |
||
| 327 | * |
||
| 328 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 329 | * |
||
| 330 | * @see http://cloudapi.acquia.com/#GET__sites__site_svnusers-instance_route |
||
| 331 | */ |
||
| 332 | 3 | public function svnUsers($site) |
|
| 338 | |||
| 339 | /** |
||
| 340 | * @param string $site |
||
| 341 | * @param int $userId |
||
| 342 | * |
||
| 343 | * @return \Acquia\Cloud\Api\Response\SvnUser |
||
| 344 | * |
||
| 345 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 346 | * |
||
| 347 | * @see http://cloudapi.acquia.com/#GET__sites__site_svnusers__svnuserid-instance_route |
||
| 348 | */ |
||
| 349 | 3 | public function svnUser($site, $userId) |
|
| 358 | |||
| 359 | /** |
||
| 360 | * @param string $site |
||
| 361 | * @param string $username |
||
| 362 | * @param string $password |
||
| 363 | * |
||
| 364 | * @return \Acquia\Cloud\Api\Response\Task |
||
| 365 | * |
||
| 366 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 367 | * |
||
| 368 | * @see http://cloudapi.acquia.com/#POST__sites__site_svnusers__username-instance_route |
||
| 369 | * |
||
| 370 | * @todo Testing returned a 400 response. |
||
| 371 | */ |
||
| 372 | 3 | public function addSvnUser($site, $username, $password) |
|
| 383 | |||
| 384 | /** |
||
| 385 | * @param string $site |
||
| 386 | * @param int $userId |
||
| 387 | * |
||
| 388 | * @return \Acquia\Cloud\Api\Response\Task |
||
| 389 | * |
||
| 390 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 391 | * |
||
| 392 | * @see http://cloudapi.acquia.com/#DELETE__sites__site_svnusers__svnuserid-instance_route |
||
| 393 | * |
||
| 394 | * @todo Testing returned a 400 response. |
||
| 395 | */ |
||
| 396 | 3 | public function deleteSvnUser($site, $userId) |
|
| 405 | |||
| 406 | /** |
||
| 407 | * @param string $site |
||
| 408 | * |
||
| 409 | * @return \Acquia\Cloud\Api\Response\DatabaseNames |
||
| 410 | * |
||
| 411 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 412 | * |
||
| 413 | * @see http://cloudapi.acquia.com/#GET__sites__site_dbs-instance_route |
||
| 414 | */ |
||
| 415 | 6 | public function databases($site) |
|
| 421 | |||
| 422 | /** |
||
| 423 | * @param string $site |
||
| 424 | * @param string $db |
||
| 425 | * |
||
| 426 | * @return \Acquia\Cloud\Api\Response\DatabaseName |
||
| 427 | * |
||
| 428 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 429 | * |
||
| 430 | * @see http://cloudapi.acquia.com/#GET__sites__site_dbs__db-instance_route |
||
| 431 | */ |
||
| 432 | 6 | public function database($site, $db) |
|
| 441 | |||
| 442 | /** |
||
| 443 | * @param string $site |
||
| 444 | * @param string $db |
||
| 445 | * @param array $cluster_map |
||
| 446 | * Optional. A mapping containing all environments and the cluster to which |
||
| 447 | * the associated database should be created. Each entry consists of the |
||
| 448 | * environment name as the key and the database cluster ID as the value. |
||
| 449 | * Note that if more than one cluster is associated with a site group, |
||
| 450 | * this map is required. |
||
| 451 | * |
||
| 452 | * @return \Acquia\Cloud\Api\Response\Task |
||
| 453 | * |
||
| 454 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 455 | * |
||
| 456 | * @see http://cloudapi.acquia.com/#POST__sites__site_dbs-instance_route |
||
| 457 | */ |
||
| 458 | 6 | public function addDatabase($site, $db, $cluster_map = NULL) |
|
| 478 | |||
| 479 | /** |
||
| 480 | * @param string $site |
||
| 481 | * @param string $db |
||
| 482 | * @param bool $backup |
||
| 483 | * Optional. If TRUE, a final backup of the database instance in each |
||
| 484 | * environment is made before deletion. |
||
| 485 | * |
||
| 486 | * @return \Acquia\Cloud\Api\Response\Task |
||
| 487 | * |
||
| 488 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 489 | * |
||
| 490 | * @see http://cloudapi.acquia.com/#DELETE__sites__site_dbs__db-instance_route |
||
| 491 | */ |
||
| 492 | 6 | public function deleteDatabase($site, $db, $backup = TRUE) |
|
| 502 | |||
| 503 | /** |
||
| 504 | * @param string $site |
||
| 505 | * @param string $env |
||
| 506 | * |
||
| 507 | * @return \Acquia\Cloud\Api\Response\Databases |
||
| 508 | * |
||
| 509 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 510 | * |
||
| 511 | * @see http://cloudapi.acquia.com/#GET__sites__site_envs__env_dbs-instance_route |
||
| 512 | */ |
||
| 513 | 3 | View Code Duplication | public function environmentDatabases($site, $env) |
| 522 | |||
| 523 | /** |
||
| 524 | * @param string $site |
||
| 525 | * @param string $env |
||
| 526 | * @param string $db |
||
| 527 | * |
||
| 528 | * @return \Acquia\Cloud\Api\Response\Database |
||
| 529 | * |
||
| 530 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 531 | * |
||
| 532 | * @see http://cloudapi.acquia.com/#GET__sites__site_envs__env_dbs__db-instance_route |
||
| 533 | */ |
||
| 534 | 3 | public function environmentDatabase($site, $env, $db) |
|
| 544 | |||
| 545 | /** |
||
| 546 | * @param string $site |
||
| 547 | * @param string $env |
||
| 548 | * @param string $db |
||
| 549 | * |
||
| 550 | * @return \Acquia\Cloud\Api\Response\DatabaseBackups |
||
| 551 | * |
||
| 552 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 553 | * |
||
| 554 | * @see http://cloudapi.acquia.com/#GET__sites__site_envs__env_dbs__db_backups-instance_route |
||
| 555 | */ |
||
| 556 | 3 | public function databaseBackups($site, $env, $db) |
|
| 557 | { |
||
| 558 | $variables = array( |
||
| 559 | 3 | 'site' => $site, |
|
| 560 | 3 | 'env' => $env, |
|
| 561 | 3 | 'db' => $db, |
|
| 562 | 3 | ); |
|
| 563 | 3 | $request = $this->get(array('{+base_path}/sites/{site}/envs/{env}/dbs/{db}/backups.json', $variables)); |
|
| 564 | 3 | return new Response\DatabaseBackups($request); |
|
| 565 | } |
||
| 566 | |||
| 567 | /** |
||
| 568 | * @param string $site |
||
| 569 | * @param string $env |
||
| 570 | * @param string $db |
||
| 571 | * @param int $backupId |
||
| 572 | * |
||
| 573 | * @return \Acquia\Cloud\Api\Response\Task |
||
| 574 | * |
||
| 575 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 576 | * |
||
| 577 | * @see http://cloudapi.acquia.com/#GET__sites__site_envs__env_dbs__db_backups__backup-instance_route |
||
| 578 | */ |
||
| 579 | 3 | public function databaseBackup($site, $env, $db, $backupId) |
|
| 580 | { |
||
| 581 | $variables = array( |
||
| 582 | 3 | 'site' => $site, |
|
| 583 | 3 | 'env' => $env, |
|
| 584 | 3 | 'db' => $db, |
|
| 585 | 3 | 'id' => $backupId, |
|
| 586 | 3 | ); |
|
| 587 | 3 | $request = $this->get(array('{+base_path}/sites/{site}/envs/{env}/dbs/{db}/backups/{id}.json', $variables)); |
|
| 588 | 3 | return new Response\DatabaseBackup($request); |
|
| 589 | } |
||
| 590 | |||
| 591 | /** |
||
| 592 | * @param string $site |
||
| 593 | * @param string $env |
||
| 594 | * @param string $db |
||
| 595 | * @param int $backupId |
||
| 596 | * |
||
| 597 | * @return \Acquia\Cloud\Api\Response\Task |
||
| 598 | * |
||
| 599 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 600 | * |
||
| 601 | * @see http://cloudapi.acquia.com/#DELETE__sites__site_envs__env_dbs__db_backups__backup-instance_route |
||
| 602 | */ |
||
| 603 | 3 | public function deleteDatabaseBackup($site, $env, $db, $backupId) |
|
| 614 | |||
| 615 | /** |
||
| 616 | * @param string $site |
||
| 617 | * @param string $env |
||
| 618 | * @param string $db |
||
| 619 | * @param int $backupId |
||
| 620 | * @param string $outfile |
||
| 621 | * |
||
| 622 | * @return \Guzzle\Http\Message\Response |
||
| 623 | * |
||
| 624 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 625 | * |
||
| 626 | * @see http://cloudapi.acquia.com/#GET__sites__site_envs__env_dbs__db_backups__backup_download-instance_route |
||
| 627 | */ |
||
| 628 | 3 | public function downloadDatabaseBackup($site, $env, $db, $backupId, $outfile) |
|
| 629 | { |
||
| 630 | $variables = array( |
||
| 631 | 3 | 'site' => $site, |
|
| 632 | 3 | 'env' => $env, |
|
| 633 | 3 | 'db' => $db, |
|
| 634 | 3 | 'id' => $backupId, |
|
| 635 | 3 | ); |
|
| 636 | 3 | return $this |
|
| 637 | 3 | ->get(array('{+base_path}/sites/{site}/envs/{env}/dbs/{db}/backups/{id}/download.json', $variables)) |
|
| 638 | 3 | ->setResponseBody($outfile) |
|
| 639 | 3 | ->send() |
|
| 640 | 3 | ; |
|
| 641 | } |
||
| 642 | |||
| 643 | /** |
||
| 644 | * @param string $site |
||
| 645 | * @param string $env |
||
| 646 | * @param string $db |
||
| 647 | * |
||
| 648 | * @return \Acquia\Cloud\Api\Response\Task |
||
| 649 | * |
||
| 650 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 651 | * |
||
| 652 | * @see http://cloudapi.acquia.com/#POST__sites__site_envs__env_dbs__db_backups-instance_route |
||
| 653 | */ |
||
| 654 | 3 | public function createDatabaseBackup($site, $env, $db) |
|
| 655 | { |
||
| 656 | $variables = array( |
||
| 657 | 3 | 'site' => $site, |
|
| 658 | 3 | 'env' => $env, |
|
| 659 | 3 | 'db' => $db, |
|
| 660 | 3 | ); |
|
| 661 | 3 | $request = $this->post(array('{+base_path}/sites/{site}/envs/{env}/dbs/{db}/backups.json', $variables)); |
|
| 662 | 3 | return new Response\Task($request); |
|
| 663 | } |
||
| 664 | |||
| 665 | /** |
||
| 666 | * @param string $site |
||
| 667 | * @param string $env |
||
| 668 | * @param string $db |
||
| 669 | * @param string $backupId |
||
| 670 | * |
||
| 671 | * @return \Acquia\Cloud\Api\Response\Task |
||
| 672 | * |
||
| 673 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 674 | * |
||
| 675 | * @see http://cloudapi.acquia.com/#POST__sites__site_envs__env_dbs__db_backups__backup_restore-instance_route |
||
| 676 | */ |
||
| 677 | 3 | public function restoreDatabaseBackup($site, $env, $db, $backupId) |
|
| 688 | |||
| 689 | /** |
||
| 690 | * @param string $site |
||
| 691 | * |
||
| 692 | * @return \Acquia\Cloud\Api\Response\Tasks |
||
| 693 | * |
||
| 694 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 695 | * |
||
| 696 | * @see http://cloudapi.acquia.com/#GET__sites__site_tasks-instance_route |
||
| 697 | */ |
||
| 698 | 3 | public function tasks($site) |
|
| 706 | |||
| 707 | /** |
||
| 708 | * @param string $site |
||
| 709 | * @param int $taskId |
||
| 710 | * |
||
| 711 | * @return \Acquia\Cloud\Api\Response\Task |
||
| 712 | * |
||
| 713 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 714 | * |
||
| 715 | * @see http://cloudapi.acquia.com/#GET__sites__site_tasks__task-instance_route |
||
| 716 | */ |
||
| 717 | 6 | public function task($site, $taskId) |
|
| 726 | |||
| 727 | /** |
||
| 728 | * @param string $site |
||
| 729 | * @param string $env |
||
| 730 | * |
||
| 731 | * @return \Acquia\Cloud\Api\Response\Domains |
||
| 732 | * |
||
| 733 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 734 | * |
||
| 735 | * @see http://cloudapi.acquia.com/#GET__sites__site_envs__env_domains-instance_route |
||
| 736 | */ |
||
| 737 | 3 | View Code Duplication | public function domains($site, $env) |
| 746 | |||
| 747 | /** |
||
| 748 | * @param string $site |
||
| 749 | * @param string $env |
||
| 750 | * @param string $domain |
||
| 751 | * |
||
| 752 | * @return \Acquia\Cloud\Api\Response\Domain |
||
| 753 | * |
||
| 754 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 755 | * |
||
| 756 | * @see http://cloudapi.acquia.com/#GET__sites__site_envs__env_domains__domain-instance_route |
||
| 757 | */ |
||
| 758 | 3 | View Code Duplication | public function domain($site, $env, $domain) |
| 768 | |||
| 769 | /** |
||
| 770 | * @param string $site |
||
| 771 | * @param string $env |
||
| 772 | * @param string $domain |
||
| 773 | * |
||
| 774 | * @return \Acquia\Cloud\Api\Response\Task |
||
| 775 | * |
||
| 776 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 777 | * |
||
| 778 | * @see http://cloudapi.acquia.com/#POST__sites__site_envs__env_domains__domain-instance_route |
||
| 779 | */ |
||
| 780 | 3 | View Code Duplication | public function addDomain($site, $env, $domain) |
| 790 | |||
| 791 | /** |
||
| 792 | * Moves domains atomically from one environment to another. |
||
| 793 | * |
||
| 794 | * @param string $site |
||
| 795 | * The site. |
||
| 796 | * @param string|array $domains |
||
| 797 | * The domain name(s) as an array of strings, or the string '*' to move all |
||
| 798 | * domains. |
||
| 799 | * @param string $sourceEnv |
||
| 800 | * The environment which currently has this domain. |
||
| 801 | * @param string $targetEnv |
||
| 802 | * The destination environment for the domain. |
||
| 803 | * @param bool $skipSiteUpdate |
||
| 804 | * Optional. If set to TRUE this will inhibit running |
||
| 805 | * fields-config-web.php for this domain move. |
||
| 806 | * |
||
| 807 | * @return \Acquia\Cloud\Api\Response\Task |
||
| 808 | * |
||
| 809 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 810 | * |
||
| 811 | * @see http://cloudapi.acquia.com/#POST__sites__site_domain_move__source__target-instance_route |
||
| 812 | */ |
||
| 813 | 6 | public function moveDomain($site, $domains, $sourceEnv, $targetEnv, $skipSiteUpdate = FALSE) |
|
| 831 | |||
| 832 | /** |
||
| 833 | * @param string $site |
||
| 834 | * @param string $env |
||
| 835 | * @param string $domain |
||
| 836 | * |
||
| 837 | * @return \Acquia\Cloud\Api\Response\Task |
||
| 838 | * |
||
| 839 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 840 | * |
||
| 841 | * @see http://cloudapi.acquia.com/#DELETE__sites__site_envs__env_domains__domain-instance_route |
||
| 842 | */ |
||
| 843 | 3 | View Code Duplication | public function deleteDomain($site, $env, $domain) |
| 853 | |||
| 854 | /** |
||
| 855 | * @param string $site |
||
| 856 | * @param string $env |
||
| 857 | * @param string $domain |
||
| 858 | * |
||
| 859 | * @return \Acquia\Cloud\Api\Response\Task |
||
| 860 | * |
||
| 861 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 862 | * |
||
| 863 | * @see http://cloudapi.acquia.com/#DELETE__sites__site_envs__env_domains__domain_cache-instance_route |
||
| 864 | */ |
||
| 865 | 3 | View Code Duplication | public function purgeVarnishCache($site, $env, $domain) |
| 875 | |||
| 876 | /** |
||
| 877 | * @param string $site |
||
| 878 | * @param string $db |
||
| 879 | * @param string $sourceEnv |
||
| 880 | * @param string $targetEnv |
||
| 881 | * |
||
| 882 | * @return \Acquia\Cloud\Api\Response\Task |
||
| 883 | * |
||
| 884 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 885 | * |
||
| 886 | * @see http://cloudapi.acquia.com/#POST__sites__site_dbs__db_db_copy__source__target-instance_route |
||
| 887 | */ |
||
| 888 | 3 | public function copyDatabase($site, $db, $sourceEnv, $targetEnv) |
|
| 899 | |||
| 900 | /** |
||
| 901 | * @param string $site |
||
| 902 | * @param string $sourceEnv |
||
| 903 | * @param string $targetEnv |
||
| 904 | * |
||
| 905 | * @return \Acquia\Cloud\Api\Response\Task |
||
| 906 | * |
||
| 907 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 908 | * |
||
| 909 | * @see http://cloudapi.acquia.com/#POST__sites__site_files_copy__source__target-instance_route |
||
| 910 | */ |
||
| 911 | 3 | public function copyFiles($site, $sourceEnv, $targetEnv) |
|
| 921 | |||
| 922 | /** |
||
| 923 | * @param string $site |
||
| 924 | * @param string $env |
||
| 925 | * @param string $action |
||
| 926 | * @param bool $discard |
||
| 927 | * |
||
| 928 | * @return \Acquia\Cloud\Api\Response\Task |
||
| 929 | * |
||
| 930 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 931 | * |
||
| 932 | * @see http://cloudapi.acquia.com/#POST__sites__site_envs__env_livedev__action-instance_route |
||
| 933 | */ |
||
| 934 | 6 | public function liveDev($site, $env, $action, $discard = false) |
|
| 945 | |||
| 946 | /** |
||
| 947 | * @param string $site |
||
| 948 | * @param string $env |
||
| 949 | * @param bool $discard |
||
| 950 | * |
||
| 951 | * @return \Acquia\Cloud\Api\Response\Task |
||
| 952 | * |
||
| 953 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 954 | */ |
||
| 955 | 3 | public function enableLiveDev($site, $env, $discard = false) |
|
| 959 | |||
| 960 | /** |
||
| 961 | * @param string $site |
||
| 962 | * @param string $env |
||
| 963 | * @param bool $discard |
||
| 964 | * |
||
| 965 | * @return \Acquia\Cloud\Api\Response\Task |
||
| 966 | * |
||
| 967 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 968 | */ |
||
| 969 | 3 | public function disableLiveDev($site, $env, $discard = false) |
|
| 973 | |||
| 974 | /** |
||
| 975 | * Deploy code from on environment to another. |
||
| 976 | * |
||
| 977 | * @param string $site |
||
| 978 | * @param string $sourceEnv |
||
| 979 | * @param string $targetEnv |
||
| 980 | * |
||
| 981 | * @return \Acquia\Cloud\Api\Response\Task |
||
| 982 | * |
||
| 983 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 984 | * |
||
| 985 | * @see http://cloudapi.acquia.com/#POST__sites__site_code_deploy__source__target-instance_route |
||
| 986 | */ |
||
| 987 | 6 | public function deployCode($site, $sourceEnv, $targetEnv) |
|
| 997 | |||
| 998 | /** |
||
| 999 | * Deploy a tag or branch to an environment. |
||
| 1000 | * |
||
| 1001 | * @param string $site |
||
| 1002 | * @param string $env |
||
| 1003 | * @param string $vcsPath |
||
| 1004 | * |
||
| 1005 | * @return \Acquia\Cloud\Api\Response\Task |
||
| 1006 | * |
||
| 1007 | * @throws \Guzzle\Http\Exception\ClientErrorResponseException |
||
| 1008 | * |
||
| 1009 | * @see http://cloudapi.acquia.com/#POST__sites__site_envs__env_code_deploy-instance_route |
||
| 1010 | */ |
||
| 1011 | 3 | public function pushCode($site, $env, $vcsPath) |
|
| 1021 | |||
| 1022 | /** |
||
| 1023 | * @deprecated since version 0.5.0 |
||
| 1024 | */ |
||
| 1025 | 3 | public function taskInfo($site, $taskId) |
|
| 1026 | { |
||
| 1027 | 3 | return $this->task($site, $taskId); |
|
| 1028 | } |
||
| 1029 | |||
| 1030 | /** |
||
| 1031 | * @deprecated since version 0.5.0 |
||
| 1032 | */ |
||
| 1033 | 3 | public function siteDatabases($site) |
|
| 1037 | |||
| 1038 | /** |
||
| 1039 | * @deprecated since version 0.5.0 |
||
| 1040 | */ |
||
| 1041 | 3 | public function siteDatabase($site, $db) |
|
| 1045 | |||
| 1046 | /** |
||
| 1047 | * @deprecated since version 0.5.0 |
||
| 1048 | */ |
||
| 1049 | 3 | public function codeDeploy($site, $source, $target) |
|
| 1053 | } |
||
| 1054 |
This method has been deprecated.