Scalr\Service\Aws::getCloudLocations PHP Method

getCloudLocations() public static method

Gets defined AWS cloud locations
public static getCloudLocations ( ) : array
return array
    public static function getCloudLocations()
    {
        return [self::REGION_AP_NORTHEAST_1, self::REGION_AP_NORTHEAST_2, self::REGION_AP_SOUTHEAST_1, self::REGION_AP_SOUTHEAST_2, self::REGION_EU_WEST_1, self::REGION_EU_CENTRAL_1, self::REGION_SA_EAST_1, self::REGION_US_EAST_1, self::REGION_US_WEST_1, self::REGION_US_WEST_2, self::REGION_US_GOV_WEST_1, self::REGION_CN_NORTH_1];
    }

Usage Example

Beispiel #1
0
 /**
  * {@inheritdoc}
  * @see \Scalr\System\Zmq\Cron\TaskInterface::enqueue()
  */
 public function enqueue()
 {
     $queue = new ArrayObject([]);
     if (!\Scalr::getContainer()->analytics->enabled) {
         $this->log("INFO", "Terminating the process as Cost analytics is disabled in the config.");
         exit;
     }
     if (SettingEntity::getValue(SettingEntity::ID_FORBID_AUTOMATIC_UPDATE_AWS_PRICES)) {
         $this->log("INFO", "Terminating the process because of overriding AWS prices has been forbidden by financial admin.");
         exit;
     }
     $now = new DateTime('now', new DateTimeZone('UTC'));
     $urls = array('https://a0.awsstatic.com/pricing/1/ec2/linux-od.min.js', 'https://a0.awsstatic.com/pricing/1/ec2/mswin-od.min.js', 'https://a0.awsstatic.com/pricing/1/ec2/previous-generation/linux-od.min.js', 'https://a0.awsstatic.com/pricing/1/ec2/previous-generation/mswin-od.min.js');
     $availableLocations = Aws::getCloudLocations();
     foreach ($urls as $link) {
         $json = trim(preg_replace('/^.+?callback\\((.+?)\\);\\s*$/sU', '\\1', $this->getPricingContent($link)));
         $data = json_decode(preg_replace('/(\\w+):/', '"\\1":', $json));
         if (!empty($data->config->regions)) {
             foreach ($data->config->regions as $rd) {
                 $rd->url = basename($link);
                 $queue->append($rd);
             }
         }
     }
     return $queue;
 }
All Usage Examples Of Scalr\Service\Aws::getCloudLocations