From 94cb90716a91c175fca8a7dadba6edf89e8dbd81 Mon Sep 17 00:00:00 2001 From: Mouddene Date: Mon, 25 Jan 2016 21:03:23 +0100 Subject: [PATCH] Documentation update, Adding AWS Route53 support --- AmazonWebServicesFactory.php | 1 + Resources/config/aws_config.xml | 4 ++ Resources/doc/README.md | 66 ++++++++++++---------- Tests/Controller/DefaultControllerTest.php | 17 ------ Tests/Services/SESMailingServiceTest.php | 49 ++++++---------- Tests/Services/StorageServiceTest.php | 14 ++--- 6 files changed, 64 insertions(+), 87 deletions(-) delete mode 100644 Tests/Controller/DefaultControllerTest.php diff --git a/AmazonWebServicesFactory.php b/AmazonWebServicesFactory.php index ecda7d0..9b6d601 100644 --- a/AmazonWebServicesFactory.php +++ b/AmazonWebServicesFactory.php @@ -47,6 +47,7 @@ class AmazonWebServicesFactory { 'SQS', 'STS', 'SWF', + 'Route53', ); /** diff --git a/Resources/config/aws_config.xml b/Resources/config/aws_config.xml index 1096c79..d947fec 100644 --- a/Resources/config/aws_config.xml +++ b/Resources/config/aws_config.xml @@ -119,5 +119,9 @@ SWF + + + Route53 + diff --git a/Resources/doc/README.md b/Resources/doc/README.md index d0b6f1c..61d9b7e 100644 --- a/Resources/doc/README.md +++ b/Resources/doc/README.md @@ -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: @@ -48,7 +40,7 @@ public function registerBundles() { return array( // ... - new Cybernox\AmazonWebServicesBundle\CybernoxAmazonWebServicesBundle(), + new AmazonWebServicesBundle\ThePhalconsAmazonWebServicesBundle(), // ... ); } @@ -56,7 +48,7 @@ public function registerBundles() 3) **_If you are using Composer (1b), you may skip this step_** -Register the Cybernox namespace: +Register the ThePhalcons namespace: ```php registerNamespaces(array( // ... - 'Cybernox' => __DIR__.'/../vendor/bundles', + 'ThePhalcons' => __DIR__.'/../vendor/bundles', // ... )); ``` @@ -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.** @@ -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: + 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.** @@ -290,4 +289,9 @@ _Please note, at this time, thorough testing has not been completed. Because thi AmazonSWF Amazon Simple Workflow + + aws_Route53 + AmazonRoute53 + Amazon Route 53 + diff --git a/Tests/Controller/DefaultControllerTest.php b/Tests/Controller/DefaultControllerTest.php deleted file mode 100644 index 7fb5d50..0000000 --- a/Tests/Controller/DefaultControllerTest.php +++ /dev/null @@ -1,17 +0,0 @@ -request('GET', '/hello/Fabien'); - - $this->assertTrue($crawler->filter('html:contains("Hello Fabien")')->count() > 0); - } -} diff --git a/Tests/Services/SESMailingServiceTest.php b/Tests/Services/SESMailingServiceTest.php index 589f7be..ad11231 100644 --- a/Tests/Services/SESMailingServiceTest.php +++ b/Tests/Services/SESMailingServiceTest.php @@ -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'); } /** @@ -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('mouddene@gmail.com') - ->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('mouddene@gmail.com') +// ->setMessage('UNIT TEST is working'); +// $result = $mailer->sendEmail(); +// +// var_dump($result); +// assert(true === true, "todo"); +// } +// +} diff --git a/Tests/Services/StorageServiceTest.php b/Tests/Services/StorageServiceTest.php index f89ab47..effd6b8 100644 --- a/Tests/Services/StorageServiceTest.php +++ b/Tests/Services/StorageServiceTest.php @@ -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 !!!") } }