setConfig($config) ->setConfigDefaults(array( Options::VERSION => self::LATEST_API_VERSION, Options::SERVICE_DESCRIPTION => __DIR__ . '/Resources/route53-%s.php' )) ->build(); } /** * Retrieves the server time from Route53. Can be useful for detecting and/or preventing clock skew. * * @return \DateTime The server time from Route53 * @link http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/RESTAuthentication.html#FetchingDate */ public function getServerTime() { try { $response = $this->get('https://route53.amazonaws.com/date')->send(); } catch (ServiceResponseException $e) { $response = $e->getResponse(); } $serverTime = trim($response->getHeader('Date', true)); $serverTime = \DateTime::createFromFormat(DateFormat::RFC1123, $serverTime); return $serverTime; } /** * Filter function used to remove ID prefixes. This is used automatically by the client so that Hosted Zone and * Change Record IDs can be specified with or without the prefix. * * @param string $id The ID value to clean * * @return string */ public static function cleanId($id) { return str_replace(array('/hostedzone/', '/change/', '/delegationset/'), '', $id); } }