Inheritance: extends Aws\Common\Client\AbstractClient
Ejemplo n.º 1
0
 /**
  * @param string $hostedZoneId
  * @param string $hostedZoneDomain
  * @param string $profileCredentials
  * @param string $region
  * @throws Exception
  */
 public function __construct($hostedZoneId, $hostedZoneDomain, $profileCredentials, $region = 'us-east-1')
 {
     $this->hostedZoneId = $hostedZoneId;
     $this->domain = $hostedZoneDomain;
     try {
         $this->client = Route53Client::factory(array('profile' => $profileCredentials, 'region' => $region, 'version' => '2013-04-01'));
     } catch (Exception $e) {
         throw new Exception('AWS Client connection failed.');
     }
 }
Ejemplo n.º 2
0
 function select_account($id_name_server)
 {
     log_write("debug", "cloud_route53", "Executing select_account(" . $id_name_server . ")");
     $this->changelog->id_server = $id_name_server;
     $this->obj_name_server = new name_server();
     $this->obj_name_server->id = $id_name_server;
     $this->obj_name_server->load_data();
     $key = unserialize($this->obj_name_server->data["api_auth_key"]);
     $this->obj_route53 = Route53Client::factory(array('key' => $key["route53_access_key"], 'secret' => $key["route53_secret_key"]));
     return 1;
 }
Ejemplo n.º 3
0
 /**
  * @covers Aws\Route53\Route53Client::getServerTime
  */
 public function testGetServerTimeReturnsTimeForBoth200And400Responses()
 {
     $client = Route53Client::factory(array('key' => 'foo', 'secret' => 'bar'));
     $this->setMockResponse($client, array('route53/server_time_1', 'route53/server_time_2'));
     $time = $client->getServerTime();
     $this->assertInstanceOf('DateTime', $time);
     $this->assertEquals('11-19-2009', $time->format('m-d-Y'));
     $time = $client->getServerTime();
     $this->assertInstanceOf('DateTime', $time);
     $this->assertEquals('11-20-2009', $time->format('m-d-Y'));
 }
Ejemplo n.º 4
0
 public function testCanInstantiateRegionlessClientsWithoutParameters()
 {
     $config = array('key' => 'foo', 'secret' => 'bar');
     try {
         // Instantiate all of the clients that do not require a region
         \Aws\S3\S3Client::factory($config);
         \Aws\CloudFront\CloudFrontClient::factory($config);
         \Aws\Route53\Route53Client::factory($config);
         \Aws\Sts\StsClient::factory($config);
     } catch (\InvalidArgumentException $e) {
         $this->fail('All of the above clients should have been instantiated without errors: ' . $e->getMessage());
     }
 }
Ejemplo n.º 5
0
 public function testHealthCheckOperations()
 {
     self::log('Create a health check.');
     $result = $this->route53->getCommand('CreateHealthCheck', array('CallerReference' => uniqid('aws-sdk-php-hc-'), 'HealthCheckConfig' => array('IPAddress' => gethostbyname('aws.amazon.com'), 'Port' => '80', 'Type' => HealthCheckType::TCP)))->getResult();
     $healthCheckId = $result->getPath('HealthCheck/Id');
     self::log('List the health checks.');
     $result = $this->route53->getCommand('ListHealthChecks')->getResult();
     $this->assertCount(1, $result->get('HealthChecks'));
     $this->assertContains($healthCheckId, $result->getPath('HealthChecks/*/Id'));
     self::log('Delete the health checks.');
     foreach ($this->route53->getIterator('ListHealthChecks') as $healthCheck) {
         $this->route53->getCommand('DeleteHealthCheck', array('HealthCheckId' => $healthCheck['Id']))->execute();
     }
     $result = $this->route53->getCommand('ListHealthChecks')->getResult();
     $this->assertCount(0, $result->get('HealthChecks'));
 }
Ejemplo n.º 6
0
<?php

session_start();
// if(!empty($_SESSION['user'])){
require 'vendor/autoload.php';
use Aws\Route53\Route53Client;
require_once '/connectivity/aws_keys.php';
$keys = aws_keys();
$access_key = $keys['access_key'];
$secret_key = $keys['secret_key'];
$client = Route53Client::factory(array('version' => 'latest', 'region' => "us-east-1", 'credentials' => array('key' => $access_key, 'secret' => $secret_key)));
//$result = $client->getHostedZoneCount(array());
$result = $client->getHostedZone(['Id' => $_POST['zone_id']]);
if (!empty($result)) {
    $result = $result->toArray();
    $_SESSION['hosted_zone'] = array("ns" => $result['DelegationSet']['NameServers'], "id" => $result['HostedZone']['Id'], "name" => $result['HostedZone']['Name'], "Config" => $result['HostedZone']['Config'], "rrc" => $result['HostedZone']['ResourceRecordSetCount'], "status" => true);
} else {
    $_SESSION['hosted_zone'] = array("ns" => array(), "status" => false);
}
header("Location: /aws_r53/home.php");
// }