Loading src/AwsClientFactory.php +7 −3 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ declare(strict_types=1); namespace Drupal\aws; use Drupal\aws\Entity\ProfileInterface; use Drupal\aws\Exception\ProfileException; use Drupal\aws\Traits\AwsServiceTrait; /** Loading Loading @@ -36,15 +37,18 @@ class AwsClientFactory implements AwsClientFactoryInterface { $service = $this->aws->getService($service_id); if ($this->profile) { $client_args = $this->profile->getClientArgs(); $profile = $this->profile; } else { $profile = $this->aws->getProfile($service_id); $client_args = $profile->getClientArgs(); } if (!$profile) { throw new ProfileException('No AWS profiles have been configured.'); } $class = "\Aws\\{$service['namespace']}\\{$service['namespace']}Client"; return new $class($client_args); return new $class($profile->getClientArgs()); } } src/Exception/ProfileException.php 0 → 100644 +12 −0 Original line number Diff line number Diff line <?php declare(strict_types=1); namespace Drupal\aws\Exception; /** * AWS Profile Exception. */ class ProfileException extends \Exception { } Loading
src/AwsClientFactory.php +7 −3 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ declare(strict_types=1); namespace Drupal\aws; use Drupal\aws\Entity\ProfileInterface; use Drupal\aws\Exception\ProfileException; use Drupal\aws\Traits\AwsServiceTrait; /** Loading Loading @@ -36,15 +37,18 @@ class AwsClientFactory implements AwsClientFactoryInterface { $service = $this->aws->getService($service_id); if ($this->profile) { $client_args = $this->profile->getClientArgs(); $profile = $this->profile; } else { $profile = $this->aws->getProfile($service_id); $client_args = $profile->getClientArgs(); } if (!$profile) { throw new ProfileException('No AWS profiles have been configured.'); } $class = "\Aws\\{$service['namespace']}\\{$service['namespace']}Client"; return new $class($client_args); return new $class($profile->getClientArgs()); } }
src/Exception/ProfileException.php 0 → 100644 +12 −0 Original line number Diff line number Diff line <?php declare(strict_types=1); namespace Drupal\aws\Exception; /** * AWS Profile Exception. */ class ProfileException extends \Exception { }