# Class Instance

Instance represents an instance of DbService, similar to a Server in a Compute service

  OpenCloud\Common\Base
  OpenCloud\Common\Resource\BaseResource
  OpenCloud\Common\Resource\PersistentResource
  OpenCloud\Common\Resource\NovaResource
  OpenCloud\Database\Resource\Instance

Namespace: OpenCloud\Database\Resource
Located at OpenCloud/Database/Resource/Instance.php

Methods summary
`public` | # `__construct( `OpenCloud\Database\Service` $service, mixed $info = null )` Creates a new instance object Creates a new instance object This could use the default constructor, but we want to make sure that the volume attribute is an object. #### Parameters $service `OpenCloud\DbService` $service the DbService object associated with this $info `mixed` $info the ID or array of info for the object #### Overrides `OpenCloud\Common\Resource\BaseResource::__construct()`
`public Guzzle\Http\Message\Response` | # `update( array $params = array() )` Updates a database instance (not permitted) Updates a database instance (not permitted) Update() is not supported by database instances; thus, this always throws an exception. #### Parameters $params `array` $params #### Returns `Guzzle\Http\Message\Response` #### Throws `InstanceUpdateError` always #### Overrides `OpenCloud\Common\Resource\PersistentResource::update()`
`public` | # `restart( )` Restarts the database instance Restarts the database instance #### Api #### Returns \OpenCloud\HttpResponse
`public` | # `resize( `OpenCloud\Compute\Resource\Flavor` $flavor )` Resizes the database instance (sets RAM) Resizes the database instance (sets RAM) #### Parameters $flavor `OpenCloud\Compute\Flavor` $flavor a flavor object #### Api #### Returns \OpenCloud\HttpResponse
`public OpenCloud\HttpResponse` | # `resizeVolume( integer $newvolumesize )` Resizes the volume associated with the database instance (disk space) Resizes the volume associated with the database instance (disk space) #### Parameters $newvolumesize `integer` $newvolumesize the size of the new volume, in gigabytes #### Returns `OpenCloud\HttpResponse` #### Api
`public `OpenCloud\Database\Resource\User`` | # `enableRootUser( )` Enables the root user for the instance Enables the root user for the instance #### Returns ``OpenCloud\Database\Resource\User`` the root user, including name and password #### Throws `InstanceError` if HTTP response is not Success #### Api
`public boolean` | # `isRootEnabled( )` Returns TRUE if the root user is enabled Returns TRUE if the root user is enabled #### Returns `boolean` TRUE if the root user is enabled; FALSE otherwise #### Throws `InstanceError` if HTTP status is not Success #### Api
`public `OpenCloud\Database\Resource\Database`` | # `database( string $name = '' )` Returns a new Database object Returns a new Database object #### Parameters $name `string` $name the database name #### Returns ``OpenCloud\Database\Resource\Database``
`public `OpenCloud\Database\Resource\User`` | # `user( string $name = '', array $databases = array() )` Returns a new User object Returns a new User object #### Parameters $name `string` $name the user name $databases `array` $databases a simple array of database names #### Returns ``OpenCloud\Database\Resource\User``
`public `OpenCloud\Common\Collection\PaginatedIterator`` | # `databaseList( )` Returns a Collection of all databases in the instance Returns a Collection of all databases in the instance #### Returns ``OpenCloud\Common\Collection\PaginatedIterator``
`public `OpenCloud\Common\Collection\PaginatedIterator`` | # `userList( )` Returns a Collection of all users in the instance Returns a Collection of all users in the instance #### Returns ``OpenCloud\Common\Collection\PaginatedIterator``
`protected `stdClass`` | # `createJson( )` Generates the JSON string for Create() Generates the JSON string for Create() #### Returns ``stdClass`` #### Throws ``RuntimeException`` #### Overrides `OpenCloud\Common\Resource\PersistentResource::createJson()`

Methods inherited from OpenCloud\Common\Resource\NovaResource
`action()`

Methods inherited from OpenCloud\Common\Resource\PersistentResource
`checkExtension(), create(), delete(), getAlias(), noCreate(), noDelete(), noUpdate(), refresh(), refreshFromLocationUrl(), updateJson(), waitFor()`

Methods inherited from OpenCloud\Common\Resource\BaseResource
`findLink(), getClient(), getMetadata(), getParent(), getService(), getUrl(), jsonCollectionElement(), jsonCollectionName(), jsonName(), parseResponse(), primaryKeyField(), resourceName(), setMetadata(), setParent(), setService()`

Methods inherited from OpenCloud\Common\Base
`__call(), checkJsonError(), generateUuid(), getInstance(), getJsonHeader(), getLogger(), getProperty(), makeResourceIteratorOptions(), populate(), propertyExists(), setLogger(), setProperty(), stripNamespace(), toCamel(), toUnderscores()`

Properties summary
`public mixed` | $id | `` | #
`public mixed` | $name | `` | #
`public mixed` | $status | `` | #
`public mixed` | $links | `` | #
`public mixed` | $hostname | `` | #
`public mixed` | $volume | `` | #
`public mixed` | $created | `` | #
`public mixed` | $updated | `` | #
`public mixed` | $flavor | `` | #
`protected static string` | $json_name | `'instance'` | #
`protected static string` | $url_resource | `'instances'` | #

Properties inherited from OpenCloud\Common\Resource\BaseResource
`$metadata, $parent, $service`

Properties inherited from OpenCloud\Common\Base
`$aliases`