Skip to content

Commit

Permalink
Merge pull request #5 from typhonius/update-sdk-to-2.0
Browse files Browse the repository at this point in the history
Updates the underlying SDK to the 2.0 branch.
  • Loading branch information
lcatlett authored Jun 23, 2020
2 parents cabf7c5 + 4e96f66 commit 65e0bf3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}
],
"require": {
"typhonius/acquia-php-sdk-v2": "^1.0.4"
"typhonius/acquia-php-sdk-v2": "^2.0.0"
},
"autoload": {
"psr-4": {
Expand Down
14 changes: 10 additions & 4 deletions src/Blt/Plugin/Commands/DrushAliasCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
use Acquia\Hmac\Exception\MalformedResponseException as MalformedResponseExceptionAlias;
use AcquiaCloudApi\CloudApi\Client;
use AcquiaCloudApi\CloudApi\Connector;
use AcquiaCloudApi\Endpoints\Account;
use AcquiaCloudApi\Endpoints\Applications;
use AcquiaCloudApi\Endpoints\Environments;
use Symfony\Component\Yaml\Yaml;
use Acquia\Blt\Robo\Common\YamlMunge;

Expand Down Expand Up @@ -67,7 +70,8 @@ public function generateAliasesAcquia() {
$cloudApiConfig = $this->loadCloudApiConfig();
$this->setCloudApiClient($cloudApiConfig['key'], $cloudApiConfig['secret']);
$this->say("<info>Gathering site info from Acquia Cloud.</info>");
$site = $this->cloudApiClient->application($this->appId);
$applicationAdapter = new Applications($this->cloudApiClient);
$site = $applicationAdapter->get($this->appId);
$error = FALSE;
try {
$this->getSiteAliases($site);
Expand Down Expand Up @@ -192,7 +196,8 @@ protected function setCloudApiClient($key, $secret) {
]);
$cloud_api = Client::factory($connector);
// We must call some method on the client to test authentication.
$cloud_api->account();
$account = new Account();
$account->get();
$this->cloudApiClient = $cloud_api;
}
catch (MalformedResponseExceptionAlias $e) {
Expand Down Expand Up @@ -229,7 +234,8 @@ protected function getSiteAliases($site) {
$aliases = [];
$sites = [];
$this->output->writeln("<info>Gathering sites list from Acquia Cloud.</info>");
$environments = $this->cloudApiClient->environments($site->uuid);
$environmentAdapter = new Environments($this->cloudApiClient);
$environments = $environmentAdapter->getAll($site->uuid);
$hosting = $site->hosting->type;
$site_split = explode(':', $site->hosting->id);
foreach ($environments as $env) {
Expand Down Expand Up @@ -375,4 +381,4 @@ protected function writeSiteAliases($site_id, array $aliases) {
file_put_contents($filePath, Yaml::dump($aliases));
return $filePath;
}
}
}

0 comments on commit 65e0bf3

Please sign in to comment.