Example #1
0
 public function testDescribeEventsIterator()
 {
     $maxRecords = 25;
     $events = $this->redshift->getIterator('DescribeEvents', array('StartTime' => strtotime('-13 days'), 'EndTime' => strtotime('now'), 'MaxRecords' => $maxRecords));
     $total = iterator_count($events);
     $expected = ceil($total / $maxRecords);
     $this->assertEquals($expected ?: 1, $events->getRequestCount());
 }
Example #2
0
 public function testFactoryInitializesClient()
 {
     $client = RedshiftClient::factory(array('key' => 'foo', 'secret' => 'bar', 'region' => 'us-east-1'));
     $this->assertEquals('https://redshift.us-east-1.amazonaws.com', $client->getBaseUrl());
     $this->assertInstanceOf('Aws\\Common\\Signature\\SignatureV4', $this->readAttribute($client, 'signature'));
     $this->assertInstanceOf('Aws\\Common\\Credentials\\Credentials', $client->getCredentials());
 }
 public function exampleTestBasicClusterOperations()
 {
     $clusterId = 'php-integ-redshift-cluster-' . time();
     $snapshotId = 'php-integ-redshift-snapshot-' . time();
     self::log('Launch a cluster.');
     $this->redshift->getCommand('CreateCluster', array('ClusterIdentifier' => $clusterId, 'ClusterType' => 'multi-node', 'MasterUsername' => 'phpinteguser', 'MasterUserPassword' => 'PHPint3gu$er', 'NodeType' => 'dw.hs1.xlarge', 'NumberOfNodes' => 2))->execute();
     self::log('Get a list of all of the clusters and make sure there is at least one.');
     $clusters = $this->redshift->getIterator('DescribeClusters');
     $this->assertGreaterThanOrEqual(1, iterator_count($clusters));
     self::log('Make sure the new cluster exists.');
     $result = $this->redshift->getCommand('DescribeClusters', array('ClusterIdentifier' => $clusterId))->getResult();
     $this->assertCount(1, $result->get('Clusters'));
     self::log('Wait until the cluster exists. This can take around 20 minutes.');
     $this->redshift->waitUntilClusterAvailable(array('ClusterIdentifier' => $clusterId));
     self::log('Create a snapshot of the cluster and wait until it is available.');
     $this->redshift->getCommand('CreateClusterSnapshot', array('ClusterIdentifier' => $clusterId, 'SnapshotIdentifier' => $snapshotId))->execute();
     $this->redshift->waitUntilSnapshotAvailable(array('SnapshotIdentifier' => $snapshotId));
     self::log('Delete the snapshot.');
     $this->redshift->getCommand('DeleteClusterSnapshot', array('SnapshotIdentifier' => $snapshotId))->execute();
     self::log('Delete the cluster.');
     $this->redshift->getCommand('DeleteCluster', array('ClusterIdentifier' => $clusterId, 'SkipFinalClusterSnapshot' => true))->execute();
     self::log('Wait until the cluster is deleted.');
     $this->redshift->waitUntilClusterDeleted(array('ClusterIdentifier' => $clusterId));
 }