Skip to content

Commit

Permalink
Merge pull request #48 from ThePhalcons/2.2.0
Browse files Browse the repository at this point in the history
Documentation update, Adding AWS Route53 support
  • Loading branch information
CodeIsLife authored and CodeIsLife committed Jan 25, 2016
2 parents 7edb7f7 + 94cb907 commit 809fd68
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 87 deletions.
1 change: 1 addition & 0 deletions AmazonWebServicesFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class AmazonWebServicesFactory {
'SQS',
'STS',
'SWF',
'Route53',
);

/**
Expand Down
4 changes: 4 additions & 0 deletions Resources/config/aws_config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,9 @@
<service id="aws_swf" class="AmazonSWF" parent="aws_service">
<argument>SWF</argument>
</service>

<service id="aws_route53" class="AmazonRoute53" parent="aws_service">
<argument>Route53</argument>
</service>
</services>
</container>
66 changes: 35 additions & 31 deletions Resources/doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,20 @@ Once objects have been created, you have full access to the SDK. Please see the

AmazonWebServicesBundle may be installed via the deps file (Symfony 2.0.x) or via Composer (2.1+)

1a) Via deps file

Add the AWS SDK for PHP library and the Amazon Web Services Bundle to your project's deps file:

```bash
[aws-sdk-for-php]
git=http://github.com/amazonwebservices/aws-sdk-for-php.git
target=/amazonwebservices/aws-sdk-for-php

[AmazonWebServicesBundle]
git=http://github.com/Cybernox/AmazonWebServicesBundle.git
target=/bundles/Cybernox/AmazonWebServicesBundle
```

1b) Via Composer
1) Via Composer

Go to the ```require``` section of your composer.json file and add

```json
"cybernox/amazon-webservices-bundle": ">=1.5.4"
"thephalcons/amazon-webservices-bundle": ">=2.1"
```

OR using command line

```
composer require thephalcons/amazon-webservices-bundle
```
to the section, along with other packages you require. Now run ```composer.phar install``` if this is a new installation, or ```composer.phar update``` if you are updating an existing installation.

2) Add AmazonWebServicesBundle to your application kernel:
Expand All @@ -48,23 +40,23 @@ public function registerBundles()
{
return array(
// ...
new Cybernox\AmazonWebServicesBundle\CybernoxAmazonWebServicesBundle(),
new AmazonWebServicesBundle\ThePhalconsAmazonWebServicesBundle(),
// ...
);
}
```

3) **_If you are using Composer (1b), you may skip this step_**

Register the Cybernox namespace:
Register the ThePhalcons namespace:

```php
<?php

// app/autoload.php
$loader->registerNamespaces(array(
// ...
'Cybernox' => __DIR__.'/../vendor/bundles',
'ThePhalcons' => __DIR__.'/../vendor/bundles',
// ...
));
```
Expand All @@ -89,6 +81,8 @@ $loader->registerNamespaces(array(
aws_mfa_serial = YOUR_MFA_SERIAL
aws_cloudfront_keypair = YOUR_CLOUDFRONT_KEYPAIR_ID
aws_cloudfront_pem = YOUR_CLOUDFRONT_PRIVATE_KEY_PEM
aws_region = YOUR_REGION
aws_version = 'latest' #or YOUR_VERSION
```

**Note, presently only aws_key and aws_secret are being used when constructing objects. Setting them is fine, but it won't do anything.**
Expand All @@ -106,19 +100,24 @@ $loader->registerNamespaces(array(
```yml
// app/config/config.yml
# Amazon Web Services Configuration
cybernox_amazon_web_services:
key: %aws_key%
secret: %aws_secret%
account_id: %aws_account_id%
canonical_id: %aws_canonical_id%
canonical_name: %aws_canonical_name%
mfa_serial: %aws_mfa_serial%
cloudfront_keypair: %aws_cloudfront_keypair%
cloudfront_pem: %aws_cloudfront_pem%
default_cache_config: apc
enable_extensions: []
certificate_authority: false
disable_auto_config: false
thephalcons_amazon_web_services:
# for stream wrapper use : [S3, SES ...]
enable_extensions: []
credentials:
key: <YOUR APP KEY>
secret: <YOUT APP SECRET>
shared_config:
region: %aws_region%
version: %aws_version%
account_id: %aws_account_id%
canonical_id: %aws_canonical_id%
canonical_name: %aws_canonical_name%
mfa_serial: %aws_mfa_serial%
cloudfront_keypair: %aws_cloudfront_keypair%
cloudfront_pem: %aws_cloudfront_pem%
default_cache_config: null
certificate_authority: false
disable_auto_config: false
```
**Note, as in 5a) above, only the key and secret are presently being used, so it is safe to omit the rest if you wish.**
Expand Down Expand Up @@ -290,4 +289,9 @@ _Please note, at this time, thorough testing has not been completed. Because thi
<td><a href="http://docs.amazonwebservices.com/AWSSDKforPHP/latest/#i=AmazonSWF">AmazonSWF</a></td>
<td>Amazon Simple Workflow</td>
</tr>
<tr>
<td>aws_Route53</td>
<td><a href="http://http://docs.aws.amazon.com/aws-sdk-php/v2/guide/service-route53.html">AmazonRoute53</a></td>
<td>Amazon Route 53</td>
</tr>
</table>
17 changes: 0 additions & 17 deletions Tests/Controller/DefaultControllerTest.php

This file was deleted.

49 changes: 18 additions & 31 deletions Tests/Services/SESMailingServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function testSESInjection()
{
$client = $this->createClient();
$ses = $client->getContainer()->get('amazon_SES');
assert( $ses !== null, 'SES is not defined');
assert($ses !== null, 'SES is not defined');
}

/**
Expand All @@ -30,35 +30,22 @@ public function testMailingServiceInjection()
{
$client = $this->createClient();
$mailer = $client->getContainer()->get('ws.service.mailing');
assert( $mailer !== null, 'Mailing Service injection is not working');
assert( $mailer instanceof MailingService, 'given Object is not an instance of MailingService');
assert($mailer !== null, 'Mailing Service injection is not working');
assert($mailer instanceof MailingService, 'given Object is not an instance of MailingService');
}

public function testSendMail()
{
$client = $this->createClient();
/**@var $mailer MailingService */
$mailer = $client->getContainer()->get('ws.service.mailing');
$mailer->setSubject('Drivy UNIT TEST')
->addToAddress('[email protected]')
->setMessage('UNIT TEST is working');
$result = $mailer->sendEmail();

