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

  • Database
  • Instance
  • User
  • Overview
  • Namespace
  • Class
  • Tree
  • Download

Class Database

This class represents a Database in the Rackspace "Red Dwarf" database-as-a-service product.

OpenCloud\Common\Base
Extended by OpenCloud\Common\PersistentObject
Extended by OpenCloud\Database\Resource\Database
Namespace: OpenCloud\Database\Resource
Located at OpenCloud/Database/Resource/Database.php
Methods summary
public
# __construct( OpenCloud\Database\Resource\Instance $instance, mixed $info = null )

Creates a new database object

Creates a new database object

Unlike other objects (Servers, DataObjects, etc.), passing a database name to the constructor does not pull information from the database. For example, if you pass an ID to the Server() constructor, it will attempt to retrieve the information on that server from the service, and will return an error if it is not found. However, the Cloud Databases service does not permit retrieval of information on individual databases (only via Collection), and thus passing in a name via the $info parameter only creates an in-memory object that is not necessarily tied to an actual database.

Parameters

$instance
OpenCloud\Database\Resource\Instance
$instance the parent DbService\Instance of the database
$info
mixed
$info if an array or object, treated as properties to set; if a string, treated as the database name

Throws

DatabaseNameError
if $info is not a string, object, or array

Overrides

OpenCloud\Common\PersistentObject::__construct()
public type
# getName( )

Returns name of this database. Because it's so important (i.e. as an identifier), it will throw an error if not set/empty.

Returns name of this database. Because it's so important (i.e. as an identifier), it will throw an error if not set/empty.

Returns

type

Throws

OpenCloud\Common\Exceptions\DatabaseNameError
public string
# primaryKeyField( )

Returns the primary key field for the object

Returns the primary key field for the object

The primary key is usually 'id', but this function is provided so that (in rare cases where it is not 'id'), it can be overridden.

Returns

string

Overrides

OpenCloud\Common\PersistentObject::primaryKeyField()
public OpenCloud\Database\Resource\Instance
# instance( )

Returns the Instance of the database

Returns the Instance of the database

Returns

OpenCloud\Database\Resource\Instance
public OpenCloud\HttpResponse
# create( array $params = array() )

Creates a new database

Creates a new database

Parameters

$params
array
$params array of attributes to set prior to Create

Returns

OpenCloud\HttpResponse

Throws

VolumeCreateError
if HTTP status is not Success

Api

Overrides

OpenCloud\Common\PersistentObject::create()
public
# update( array $params = array() )

Updates an existing database

Updates an existing database

Parameters

$params
array
$params ignored

Throws

DatabaseUpdateError
always; updates are not permitted

Overrides

OpenCloud\Common\PersistentObject::update()
public OpenCloud\HttpResponseb
# delete( )

Deletes a database

Deletes a database

Returns

OpenCloud\HttpResponseb

Throws

DeleteError
if HTTP status is not Success

Api

Overrides

OpenCloud\Common\PersistentObject::delete()
protected
# createJson( array $params = array() )

Returns the JSON object for creating the database

Returns the JSON object for creating the database

Throws

CreateError
if not overridden

Overrides

OpenCloud\Common\PersistentObject::createJson()
Methods inherited from OpenCloud\Common\PersistentObject
action(), checkExtension(), createUrl(), findLink(), getClient(), getMetadata(), getParent(), getService(), getUrl(), id(), jsonCollectionElement(), jsonCollectionName(), jsonName(), name(), noCreate(), noDelete(), noUpdate(), parseResponse(), refresh(), refreshFromLocationUrl(), region(), resourceName(), setMetadata(), setParent(), setService(), status(), updateJson(), url(), waitFor()
Methods inherited from OpenCloud\Common\Base
__call(), checkJsonError(), generateUuid(), getLogger(), getProperty(), makeResourceIteratorOptions(), populate(), propertyExists(), setLogger(), setProperty(), stripNamespace(), toCamel(), toUnderscores()
Properties summary
protected static string $json_collection_name 'databases'
#
protected static string $url_resource 'databases'
#
public mixed $name
#
Properties inherited from OpenCloud\Common\PersistentObject
$metadata
PHP OpenCloud API API documentation generated by ApiGen 2.8.0