Scalr\Service\OpenStack\OpenStackConfig::getIdentityVersion PHP Méthode

getIdentityVersion() public méthode

Gets OpenStack API version
public getIdentityVersion ( ) : string
Résultat string Returns the version of the identity
    public function getIdentityVersion()
    {
        return $this->identityVersion ?: 2;
    }

Usage Example

Exemple #1
0
 /**
  * Creates token from the response
  *
  * @param   ClientResponseInterface $response The response instance
  * @param   OpenStackConfig         $config   The openstack config
  *
  * @return \Scalr\Service\OpenStack\Client\AuthToken
  *
  * @throws  NotSupportedException
  */
 public static function makeToken(ClientResponseInterface $response, OpenStackConfig $config = null)
 {
     $version = $config === null ? 2 : $config->getIdentityVersion();
     switch ($version) {
         case 2:
             return LoaderV2::loadJson($response);
         case 3:
             return LoaderV3::loadJson($response);
         default:
             throw new NotSupportedException("OpenStack API v{$version} is not supported!");
     }
 }