Skip to content

Commit

Permalink
Create initial service configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Badolato committed Nov 24, 2011
1 parent 3e4795b commit 0d8cc0d
Show file tree
Hide file tree
Showing 10 changed files with 137 additions and 0 deletions.
9 changes: 9 additions & 0 deletions CybernoxAmazonWebServicesBundle.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace Cybernox\AmazonWebServicesBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class CybernoxAmazonWebServicesBundle extends Bundle
{
}
35 changes: 35 additions & 0 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

namespace Cybernox\AmazonWebServicesBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;

class Configuration implements ConfigurationInterface
{
/**
* {@inheritDoc}
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('cybernox_amazon_web_services');

$rootNode
->children()
->scalarNode('key')->isRequired()->end()
->scalarNode('secret_key')->isRequired()->end()
->scalarNode('account_id')->end()
->scalarNode('canonical_id')->end()
->scalarNode('canonical_name')->end()
->scalarNode('mfa_serial')->end()
->scalarNode('cloudfront_keypair_id')->end()
->scalarNode('cloudfront_private_key_pem')->end()
->scalarNode('default_cache_config')->end()
->booleanNode('enable_extensions')->defaultFalse()->end()
->booleanNode('certificate_authority')->defaultFalse()->end()
->end();

return $treeBuilder;
}
}
28 changes: 28 additions & 0 deletions DependencyInjection/CybernoxAmazonWebServicesExtension.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace Cybernox\AmazonWebServicesBundle\DependencyInjection;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;

class CybernoxAmazonWebServicesExtension extends Extension
{
/**
* {@inheritDoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);

$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.xml');

foreach ($config as $key => $value)
{
$container->setParameter('cybernox_amazon_web_services.' . $key, $value);
}
}
}
15 changes: 15 additions & 0 deletions Resources/config/services.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" ?>

<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

<parameters>
<parameter key="aws_sqs.class">Cybernox\AmazonWebServicesBundle\WebServices\SimpleQueueService</parameter>
</parameters>

<services>
<service id="aws_sqs" class="%aws_sqs.class%">
</service>
</services>
</container>
Empty file added Resources/doc/index.rst
Empty file.
Empty file added Resources/meta/LICENSE
Empty file.
17 changes: 17 additions & 0 deletions Tests/Controller/DefaultControllerTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace Cybernox\AmazonWebServicesBundle\Tests\Controller;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class DefaultControllerTest extends WebTestCase
{
public function testIndex()
{
$client = static::createClient();

$crawler = $client->request('GET', '/hello/Fabien');

$this->assertTrue($crawler->filter('html:contains("Hello Fabien")')->count() > 0);
}
}
11 changes: 11 additions & 0 deletions WebServices/SimpleQueueService.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Cybernox\AmazonWebServicesBundle\WebServices;

use AWS\services\AmazonSQS as WebService;
use AWS\services\SQS_Exception as WebServiceException;

class SimpleQueueService extends WebServices implements WebServicesInterface
{

}
14 changes: 14 additions & 0 deletions WebServices/WebServices.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace Cybernox\AmazonWebServicesBundle\WebServices;

abstract class WebServices
{
private $service = null;

public function __construct()
{
echo "I'm in the WebService";
//$this->service = new WebService();
}
}
8 changes: 8 additions & 0 deletions WebServices/WebServicesInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace Cybernox\AmazonWebServicesBundle\WebServices;

interface WebServicesInterface
{

}

0 comments on commit 0d8cc0d

Please sign in to comment.