Class OpenStack
The OpenStack class represents a relationship (or "connection") between a user and a service.
This is the primary entry point into an OpenStack system, and the only one where the developer is required to know and provide the endpoint URL (in all other cases, the endpoint is derived from the Service Catalog provided by the authentication system).
Since various providers have different mechanisms for authentication, users will often use a subclass of OpenStack. For example, the Rackspace class is provided for users of Rackspace's cloud services, and other cloud providers are welcome to add their own subclasses as well.
General usage example:
$username = 'My Username'; $secret = 'My Secret'; $connection = new OpenCloud\OpenStack($username, $secret); // having established the connection, we can set some defaults // this sets the default name and region of the Compute service $connection->SetDefaults('Compute', 'cloudServersOpenStack', 'ORD'); // access a Compute service $chicago = $connection->Compute(); // if we want to access a different service, we can: $dallas = $connection->Compute('cloudServersOpenStack', 'DFW');
- OpenCloud\Common\Base
-
OpenCloud\OpenStack
Direct known subclasses
OpenCloud\Rackspace
public
|
#
__construct( string $url, array $secret, array $options = array() )
Creates a new OpenStack object |
public
|
|
public
|
|
public
string
|
|
public
|
|
public
string
|
|
public
|
|
public
array
|
|
public
|
|
public
string
|
|
public
|
|
public
integer
|
|
public
|
|
public
string
|
|
public
|
|
public
array
|
|
public
|
|
public
array
|
|
public
|
#
setFileDescriptor( string $key, resource $value )
Set a specific file descriptor (associated with a URL) |
public
resource|false
|
|
public
array
|
|
public
|
|
public
integer
|
|
public
|
|
public
integer
|
|
public
|
|
public
integer
|
|
public
|
#
setDefault( string $service, array $value = array() )
Sets default values (an array) for a service. Each array must contain a "name", "region" and "urltype" key. |
public
array|false
|
#
getDefault( string $service )
Get a specific default value for a service. If none exist, return FALSE. |
public
|
#
setTimeouts( integer $httpTimeout, integer $connectTimeout = null, integer $overlimitTimeout = null )
Sets the timeouts for the current connection |
public
string
|
|
public
array
|
|
public
|
|
public
boolean
|
|
public
string
|
|
public
string
|
|
public
string
|
|
public
|
|
public
|
|
public
string
|
|
public
|
|
public
HttpResponse
|
|
public
|
#
setDefaults( string $service, string $name = null, string $region = null, string $urltype = null )
Sets default values for name, region, URL type for a service |
public
|
#
setUploadProgressCallback( callable $callback )
Allows the user to define a function for tracking uploads |
public
|
#
setDownloadProgressCallback( callable $callback )
Allows the user to define a function for tracking downloads |
public
string
|
|
public
integer
|
|
public
array
|
|
public
|
|
public
ObjectStore
|
#
objectStore( string $name = null, string $region = null, string $urltype = null )
Creates a new ObjectStore object (Swift/Cloud Files) |
public
Compute
|
|
public
|
#
orchestration( string $name = null, string $region = null, string $urltype = null )
Creates a new Orchestration (heat) service object |
public
|
#
volumeService( string $name = null, string $region = null, string $urltype = null )
Creates a new VolumeService (cinder) service object |
public
Service
|
|
public
|
__set(),
checkJsonError(),
getHttpRequestObject(),
getLogger(),
makeQueryString(),
populate(),
setLogger(),
setProperty()
|
public
string
|
$useragent | RAXSDK_USER_AGENT |
#
This holds the HTTP User-Agent: used for all requests to the services. It is public so that, if necessary, it can be entirely overridden by the developer. However, it's strongly recomended that you use the appendUserAgent() method to APPEND your own User Agent identifier to the end of this string; the user agent information can be very valuable to service providers to track who is using their service. |
protected
mixed
|
$url |
|
|
protected
array
|
$secret | array() |
|
protected
mixed
|
$token |
|
|
protected
integer
|
$expiration | 0 |
|
protected
mixed
|
$tenant |
|
|
protected
mixed
|
$catalog |
|
|
protected
mixed
|
$connectTimeout | RAXSDK_CONNECTTIMEOUT |
|
protected
mixed
|
$httpTimeout | RAXSDK_TIMEOUT |
|
protected
mixed
|
$overlimitTimeout | RAXSDK_OVERLIMIT_TIMEOUT |
|
protected
mixed
|
$defaults | array(
'Compute' => array(
'name' => RAXSDK_COMPUTE_NAME,
'region' => RAXSDK_COMPUTE_REGION,
'urltype' => RAXSDK_COMPUTE_URLTYPE
),
'ObjectStore' => array(
'name' => RAXSDK_OBJSTORE_NAME,
'region' => RAXSDK_OBJSTORE_REGION,
'urltype' => RAXSDK_OBJSTORE_URLTYPE
),
'Database' => array(
'name' => RAXSDK_DATABASE_NAME,
'region' => RAXSDK_DATABASE_REGION,
'urltype' => RAXSDK_DATABASE_URLTYPE
),
'Volume' => array(
'name' => RAXSDK_VOLUME_NAME,
'region' => RAXSDK_VOLUME_REGION,
'urltype' => RAXSDK_VOLUME_URLTYPE
),
'LoadBalancer' => array(
'name' => RAXSDK_LBSERVICE_NAME,
'region' => RAXSDK_LBSERVICE_REGION,
'urltype' => RAXSDK_LBSERVICE_URLTYPE
),
'DNS' => array(
'name' => RAXSDK_DNS_NAME,
'region' => RAXSDK_DNS_REGION,
'urltype' => RAXSDK_DNS_URLTYPE
),
'Orchestration' => array(
'name' => RAXSDK_ORCHESTRATION_NAME,
'region' => RAXSDK_ORCHESTRATION_REGION,
'urltype' => RAXSDK_ORCHESTRATION_URLTYPE
),
'CloudMonitoring' => array(
'name' => RAXSDK_MONITORING_NAME,
'region' => RAXSDK_MONITORING_REGION,
'urltype' => RAXSDK_MONITORING_URLTYPE
),
'Autoscale' => array(
'name' => RAXSDK_AUTOSCALE_NAME,
'region' => RAXSDK_AUTOSCALE_REGION,
'urltype' => RAXSDK_AUTOSCALE_URLTYPE
)
) |
#
This associative array holds default values used to identify each service (and to select it from the Service Catalog). Use the Compute::SetDefaults() method to change the default values, or define the global constants (for example, RAXSDK_COMPUTE_NAME) BEFORE loading the OpenCloud library: |