var_dump($result);
assert(true === true, "todo");
}

public function testListVerifiedEmailsAddresses()
{
$client = $this->createClient();
/**@var $ses SesClient */

$ses = $client->getContainer()->get('amazon_SES');

$list = $ses->listVerifiedEmailAddresses(array());

// TODO :
assert(true == true, 'source email is not verified');


}
// public function testSendMail()
// {
// $client = $this->createClient();
// /**@var $mailer MailingService */
// $mailer = $client->getContainer()->get('ws.service.mailing');
// $mailer->setSubject('Drivy UNIT TEST')
// ->addToAddress('[email protected]')
// ->setMessage('UNIT TEST is working');
// $result = $mailer->sendEmail();
//
// var_dump($result);
// assert(true === true, "todo");
// }
//
}
14 changes: 6 additions & 8 deletions Tests/Services/StorageServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,24 @@ public function testServiceInjection(){
assert( $s3 !== null, 'Requested service unavailble');
}

public function testDoesContainerHasUploadBucketParameter(){
$client = $this->createClient();
assert($client->getContainer()->hasParameter('the_phalcons_amazon_web_services.services.S3.bucket') === true, "Container hasn't the_phalcons_amazon_web_services.services.S3.bucket parameter");
}

public function testCreateBucket(){
/** @var S3Client $client */
$client = $this->createClient();
$client->createBucket(array(
$s3 = $client->getContainer()->get('amazon_S3');

$s3->createBucket(array(
'Bucket' => 'mybucket',
'LocationConstraint' => 'us-west-2',
));

assert($client->doesBucketExist("mybucket") === true, "bucket doesn't exist !!!")
$client->deleteBucket(array(
assert($s3->doesBucketExist("mybucket") === true, "bucket doesn't exist !!!")
$s3->deleteBucket(array(
'Bucket' => 'mybucket',
'LocationConstraint' => 'us-west-2',
));

assert($client->doesBucketExist("mybucket") === false, "bucket hasn't been deleted !!!")
assert($s3->doesBucketExist("mybucket") === false, "bucket hasn't been deleted !!!")
}

}

0 comments on commit 809fd68

Please sign in to comment.