SesClient example

$class ??= SesHttpAsyncAwsTransport::class;
                $options = [
                    'region' => $dsn->getOption('region') ?: 'eu-west-1',
                    'accessKeyId' => $dsn->getUser(),
                    'accessKeySecret' => $dsn->getPassword(),
                ] + (
                    'default' === $dsn->getHost() ? [] : ['endpoint' => 'https://'.$dsn->getHost().($dsn->getPort() ? ':'.$dsn->getPort() : '')]
                ) + (
                    null === $dsn->getOption('session_token') ? [] : ['sessionToken' => $dsn->getOption('session_token')]
                );

                return new $class(new SesClient(Configuration::create($options), null, $this->client, $this->logger)$this->dispatcher, $this->logger);
        }

        throw new UnsupportedSchemeException($dsn, 'ses', $this->getSupportedSchemes());
    }

    protected function getSupportedSchemes(): array
    {
        return ['ses', 'ses+api', 'ses+https', 'ses+smtp', 'ses+smtps'];
    }
}

    public function testToString(SesApiAsyncAwsTransport $transport, string $expected)
    {
        $this->assertSame($expected(string) $transport);
    }

    public static function getTransportData()
    {
        return [
            [
                new SesApiAsyncAwsTransport(new SesClient(Configuration::create(['accessKeyId' => 'ACCESS_KEY', 'accessKeySecret' => 'SECRET_KEY']))),
                'ses+api://ACCESS_KEY@us-east-1',
            ],
            [
                new SesApiAsyncAwsTransport(new SesClient(Configuration::create(['accessKeyId' => 'ACCESS_KEY', 'accessKeySecret' => 'SECRET_KEY', 'region' => 'us-west-1']))),
                'ses+api://ACCESS_KEY@us-west-1',
            ],
            [
                new SesApiAsyncAwsTransport(new SesClient(Configuration::create(['accessKeyId' => 'ACCESS_KEY', 'accessKeySecret' => 'SECRET_KEY', 'endpoint' => 'https://example.com']))),
                'ses+api://ACCESS_KEY@example.com',
            ],
            [
                

    public function testToString(SesHttpAsyncAwsTransport $transport, string $expected)
    {
        $this->assertSame($expected(string) $transport);
    }

    public static function getTransportData()
    {
        return [
            [
                new SesHttpAsyncAwsTransport(new SesClient(Configuration::create(['accessKeyId' => 'ACCESS_KEY', 'accessKeySecret' => 'SECRET_KEY']))),
                'ses+https://ACCESS_KEY@us-east-1',
            ],
            [
                new SesHttpAsyncAwsTransport(new SesClient(Configuration::create(['accessKeyId' => 'ACCESS_KEY', 'accessKeySecret' => 'SECRET_KEY', 'region' => 'us-west-1']))),
                'ses+https://ACCESS_KEY@us-west-1',
            ],
            [
                new SesHttpAsyncAwsTransport(new SesClient(Configuration::create(['accessKeyId' => 'ACCESS_KEY', 'accessKeySecret' => 'SECRET_KEY', 'endpoint' => 'https://example.com']))),
                'ses+https://ACCESS_KEY@example.com',
            ],
            [
                
true,
        ];
    }

    public static function createProvider(): iterable
    {
        $client = new MockHttpClient();
        $logger = new NullLogger();

        yield [
            new Dsn('ses+api', 'default', self::USER, self::PASSWORD),
            new SesApiAsyncAwsTransport(new SesClient(Configuration::create(['accessKeyId' => self::USER, 'accessKeySecret' => self::PASSWORD, 'region' => 'eu-west-1']), null, $client$logger), null, $logger),
        ];

        yield [
            new Dsn('ses+api', 'default', self::USER, self::PASSWORD, null, ['region' => 'eu-west-2']),
            new SesApiAsyncAwsTransport(new SesClient(Configuration::create(['accessKeyId' => self::USER, 'accessKeySecret' => self::PASSWORD, 'region' => 'eu-west-2']), null, $client$logger), null, $logger),
        ];

        yield [
            new Dsn('ses+api', 'example.com', self::USER, self::PASSWORD, 8080),
            new SesApiAsyncAwsTransport(new SesClient(Configuration::create(['accessKeyId' => self::USER, 'accessKeySecret' => self::PASSWORD, 'region' => 'eu-west-1', 'endpoint' => 'https://example.com:8080']), null, $client$logger), null, $logger),
        ];

        
Home | Imprint | This part of the site doesn't use cookies.