public function testListsDomains() { self::log('Listing domains'); $found = false; foreach ($this->client->getIterator('DescribeDomains') as $domain) { if ($domain['DomainName'] == self::DOMAIN) { $found = true; break; } } if (!$found) { $this->fail('Did not find the domain ' . self::DOMAIN); } }
/** * @covers Aws\CloudSearch\CloudSearchClient::factory */ public function testFactoryInitializesClient() { $client = CloudSearchClient::factory(array('key' => 'foo', 'secret' => 'bar', 'region' => 'us-east-1')); $this->assertInstanceOf('Aws\\Common\\Signature\\SignatureV4', $this->readAttribute($client, 'signature')); $this->assertInstanceOf('Aws\\Common\\Credentials\\Credentials', $client->getCredentials()); $this->assertEquals('https://cloudsearch.us-east-1.amazonaws.com', $client->getBaseUrl()); }
protected function _factoryClient() { if ($this->_client !== null) { return $this->_client; } $client = false; try { $client = CloudSearchClient::factory(['key' => $this->config['key'], 'secret' => $this->config['secret'], 'region' => $this->config['region']]); } catch (Exception $e) { throw new MissingConnectionException(['class' => get_class($this), 'message' => $e->getMessage()]); } $this->_client = $client; return $client; }
<?php require 'vendor/autoload.php'; require '_aws/config.php'; /* * Elastic Search Dummy Test Code */ $elasticClient = \Elasticsearch\ClientBuilder::create()->build(); $params = ['index' => 'my_index', 'type' => 'my_type', 'id' => 'my_id']; $response = $elasticClient->get($params); /** * Amazon Cloud Search Dummy Test Code */ try { $cloudClient = \Aws\CloudSearch\CloudSearchClient::factory(array("version" => \Aws\CloudSearch\Config::VERSION, "region" => \Aws\CloudSearch\Config::REGION, 'credentials' => array('key' => \Aws\CloudSearch\Config::KEY, 'secret' => \Aws\CloudSearch\Config::SECRET))); $indexFields = $cloudClient->describeIndexFields(array('DomainName' => \Aws\CloudSearch\Config::DOMAIN_NAME)); } catch (Exception $e) { echo $e->getMessage(); } ?> Elastic Search Dump <pre> <?php print_r($response); ?> </pre> Amazon Cloud Search Dump <pre> <?php