当前位置: 首页>>代码示例>>PHP>>正文


PHP Scalr_Environment::getEnabledPlatforms方法代码示例

本文整理汇总了PHP中Scalr_Environment::getEnabledPlatforms方法的典型用法代码示例。如果您正苦于以下问题:PHP Scalr_Environment::getEnabledPlatforms方法的具体用法?PHP Scalr_Environment::getEnabledPlatforms怎么用?PHP Scalr_Environment::getEnabledPlatforms使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Scalr_Environment的用法示例。


在下文中一共展示了Scalr_Environment::getEnabledPlatforms方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ucloudAction

 public function ucloudAction()
 {
     $params = array();
     if (in_array(SERVER_PLATFORMS::UCLOUD, $this->env->getEnabledPlatforms())) {
         $params = $this->getCloudStackDetails(SERVER_PLATFORMS::UCLOUD);
     }
     $this->response->page('ui/account2/environments/platform/cloudstack.js', array('env' => array('id' => $this->env->id, 'name' => $this->env->name), 'params' => $params, 'platformName' => 'KT uCloud', 'platform' => 'ucloud'));
 }
开发者ID:recipe,项目名称:scalr,代码行数:8,代码来源:Platform.php

示例2: getCloudParams

 private function getCloudParams($platform)
 {
     $params = [];
     if (in_array($platform, $this->env->getEnabledPlatforms()) || $platform == SERVER_PLATFORMS::AZURE) {
         $cloudCredentials = $this->env->keychain($platform);
         $ccProps = $cloudCredentials->properties;
         switch ($platform) {
             case SERVER_PLATFORMS::EC2:
                 $params[SERVER_PLATFORMS::EC2 . '.is_enabled'] = true;
                 $params[Entity\CloudCredentialsProperty::AWS_ACCOUNT_ID] = $ccProps[Entity\CloudCredentialsProperty::AWS_ACCOUNT_ID];
                 $params[Entity\CloudCredentialsProperty::AWS_ACCOUNT_TYPE] = $ccProps[Entity\CloudCredentialsProperty::AWS_ACCOUNT_TYPE];
                 $params[Entity\CloudCredentialsProperty::AWS_ACCESS_KEY] = $ccProps[Entity\CloudCredentialsProperty::AWS_ACCESS_KEY];
                 $params[Entity\CloudCredentialsProperty::AWS_SECRET_KEY] = $ccProps[Entity\CloudCredentialsProperty::AWS_SECRET_KEY] != '' ? '******' : '';
                 $params[Entity\CloudCredentialsProperty::AWS_PRIVATE_KEY] = $ccProps[Entity\CloudCredentialsProperty::AWS_PRIVATE_KEY] != '' ? 'Uploaded' : '';
                 $params[Entity\CloudCredentialsProperty::AWS_CERTIFICATE] = $ccProps[Entity\CloudCredentialsProperty::AWS_CERTIFICATE] != '' ? 'Uploaded' : '';
                 $params[Entity\CloudCredentialsProperty::AWS_DETAILED_BILLING_BUCKET] = $ccProps[Entity\CloudCredentialsProperty::AWS_DETAILED_BILLING_BUCKET];
                 $params[Entity\CloudCredentialsProperty::AWS_DETAILED_BILLING_ENABLED] = $ccProps[Entity\CloudCredentialsProperty::AWS_DETAILED_BILLING_ENABLED];
                 $params[Entity\CloudCredentialsProperty::AWS_DETAILED_BILLING_PAYER_ACCOUNT] = $ccProps[Entity\CloudCredentialsProperty::AWS_DETAILED_BILLING_PAYER_ACCOUNT];
                 $params[Entity\CloudCredentialsProperty::AWS_DETAILED_BILLING_REGION] = $ccProps[Entity\CloudCredentialsProperty::AWS_DETAILED_BILLING_REGION];
                 try {
                     if ($params[Entity\CloudCredentialsProperty::AWS_ACCOUNT_TYPE] == Entity\CloudCredentialsProperty::AWS_ACCOUNT_TYPE_CN_CLOUD) {
                         $params['arn'] = $this->env->aws('cn-north-1')->getUserArn();
                     } elseif ($params[Entity\CloudCredentialsProperty::AWS_ACCOUNT_TYPE] == Entity\CloudCredentialsProperty::AWS_ACCOUNT_TYPE_GOV_CLOUD) {
                         $params['arn'] = $this->env->aws('us-gov-west-1')->getUserArn();
                     } else {
                         $params['arn'] = $this->env->aws('us-east-1')->getUserArn();
                     }
                     //$params['username'] = $this->env->aws('us-east-1')->getUsername();
                 } catch (Exception $e) {
                 }
                 break;
             case SERVER_PLATFORMS::GCE:
                 $params[SERVER_PLATFORMS::GCE . '.is_enabled'] = true;
                 $params[Entity\CloudCredentialsProperty::GCE_PROJECT_ID] = $ccProps[Entity\CloudCredentialsProperty::GCE_PROJECT_ID];
                 $jsonKey = $ccProps[Entity\CloudCredentialsProperty::GCE_JSON_KEY];
                 if (!empty($jsonKey)) {
                     $params[Entity\CloudCredentialsProperty::GCE_JSON_KEY] = 'Uploaded';
                 } else {
                     $params[Entity\CloudCredentialsProperty::GCE_CLIENT_ID] = $ccProps[Entity\CloudCredentialsProperty::GCE_CLIENT_ID];
                     $params[Entity\CloudCredentialsProperty::GCE_SERVICE_ACCOUNT_NAME] = $ccProps[Entity\CloudCredentialsProperty::GCE_SERVICE_ACCOUNT_NAME];
                     $params[Entity\CloudCredentialsProperty::GCE_KEY] = $ccProps[Entity\CloudCredentialsProperty::GCE_KEY] != '' ? 'Uploaded' : '';
                 }
                 break;
             case SERVER_PLATFORMS::CLOUDSTACK:
             case SERVER_PLATFORMS::IDCF:
                 $params = $this->getCloudStackDetails($platform);
                 break;
             case SERVER_PLATFORMS::OPENSTACK:
             case SERVER_PLATFORMS::RACKSPACENG_UK:
             case SERVER_PLATFORMS::RACKSPACENG_US:
             case SERVER_PLATFORMS::OCS:
             case SERVER_PLATFORMS::NEBULA:
             case SERVER_PLATFORMS::MIRANTIS:
             case SERVER_PLATFORMS::VIO:
             case SERVER_PLATFORMS::VERIZON:
             case SERVER_PLATFORMS::CISCO:
             case SERVER_PLATFORMS::HPCLOUD:
                 $params = $this->getOpenStackDetails($platform);
                 break;
             case SERVER_PLATFORMS::AZURE:
                 $params[SERVER_PLATFORMS::AZURE . '.is_enabled'] = $cloudCredentials->isEnabled();
                 $params[Entity\CloudCredentialsProperty::AZURE_TENANT_NAME] = $ccProps[Entity\CloudCredentialsProperty::AZURE_TENANT_NAME];
                 $params[Entity\CloudCredentialsProperty::AZURE_AUTH_STEP] = $ccProps[Entity\CloudCredentialsProperty::AZURE_AUTH_STEP] ?: 0;
                 $params[Entity\CloudCredentialsProperty::AZURE_SUBSCRIPTION_ID] = $ccProps[Entity\CloudCredentialsProperty::AZURE_SUBSCRIPTION_ID];
                 $params['subscriptions'] = [];
                 if ($params[Entity\CloudCredentialsProperty::AZURE_AUTH_STEP] > 1) {
                     $subscriptionList = [];
                     try {
                         $subscriptions = $this->env->azure()->getSubscriptionsList();
                         foreach ($subscriptions as $subscription) {
                             if ($subscription->state == 'Enabled') {
                                 $subscriptionList[] = ['displayName' => $subscription->displayName, 'subscriptionId' => $subscription->subscriptionId];
                             }
                         }
                     } catch (Exception $e) {
                         if (strpos($e->getMessage(), 'Error validating credentials') !== false || strpos($e->getMessage(), 'Refresh token is expired or not exists') !== false) {
                             $cloudCredentials->delete();
                             $cloudCredentials->release();
                             $params[Entity\CloudCredentialsProperty::AZURE_AUTH_STEP] = 0;
                             $params[Entity\CloudCredentialsProperty::AZURE_SUBSCRIPTION_ID] = null;
                         }
                         $params['errorMessage'] = $e->getMessage();
                         break;
                     }
                     if (empty($subscriptionList)) {
                         $params['errorMessage'] = sprintf("There are no active subscriptions available for the '%s' tenant", $params[Entity\CloudCredentialsProperty::AZURE_TENANT_NAME]);
                     }
                     $params['subscriptions'] = $subscriptionList;
                 }
                 break;
         }
     }
     if ($platform == SERVER_PLATFORMS::EC2) {
         $platformModule = PlatformFactory::NewPlatform($platform);
         /* @var $platformModule Ec2PlatformModule */
         $params['cloudLocations'] = [Entity\CloudCredentialsProperty::AWS_ACCOUNT_TYPE_REGULAR => array_keys($platformModule->getLocationsByAccountType(Entity\CloudCredentialsProperty::AWS_ACCOUNT_TYPE_REGULAR)), Entity\CloudCredentialsProperty::AWS_ACCOUNT_TYPE_GOV_CLOUD => array_keys($platformModule->getLocationsByAccountType(Entity\CloudCredentialsProperty::AWS_ACCOUNT_TYPE_GOV_CLOUD)), Entity\CloudCredentialsProperty::AWS_ACCOUNT_TYPE_CN_CLOUD => array_keys($platformModule->getLocationsByAccountType(Entity\CloudCredentialsProperty::AWS_ACCOUNT_TYPE_CN_CLOUD))];
     }
     return $params;
 }
开发者ID:scalr,项目名称:scalr,代码行数:99,代码来源:Clouds.php

示例3: getCloudParams

 private function getCloudParams($platform)
 {
     $params = array();
     if (in_array($platform, $this->env->getEnabledPlatforms())) {
         switch ($platform) {
             case SERVER_PLATFORMS::EC2:
                 $params[SERVER_PLATFORMS::EC2 . '.is_enabled'] = true;
                 $params[Ec2PlatformModule::ACCOUNT_ID] = $this->env->getPlatformConfigValue(Ec2PlatformModule::ACCOUNT_ID);
                 $params[Ec2PlatformModule::ACCOUNT_TYPE] = $this->env->getPlatformConfigValue(Ec2PlatformModule::ACCOUNT_TYPE);
                 $params[Ec2PlatformModule::ACCESS_KEY] = $this->env->getPlatformConfigValue(Ec2PlatformModule::ACCESS_KEY);
                 $params[Ec2PlatformModule::SECRET_KEY] = $this->env->getPlatformConfigValue(Ec2PlatformModule::SECRET_KEY) != '' ? '******' : '';
                 $params[Ec2PlatformModule::PRIVATE_KEY] = $this->env->getPlatformConfigValue(Ec2PlatformModule::PRIVATE_KEY) != '' ? 'Uploaded' : '';
                 $params[Ec2PlatformModule::CERTIFICATE] = $this->env->getPlatformConfigValue(Ec2PlatformModule::CERTIFICATE) != '' ? 'Uploaded' : '';
                 $params[Ec2PlatformModule::DETAILED_BILLING_BUCKET] = $this->env->getPlatformConfigValue(Ec2PlatformModule::DETAILED_BILLING_BUCKET);
                 $params[Ec2PlatformModule::DETAILED_BILLING_ENABLED] = $this->env->getPlatformConfigValue(Ec2PlatformModule::DETAILED_BILLING_ENABLED);
                 try {
                     if ($params[Ec2PlatformModule::ACCOUNT_TYPE] == Ec2PlatformModule::ACCOUNT_TYPE_CN_CLOUD) {
                         $params['arn'] = $this->env->aws('cn-north-1')->getUserArn();
                     } elseif ($params[Ec2PlatformModule::ACCOUNT_TYPE] == Ec2PlatformModule::ACCOUNT_TYPE_GOV_CLOUD) {
                         $params['arn'] = $this->env->aws('us-gov-west-1')->getUserArn();
                     } else {
                         $params['arn'] = $this->env->aws('us-east-1')->getUserArn();
                     }
                     //$params['username'] = $this->env->aws('us-east-1')->getUsername();
                 } catch (Exception $e) {
                 }
                 break;
             case SERVER_PLATFORMS::GCE:
                 $params[SERVER_PLATFORMS::GCE . '.is_enabled'] = true;
                 $params[GoogleCEPlatformModule::PROJECT_ID] = $this->env->getPlatformConfigValue(GoogleCEPlatformModule::PROJECT_ID);
                 $jsonKey = $this->env->getPlatformConfigValue(GoogleCEPlatformModule::JSON_KEY);
                 if (!empty($jsonKey)) {
                     $params[GoogleCEPlatformModule::JSON_KEY] = 'Uploaded';
                 } else {
                     $params[GoogleCEPlatformModule::CLIENT_ID] = $this->env->getPlatformConfigValue(GoogleCEPlatformModule::CLIENT_ID);
                     $params[GoogleCEPlatformModule::SERVICE_ACCOUNT_NAME] = $this->env->getPlatformConfigValue(GoogleCEPlatformModule::SERVICE_ACCOUNT_NAME);
                     $params[GoogleCEPlatformModule::KEY] = $this->env->getPlatformConfigValue(GoogleCEPlatformModule::KEY) != '' ? 'Uploaded' : '';
                 }
                 break;
             case SERVER_PLATFORMS::CLOUDSTACK:
             case SERVER_PLATFORMS::IDCF:
                 $params = $this->getCloudStackDetails($platform);
                 break;
             case SERVER_PLATFORMS::OPENSTACK:
             case SERVER_PLATFORMS::RACKSPACENG_UK:
             case SERVER_PLATFORMS::RACKSPACENG_US:
             case SERVER_PLATFORMS::ECS:
             case SERVER_PLATFORMS::OCS:
             case SERVER_PLATFORMS::NEBULA:
             case SERVER_PLATFORMS::MIRANTIS:
             case SERVER_PLATFORMS::VIO:
             case SERVER_PLATFORMS::VERIZON:
             case SERVER_PLATFORMS::CISCO:
             case SERVER_PLATFORMS::HPCLOUD:
                 $params = $this->getOpenStackDetails($platform);
                 break;
             case SERVER_PLATFORMS::RACKSPACE:
                 $rows = $this->db->GetAll('SELECT * FROM client_environment_properties WHERE env_id = ? AND name LIKE "rackspace.%" AND `group` != "" GROUP BY `group`', $this->env->id);
                 $params[SERVER_PLATFORMS::RACKSPACE . '.is_enabled'] = true;
                 foreach ($rows as $value) {
                     $cloud = $value['group'];
                     $params[$cloud] = array(RackspacePlatformModule::USERNAME => $this->env->getPlatformConfigValue(RackspacePlatformModule::USERNAME, true, $cloud), RackspacePlatformModule::API_KEY => $this->env->getPlatformConfigValue(RackspacePlatformModule::API_KEY, true, $cloud), RackspacePlatformModule::IS_MANAGED => $this->env->getPlatformConfigValue(RackspacePlatformModule::IS_MANAGED, true, $cloud));
                 }
                 break;
             case SERVER_PLATFORMS::EUCALYPTUS:
                 $rows = $this->db->GetAll('SELECT * FROM client_environment_properties WHERE env_id = ? AND name LIKE "eucalyptus.%" AND `group` != "" GROUP BY `group`', $this->env->id);
                 $params[SERVER_PLATFORMS::EUCALYPTUS . '.is_enabled'] = true;
                 $params['locations'] = array();
                 foreach ($rows as $value) {
                     $cloud = $value['group'];
                     $params['locations'][$cloud] = array(EucalyptusPlatformModule::ACCOUNT_ID => $this->env->getPlatformConfigValue(EucalyptusPlatformModule::ACCOUNT_ID, true, $cloud), EucalyptusPlatformModule::ACCESS_KEY => $this->env->getPlatformConfigValue(EucalyptusPlatformModule::ACCESS_KEY, true, $cloud), EucalyptusPlatformModule::EC2_URL => $this->env->getPlatformConfigValue(EucalyptusPlatformModule::EC2_URL, true, $cloud), EucalyptusPlatformModule::S3_URL => $this->env->getPlatformConfigValue(EucalyptusPlatformModule::S3_URL, true, $cloud), EucalyptusPlatformModule::SECRET_KEY => $this->env->getPlatformConfigValue(EucalyptusPlatformModule::SECRET_KEY, true, $cloud) != '' ? '******' : false, EucalyptusPlatformModule::PRIVATE_KEY => $this->env->getPlatformConfigValue(EucalyptusPlatformModule::PRIVATE_KEY, true, $cloud) != '' ? 'Uploaded' : '', EucalyptusPlatformModule::CLOUD_CERTIFICATE => $this->env->getPlatformConfigValue(EucalyptusPlatformModule::CLOUD_CERTIFICATE, true, $cloud) != '' ? 'Uploaded' : '', EucalyptusPlatformModule::CERTIFICATE => $this->env->getPlatformConfigValue(EucalyptusPlatformModule::CERTIFICATE, true, $cloud) != '' ? 'Uploaded' : '');
                 }
                 break;
         }
     }
     return $params;
 }
开发者ID:sacredwebsite,项目名称:scalr,代码行数:77,代码来源:Clouds.php

示例4: getCloudParams

 private function getCloudParams($platform)
 {
     $params = array();
     if (in_array($platform, $this->env->getEnabledPlatforms())) {
         switch ($platform) {
             case SERVER_PLATFORMS::EC2:
                 $params[SERVER_PLATFORMS::EC2 . '.is_enabled'] = true;
                 $params[Ec2PlatformModule::ACCOUNT_ID] = $this->env->getPlatformConfigValue(Ec2PlatformModule::ACCOUNT_ID);
                 $params[Ec2PlatformModule::ACCOUNT_TYPE] = $this->env->getPlatformConfigValue(Ec2PlatformModule::ACCOUNT_TYPE);
                 $params[Ec2PlatformModule::ACCESS_KEY] = $this->env->getPlatformConfigValue(Ec2PlatformModule::ACCESS_KEY);
                 $params[Ec2PlatformModule::SECRET_KEY] = $this->env->getPlatformConfigValue(Ec2PlatformModule::SECRET_KEY) != '' ? '******' : '';
                 $params[Ec2PlatformModule::PRIVATE_KEY] = $this->env->getPlatformConfigValue(Ec2PlatformModule::PRIVATE_KEY) != '' ? 'Uploaded' : '';
                 $params[Ec2PlatformModule::CERTIFICATE] = $this->env->getPlatformConfigValue(Ec2PlatformModule::CERTIFICATE) != '' ? 'Uploaded' : '';
                 try {
                     $params['arn'] = $this->env->aws('us-east-1')->getUserArn();
                     //$params['username'] = $this->env->aws('us-east-1')->getUsername();
                 } catch (Exception $e) {
                 }
                 break;
             case SERVER_PLATFORMS::GCE:
                 $params[SERVER_PLATFORMS::GCE . '.is_enabled'] = true;
                 $params[GoogleCEPlatformModule::CLIENT_ID] = $this->env->getPlatformConfigValue(GoogleCEPlatformModule::CLIENT_ID);
                 $params[GoogleCEPlatformModule::PROJECT_ID] = $this->env->getPlatformConfigValue(GoogleCEPlatformModule::PROJECT_ID);
                 $params[GoogleCEPlatformModule::SERVICE_ACCOUNT_NAME] = $this->env->getPlatformConfigValue(GoogleCEPlatformModule::SERVICE_ACCOUNT_NAME);
                 $params[GoogleCEPlatformModule::KEY] = $this->env->getPlatformConfigValue(GoogleCEPlatformModule::KEY) != '' ? 'Uploaded' : '';
                 break;
             case SERVER_PLATFORMS::CLOUDSTACK:
             case SERVER_PLATFORMS::IDCF:
             case SERVER_PLATFORMS::UCLOUD:
                 $params = $this->getCloudStackDetails($platform);
                 break;
             case SERVER_PLATFORMS::OPENSTACK:
             case SERVER_PLATFORMS::RACKSPACENG_UK:
             case SERVER_PLATFORMS::RACKSPACENG_US:
             case SERVER_PLATFORMS::ECS:
             case SERVER_PLATFORMS::CONTRAIL:
             case SERVER_PLATFORMS::OCS:
             case SERVER_PLATFORMS::NEBULA:
                 $params = $this->getOpenStackDetails($platform);
                 break;
             case SERVER_PLATFORMS::NIMBULA:
                 $params[SERVER_PLATFORMS::NIMBULA . '.is_enabled'] = true;
                 $params[NimbulaPlatformModule::API_URL] = $this->env->getPlatformConfigValue(NimbulaPlatformModule::API_URL);
                 $params[NimbulaPlatformModule::USERNAME] = $this->env->getPlatformConfigValue(NimbulaPlatformModule::USERNAME);
                 $params[NimbulaPlatformModule::PASSWORD] = $this->env->getPlatformConfigValue(NimbulaPlatformModule::PASSWORD);
                 break;
             case SERVER_PLATFORMS::RACKSPACE:
                 $rows = $this->db->GetAll('SELECT * FROM client_environment_properties WHERE env_id = ? AND name LIKE "rackspace.%" AND `group` != "" GROUP BY `group`', $this->env->id);
                 $params[SERVER_PLATFORMS::RACKSPACE . '.is_enabled'] = true;
                 foreach ($rows as $value) {
                     $cloud = $value['group'];
                     $params[$cloud] = array(RackspacePlatformModule::USERNAME => $this->env->getPlatformConfigValue(RackspacePlatformModule::USERNAME, true, $cloud), RackspacePlatformModule::API_KEY => $this->env->getPlatformConfigValue(RackspacePlatformModule::API_KEY, true, $cloud), RackspacePlatformModule::IS_MANAGED => $this->env->getPlatformConfigValue(RackspacePlatformModule::IS_MANAGED, true, $cloud));
                 }
                 break;
             case SERVER_PLATFORMS::EUCALYPTUS:
                 $rows = $this->db->GetAll('SELECT * FROM client_environment_properties WHERE env_id = ? AND name LIKE "eucalyptus.%" AND `group` != "" GROUP BY `group`', $this->env->id);
                 $params[SERVER_PLATFORMS::EUCALYPTUS . '.is_enabled'] = true;
                 $params['locations'] = array();
                 foreach ($rows as $value) {
                     $cloud = $value['group'];
                     $params['locations'][$cloud] = array(EucalyptusPlatformModule::ACCOUNT_ID => $this->env->getPlatformConfigValue(EucalyptusPlatformModule::ACCOUNT_ID, true, $cloud), EucalyptusPlatformModule::ACCESS_KEY => $this->env->getPlatformConfigValue(EucalyptusPlatformModule::ACCESS_KEY, true, $cloud), EucalyptusPlatformModule::EC2_URL => $this->env->getPlatformConfigValue(EucalyptusPlatformModule::EC2_URL, true, $cloud), EucalyptusPlatformModule::S3_URL => $this->env->getPlatformConfigValue(EucalyptusPlatformModule::S3_URL, true, $cloud), EucalyptusPlatformModule::SECRET_KEY => $this->env->getPlatformConfigValue(EucalyptusPlatformModule::SECRET_KEY, true, $cloud) != '' ? '******' : false, EucalyptusPlatformModule::PRIVATE_KEY => $this->env->getPlatformConfigValue(EucalyptusPlatformModule::PRIVATE_KEY, true, $cloud) != '' ? 'Uploaded' : '', EucalyptusPlatformModule::CLOUD_CERTIFICATE => $this->env->getPlatformConfigValue(EucalyptusPlatformModule::CLOUD_CERTIFICATE, true, $cloud) != '' ? 'Uploaded' : '', EucalyptusPlatformModule::CERTIFICATE => $this->env->getPlatformConfigValue(EucalyptusPlatformModule::CERTIFICATE, true, $cloud) != '' ? 'Uploaded' : '');
                 }
                 break;
         }
     }
     return $params;
 }
开发者ID:rickb838,项目名称:scalr,代码行数:67,代码来源:Clouds.php


注:本文中的Scalr_Environment::getEnabledPlatforms方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。