Scalr\Service\OpenStack\OpenStackConfig::getTenantName PHP Method

getTenantName() public method

Gets OpenStack tenant name
public getTenantName ( ) : string
return string Returns OpenStack tenant name.
    public function getTenantName()
    {
        return $this->tenantName;
    }

Usage Example

Esempio n. 1
0
 /**
  * {@inheritdoc}
  * @see RequestInterface::makeRequest()
  */
 public function makeRequest(OpenStackConfig $config)
 {
     if ($config->getApiKey() !== null) {
         $requestBody = ['auth' => ['identity' => ['methods' => ['token'], 'token' => ['id' => $config->getApiKey()]]]];
     } else {
         if ($config->getPassword() !== null) {
             $requestBody = ['auth' => ['identity' => ['methods' => ['password'], 'password' => ['user' => ['password' => $config->getPassword()]]]]];
             if ($config->getUserId()) {
                 $requestBody['auth']['identity']['password']['user']['id'] = $config->getUserId();
             } else {
                 if ($config->getUsername()) {
                     $requestBody['auth']['identity']['password']['user']['name'] = $config->getUsername();
                 } else {
                     throw new OpenStackException('Neither user name nor user id was provided for the OpenStack config.');
                 }
             }
         } else {
             throw new OpenStackException('Neither api key nor password was provided for the OpenStack config.');
         }
     }
     if ($config->getProjectId() !== null) {
         $requestBody['auth']['scope']['project']['id'] = $config->getProjectId();
     } else {
         if ($config->getTenantName() !== null) {
             $requestBody['auth']['scope']['project']['name'] = $config->getTenantName();
         }
     }
     return $requestBody;
 }
All Usage Examples Of Scalr\Service\OpenStack\OpenStackConfig::getTenantName