Ejemplo n.º 1
0
 public function editAction()
 {
     $platforms = array();
     $governanceEnabledPlatforms = array(SERVER_PLATFORMS::EC2, SERVER_PLATFORMS::CLOUDSTACK, SERVER_PLATFORMS::IDCF, SERVER_PLATFORMS::OPENSTACK, SERVER_PLATFORMS::NEBULA, SERVER_PLATFORMS::MIRANTIS, SERVER_PLATFORMS::VIO, SERVER_PLATFORMS::VERIZON, SERVER_PLATFORMS::CISCO, SERVER_PLATFORMS::HPCLOUD, SERVER_PLATFORMS::OCS, SERVER_PLATFORMS::RACKSPACENG_US, SERVER_PLATFORMS::AZURE);
     //intersection of enabled platforms and supported by governance
     foreach (array_intersect($this->getEnvironment()->getEnabledPlatforms(), $governanceEnabledPlatforms) as $platform) {
         //we only need ec2 locations at the moment
         $platforms[$platform] = $platform == SERVER_PLATFORMS::EC2 ? self::loadController('Platforms')->getCloudLocations($platform, false) : array();
     }
     $chefServers = [];
     foreach (ChefServer::getList($this->user->getAccountId(), $this->getEnvironmentId()) as $chefServer) {
         $chefServers[] = ['id' => $chefServer->id, 'url' => $chefServer->url, 'scope' => $chefServer->getScope()];
     }
     $governance = new Scalr_Governance($this->getEnvironmentId());
     $this->response->page('ui/core/governance/edit.js', array('platforms' => $platforms, 'values' => $governance->getValues(), 'chef' => ['servers' => $chefServers], 'scalr.aws.ec2.limits.security_groups_per_instance' => \Scalr::config('scalr.aws.ec2.limits.security_groups_per_instance')), array('ui/core/governance/lease.js'), array('ui/core/governance/edit.css'));
 }
Ejemplo n.º 2
0
 private function getList()
 {
     $list = ChefServer::getList($this->user->getAccountId(), $this->getEnvironmentId(true), $this->request->getScope());
     $data = [];
     foreach ($list as $entity) {
         $data[] = $this->getServerData($entity);
     }
     return $data;
 }
Ejemplo n.º 3
0
Archivo: Chef.php Proyecto: scalr/scalr
 /**
  * Returns list of chef servers applying governance
  *
  * @return array
  */
 public function xListServersAction()
 {
     $limits = null;
     if (!$this->user->isAdmin()) {
         $governance = new Scalr_Governance($this->getEnvironmentId(true));
         $limits = $governance->getValue(Scalr_Governance::CATEGORY_GENERAL, Scalr_Governance::GENERAL_CHEF, null);
     }
     $list = [];
     foreach (ChefServer::getList($this->user->getAccountId(), $this->getEnvironmentId(true), $this->request->getScope()) as $server) {
         if (!$limits || isset($limits['servers'][(string) $server->id])) {
             $list[] = ['id' => (string) $server->id, 'url' => $server->url, 'username' => $server->username, 'scope' => $server->getScope()];
         }
     }
     $this->response->data(['data' => $list]);
 }