HPCloud-PHP  1.2.0
PHP bindings for HPCloud and OpenStack services.
 All Classes Namespaces Files Functions Variables Pages
InstanceDetails Class Reference

Public Member Functions

 newFromJSON ($json)
 __construct ($name, $id)
 name ()
 Get the name of this instance.
 id ()
 Get the ID of the instance.
 createdOn ()
 Get a string expressing the creation time.
 status ()
 Get the status of this instance.
 isRunning ()
 Check whether the present instance is running.
 hostname ()
 Get the hostname.
 setHostname ($hostname)
 Set the hostname.
 username ()
 The username field, if available.
 setUsername ($username)
 Set the username.
 password ()
 The password field, if available.
 setPassword ($password)
 Set the password.
 links ()
 An array of links about this database.
 dsn ($dbName=NULL, $charset=NULL)
 Get the DSN to connect to the database instance.

Protected Attributes

 $name
 $id
 $links
 $created
 $status
 $hostname
 $username
 $password

Detailed Description

Definition at line 30 of file InstanceDetails.php.

Constructor & Destructor Documentation

__construct (   $name,
  $id 
)

Definition at line 68 of file InstanceDetails.php.

References InstanceDetails\$id, $name, and InstanceDetails\name().

Member Function Documentation

createdOn ( )

Get a string expressing the creation time.

This may only be set during CREATE or DESCRIBE results.

Return values
string
Returns
string A string indicating the creation time. Format is in ISO date format.

Definition at line 105 of file InstanceDetails.php.

dsn (   $dbName = NULL,
  $charset = NULL 
)

Get the DSN to connect to the database instance.

A convenience function for PDO.

See Also
http://us3.php.net/manual/en/ref.pdo-mysql.connection.php
Parameters
string$dbNameThe name of the database to connect to. If none is specified, this will be left off of the DSN.
string$charsetThis will attempt to set the character set. Not all versions of PHP use this.
Return values
string
Returns
string The DSN, including driver, host, port, and database name.
Todo:
At this time, 'mysql' is hard-coded as the driver name. Does this need to change?

Definition at line 289 of file InstanceDetails.php.

References InstanceDetails\hostname().

hostname ( )

Get the hostname.

Note that the port is always 3306, the MySQL default. Only the hostname is returned.

Attention
In version 1.0 of the DBaaS protocol, this is ONLY available after the DB instance has been brought all the way up.

This returns the DNS name of the host (or possibly an IP address).

Return values
string
Returns
string The FQDN or IP address of the MySQL server.

Definition at line 159 of file InstanceDetails.php.

Referenced by InstanceDetails\dsn(), and InstanceDetails\setHostname().

id ( )

Get the ID of the instance.

Return values
string
Returns
string The ID.

Definition at line 91 of file InstanceDetails.php.

isRunning ( )

Check whether the present instance is running.

This is a convenience function for determining whether a remote instance reports itself to be running. It is equivalent to checking that status() returns 'running'.

Return values
boolean
Returns
boolean TRUE if this is running, FALSE otherwise.

Definition at line 139 of file InstanceDetails.php.

References InstanceDetails\status().

links ( )

An array of links about this database.

Format:

<?php
array(
0 => array(
"rel" => "self",
"url" => "https://some.long/url",
),
);
?>

At the time of this writing, there is no definition of what URLs may appear here. However, the self URL us a URL to the present instance's definition.

Return values
array
Returns
array An array of related links to DBaaS URLs.

Definition at line 264 of file InstanceDetails.php.

name ( )

Get the name of this instance.

Return values
string
Returns
string The name of the instance.

Definition at line 80 of file InstanceDetails.php.

References $name.

Referenced by InstanceDetails\__construct().

newFromJSON (   $json)

Definition at line 42 of file InstanceDetails.php.

password ( )

The password field, if available.

This is the password for this instance's MySQL database.

Attention
This is only returned when a database is first created.
Return values
string
Returns
string A password string.

Definition at line 221 of file InstanceDetails.php.

Referenced by InstanceDetails\setPassword().

setHostname (   $hostname)

Set the hostname.

Parameters
string$hostnameThe hostname for this server.
Return values
HPCloud::Services::DBaaS::InstanceDetails
Returns
$this so the method can be used in chaining.

Definition at line 173 of file InstanceDetails.php.

References InstanceDetails\$hostname, and InstanceDetails\hostname().

setPassword (   $password)

Set the password.

Parameters
string$passwordThe password for this server.
Return values
HPCloud::Services::DBaaS::InstanceDetails
Returns
$this so the method can be used in chaining.

Definition at line 235 of file InstanceDetails.php.

References InstanceDetails\$password, and InstanceDetails\password().

setUsername (   $username)

Set the username.

Parameters
string$usernameThe username for this server.
Return values
HPCloud::Services::DBaaS::InstanceDetails
Returns
$this so the method can be used in chaining.

Definition at line 203 of file InstanceDetails.php.

References InstanceDetails\$username, and InstanceDetails\username().

status ( )

Get the status of this instance.

This indicates whether or not the service is available, along with other details.

Known status messages:

  • running: Instance is fully operational.
  • building: Instance is being created.
  • restarting: Instance has been restarted, and is still coming online.

    Return values
    string
    Returns
    string A short status message.

Definition at line 124 of file InstanceDetails.php.

Referenced by InstanceDetails\isRunning().

username ( )

The username field, if available.

Attention
Typically this is only available at creation time!
Return values
string
Returns
string The username for the MySQL instance.

Definition at line 189 of file InstanceDetails.php.

Referenced by InstanceDetails\setUsername().

Member Data Documentation

$created
protected

Definition at line 35 of file InstanceDetails.php.

$hostname
protected

Definition at line 37 of file InstanceDetails.php.

Referenced by InstanceDetails\setHostname().

$id
protected

Definition at line 33 of file InstanceDetails.php.

Referenced by InstanceDetails\__construct().

$links
protected

Definition at line 34 of file InstanceDetails.php.

$name
protected

Definition at line 32 of file InstanceDetails.php.

$password
protected

Definition at line 40 of file InstanceDetails.php.

Referenced by InstanceDetails\setPassword().

$status
protected

Definition at line 36 of file InstanceDetails.php.

$username
protected

Definition at line 39 of file InstanceDetails.php.

Referenced by InstanceDetails\setUsername().


The documentation for this class was generated from the following file: