Overview

Namespaces

  • OpenCloud
    • Autoscale
      • Resource
    • CloudMonitoring
      • Exception
      • Resource
    • Common
      • Collection
      • Constants
      • Exceptions
      • Http
        • Message
      • Identity
      • Log
      • Service
    • Compute
      • Constants
      • Exception
      • Resource
    • Database
      • Resource
    • DNS
      • Resource
    • LoadBalancer
      • Resource
    • ObjectStore
      • Constants
      • Exception
      • Resource
      • Upload
    • Orchestration
    • Queues
      • Exception
      • Resource
    • Volume
      • Resource
  • PHP

Classes

  • AbstractService
  • Catalog
  • CatalogItem
  • Endpoint
  • NovaService
  • ServiceBuilder
  • Overview
  • Namespace
  • Class
  • Tree
  • Download
  1: <?php
  2: /**
  3:  * PHP OpenCloud library.
  4:  * 
  5:  * @copyright 2013 Rackspace Hosting, Inc. See LICENSE for information.
  6:  * @license   https://www.apache.org/licenses/LICENSE-2.0
  7:  * @author    Jamie Hannaford <jamie.hannaford@rackspace.com>
  8:  */
  9: 
 10: namespace OpenCloud\Common\Service;
 11: 
 12: use Guzzle\Http\Url;
 13: 
 14: /**
 15:  * An endpoint serves as a location which receives and emits API interactions. It will therefore also host
 16:  * particular API resources. Each endpoint object has different access methods - one receives network connections over
 17:  * the public Internet, another receives traffic through an internal network. You will be able to access the latter
 18:  * from a Server, for example, in the same Region - which will incur no bandwidth charges, and be quicker.
 19:  */
 20: class Endpoint
 21: {
 22:     /**
 23:      * @var \Guzzle\Http\Url
 24:      */
 25:     private $publicUrl;
 26: 
 27:     /**
 28:      * @var \Guzzle\Http\Url
 29:      */
 30:     private $privateUrl;
 31: 
 32:     /**
 33:      * @var string
 34:      */
 35:     private $region;
 36: 
 37:     /**
 38:      * @param $object
 39:      * @return Endpoint
 40:      */
 41:     public static function factory($object)
 42:     {
 43:         $endpoint = new self();
 44:         
 45:         if (isset($object->publicURL)) {
 46:             $endpoint->setPublicUrl($object->publicURL);
 47:         }
 48:         if (isset($object->internalURL)) {
 49:             $endpoint->setPrivateUrl($object->internalURL);
 50:         }
 51:         if (isset($object->region)) {
 52:             $endpoint->setRegion($object->region);
 53:         }
 54: 
 55:         return $endpoint;
 56:     }
 57: 
 58:     /**
 59:      * @param $publicUrl
 60:      * @return $this
 61:      */
 62:     public function setPublicUrl($publicUrl)
 63:     {
 64:         $this->publicUrl = Url::factory($publicUrl);
 65:         return $this;
 66:     }
 67: 
 68:     /**
 69:      * @return Url
 70:      */
 71:     public function getPublicUrl()
 72:     {
 73:         return $this->publicUrl;
 74:     }
 75: 
 76:     /**
 77:      * @param $privateUrl
 78:      * @return $this
 79:      */
 80:     public function setPrivateUrl($privateUrl)
 81:     {
 82:         $this->privateUrl = Url::factory($privateUrl);
 83:         return $this;
 84:     }
 85: 
 86:     /**
 87:      * @return Url
 88:      */
 89:     public function getPrivateUrl()
 90:     {
 91:         return $this->privateUrl;
 92:     }
 93: 
 94:     /**
 95:      * @param $region
 96:      * @return $this
 97:      */
 98:     public function setRegion($region)
 99:     {
100:         $this->region = $region;
101:         return $this;
102:     }
103: 
104:     /**
105:      * @return string
106:      */
107:     public function getRegion()
108:     {
109:         return $this->region;
110:     }
111:     
112: }
PHP OpenCloud API API documentation generated by ApiGen 2.8.0