AmazonSesClientFactory.php in Amazon SES 2.0.x
File
src/AmazonSesClientFactory.php
View source
<?php
namespace Drupal\amazon_ses;
use Drupal\Core\Config\ConfigFactory;
use Aws\Ses\SesClient;
class AmazonSesClientFactory {
public static function createInstance(array $options, ConfigFactory $configFactory) {
$settings = $configFactory
->get('aws_secrets_manager.settings');
$options['region'] = $settings
->get('aws_region');
$awsKey = $settings
->get('aws_key');
$awsSecret = $settings
->get('aws_secret');
if (!empty($awsKey) && !empty($awsSecret)) {
$options['credentials'] = [
'key' => $awsKey,
'secret' => $awsSecret,
];
}
return new SesClient($options);
}
}