public function testFactoryInitializesClient() { $client = KinesisClient::factory(array('key' => 'foo', 'secret' => 'bar', 'region' => 'us-east-1')); $this->assertInstanceOf('Aws\\Common\\Signature\\SignatureV4', $client->getSignature()); $this->assertInstanceOf('Aws\\Common\\Credentials\\Credentials', $client->getCredentials()); $this->assertEquals('https://kinesis.us-east-1.amazonaws.com', $client->getBaseUrl()); }
public function testTheGetShardIteratorOperationWorksViaMagicCall() { $client = KinesisClient::factory(array('key' => 'foo', 'secret' => 'bar', 'region' => 'us-east-1')); $client->addSubscriber(new MockPlugin(array(new Response(200, null, '{"ShardIterator":"foobar"}')))); $result = $client->getShardIterator(array('StreamName' => 'test', 'ShardId' => 'test', 'ShardIteratorType' => 'AT_SEQUENCE_NUMBER')); $this->assertEquals('foobar', $result['ShardIterator']); }
public function testFactory_001() { $dummy_kinesis = KinesisClient::factory(array('key' => 'XXXXXX', 'secret' => 'XXXXX', 'region' => Region::VIRGINIA)); $proxy1 = KinesisProxy::factory($dummy_kinesis, 'hoge'); $proxy2 = KinesisProxy::factory($dummy_kinesis, 'hoge'); $proxy3 = KinesisProxy::factory($dummy_kinesis, 'foo'); $this->assertTrue(spl_object_hash($proxy1) === spl_object_hash($proxy2)); $this->assertFalse(spl_object_hash($proxy1) === spl_object_hash($proxy3)); }
/** * Event Bus Constructor * @param string $streamName */ public function __construct($streamName = 'Leo') { if (YOUNIQUE_TESTSERVER === true) { if (defined('TEST_AWS_KEY') && defined('TEST_AWS_SECRET')) { $options = ['key' => TEST_AWS_KEY, 'secret' => TEST_AWS_SECRET, 'region' => 'us-west-2']; } else { return; } } else { $options = ['region' => 'us-west-2']; } if (!empty($streamName)) { $this->streamName = $streamName; } $this->client = KinesisClient::factory($options); }
<?php require 'vendor/autoload.php'; use Aws\Kinesis\KinesisClient; $client = KinesisClient::factory(array('region' => 'us-east-1')); $result = $client->putRecord(array('StreamName' => 'torqueData', 'Data' => json_encode($_GET), 'PartitionKey' => $_GET['session'])); require_once 'creds.php'; require_once 'auth_app.php'; // Create an array of all the existing fields in the database $result = $mysqli->query("SHOW COLUMNS FROM {$db_table}") or die("ERROR: {$mysqli->error}"); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $dbfields[] = $row['Field']; } } $result->close(); // Iterate over all the k* _GET arguments to check that a field exists if (sizeof($_GET) > 0) { $keys = array(); $values = array(); foreach ($_GET as $key => $value) { // Keep columns starting with k if (preg_match('/^k/', $key)) { $keys[] = $key; $values[] = $value; $submitval = 1; } elseif (in_array($key, array('v', 'eml', 'time', 'id', 'session', 'profile'))) { //else if (in_array($key, array("v", "eml", "time", "id", "session"))) { $keys[] = $key; $values[] = "'" . $value . "'"; $submitval = 1;
<?php require '../vendor/autoload.php'; use Aws\Kinesis\KinesisClient; use Aws\Common\Enum\Region; use Rf\Aws\Kinesis\ClientLibrary\KinesisProxy; define('STREAM_NAME', 'kinesis-trial'); $kinesis = KinesisClient::factory(array('key' => 'XXXXX', 'secret' => 'XXXXX', 'region' => Region::VIRGINIA)); $kinesis_proxy = KinesisProxy::factory($kinesis, STREAM_NAME); while (true) { $sample_data = date('YmdHis'); $kinesis_proxy->putRecord($sample_data, mt_rand(1, 1000000)); echo $sample_data, PHP_EOL; sleep(1); }