/**
  * @param Guzzle\Service\Builder\ServiceBuilder $awsClient AWS client.
  * @param string $awsRegion AWS region to use for API calls.
  */
 public function __construct(Guzzle\Service\Builder\ServiceBuilder $awsClient, $awsRegion)
 {
     $this->rds = $awsClient->get('rds');
     // The IAM API is only available in us-east-1.
     $this->iam = $awsClient->get('iam', ['region' => 'us-east-1']);
     $this->region = $awsRegion;
 }
 /**
  * set the api key for api key clients
  *
  * @param string $name
  * @param bool   $throwAway
  *
  * @return ClientInterface
  */
 public function get($name, $throwAway = false)
 {
     $client = parent::get($name, $throwAway);
     if ($client instanceof ApiKeyClientInterface) {
         $client->setApiKey(self::$apiKey);
     }
     return $client;
 }
 /**
  * @covers Guzzle\Service\Plugin\PluginCollectionPlugin
  */
 public function testPluginPassPluginsThroughToClients()
 {
     $s = new ServiceBuilder(array('michael.mock' => array('class' => 'Guzzle\\Tests\\Service\\Mock\\MockClient', 'params' => array('base_url' => 'http://www.test.com/', 'subdomain' => 'michael', 'password' => 'test', 'username' => 'michael'))));
     $plugin = $this->getMock('Symfony\\Component\\EventDispatcher\\EventSubscriberInterface');
     $plugin::staticExpects($this->any())->method('getSubscribedEvents')->will($this->returnValue(array('client.create_request' => 'onRequestCreate')));
     $s->addSubscriber(new PluginCollectionPlugin(array($plugin)));
     $c = $s->get('michael.mock');
     $this->assertTrue($c->getEventDispatcher()->hasListeners('client.create_request'));
     $listeners = $c->getEventDispatcher()->getListeners('client.create_request');
     $this->assertSame($plugin, $listeners[0][0]);
     $this->assertEquals('onRequestCreate', $listeners[0][1]);
 }
 public function __construct(TemplateExpansionService $templateExpansionService, AwsClient $awsClient)
 {
     $this->templateExpansionService = $templateExpansionService;
     $this->cloudFormation = $awsClient->get('CloudFormation');
 }
Beispiel #5
0
 /**
  * @covers Guzzle\Service\Builder\ServiceBuilder
  */
 public function testUsesTheDefaultBuilderWhenNoBuilderIsSpecified()
 {
     $s = new ServiceBuilder(array('michael.mock' => array('class' => 'Guzzle\\Tests\\Service\\Mock\\MockClient', 'params' => array('base_url' => 'http://www.test.com/', 'subdomain' => 'michael', 'password' => 'test', 'username' => 'michael', 'curl.curlopt_proxyport' => 8080))));
     $c = $s->get('michael.mock');
     $this->assertInstanceOf('Guzzle\\Tests\\Service\\Mock\\MockClient', $c);
 }
 public function testGettingAThrowawayClientWithParametersDoesNotAffectGettingOtherClients()
 {
     $b = new ServiceBuilder($this->arrayData);
     $c1 = $b->get('michael.mock', array('username' => 'jeremy'));
     $this->assertEquals('jeremy', $c1->getConfig('username'));
     $c2 = $b->get('michael.mock');
     $this->assertEquals('michael', $c2->getConfig('username'));
 }
 /**
  * @param Guzzle\Service\Builder\ServiceBuilder $awsClient AWS client.
  */
 public function __construct(Guzzle\Service\Builder\ServiceBuilder $awsClient)
 {
     $this->ec2 = $awsClient->get('ec2');
 }
 /**
  * @param AwsClient $awsClient AWS API client
  * @param string $s3BucketName Name of S3 bucket to upload templates to.
  */
 public function __construct(AwsClient $awsClient, $s3BucketName)
 {
     $this->s3 = $awsClient->get('S3');
     $this->s3BucketName = $s3BucketName;
 }
 /**
  * @param Guzzle\Service\Builder\ServiceBuilder $awsClient AWS client.
  */
 public function __construct(Guzzle\Service\Builder\ServiceBuilder $awsClient)
 {
     $this->cloudFormation = $awsClient->get('cloudformation');
 }
 public function testCanGetByAlias()
 {
     $b = new ServiceBuilder($this->arrayData);
     $this->assertSame($b->get('billy.mock'), $b->get('Hello!'));
 }
 public function testAddsGlobalPlugins()
 {
     $b = new ServiceBuilder($this->arrayData);
     $b->addGlobalPlugin(new HistoryPlugin());
     $s = $b->get('michael.mock');
     $this->assertTrue($s->getEventDispatcher()->hasListeners('request.complete'));
 }