# Class BaseResource

The root class for all other objects used or defined by this SDK.

It contains common code for error handling as well as service functions that are useful. Because it is an abstract class, it cannot be called directly, and it has no publicly-visible properties.

  OpenCloud\Common\Base
  OpenCloud\Common\Resource\BaseResource

#### Direct known subclasses

OpenCloud\Common\Resource\PersistentResource, OpenCloud\Image\Resource\AbstractSchemaResource

#### Indirect known subclasses

OpenCloud\Autoscale\Resource\AbstractResource, OpenCloud\Autoscale\Resource\Group, OpenCloud\CloudMonitoring\Resource\AgentTarget, OpenCloud\CloudMonitoring\Resource\AgentToken, OpenCloud\CloudMonitoring\Resource\Alarm, OpenCloud\CloudMonitoring\Resource\Changelog, OpenCloud\CloudMonitoring\Resource\Check, OpenCloud\CloudMonitoring\Resource\CheckType, OpenCloud\CloudMonitoring\Resource\Entity, OpenCloud\CloudMonitoring\Resource\Metric, OpenCloud\CloudMonitoring\Resource\Notification, OpenCloud\CloudMonitoring\Resource\NotificationHistory, OpenCloud\Autoscale\Resource\GroupConfiguration, OpenCloud\CloudMonitoring\Resource\NotificationType, OpenCloud\CloudMonitoring\Resource\ReadOnlyResource, OpenCloud\CloudMonitoring\Resource\View, OpenCloud\CloudMonitoring\Resource\Zone, OpenCloud\Common\Resource\NovaResource, OpenCloud\Compute\Resource\Flavor, OpenCloud\Compute\Resource\Image, OpenCloud\Compute\Resource\Network, OpenCloud\Compute\Resource\Server, OpenCloud\Compute\Resource\VolumeAttachment, OpenCloud\Autoscale\Resource\LaunchConfiguration, OpenCloud\Database\Resource\Database, OpenCloud\Database\Resource\Instance, OpenCloud\Database\Resource\User, OpenCloud\DNS\Resource\AbstractResource, OpenCloud\DNS\Resource\AsyncResponse, OpenCloud\DNS\Resource\Domain, OpenCloud\DNS\Resource\PtrRecord, OpenCloud\DNS\Resource\Record, OpenCloud\DNS\Resource\Subdomain, OpenCloud\Identity\Resource\Role, OpenCloud\Autoscale\Resource\ScalingPolicy, OpenCloud\Identity\Resource\Tenant, OpenCloud\Identity\Resource\Token, OpenCloud\Identity\Resource\User, OpenCloud\Image\Resource\Image, OpenCloud\Image\Resource\Member, OpenCloud\LoadBalancer\Resource\AbstractResource, OpenCloud\LoadBalancer\Resource\Access, OpenCloud\LoadBalancer\Resource\Algorithm, OpenCloud\LoadBalancer\Resource\AllowedDomain, OpenCloud\LoadBalancer\Resource\ConnectionLogging, OpenCloud\Autoscale\Resource\Webhook, OpenCloud\LoadBalancer\Resource\ConnectionThrottle, OpenCloud\LoadBalancer\Resource\ContentCaching, OpenCloud\LoadBalancer\Resource\ErrorPage, OpenCloud\LoadBalancer\Resource\HealthMonitor, OpenCloud\LoadBalancer\Resource\LoadBalancer, OpenCloud\LoadBalancer\Resource\Metadata, OpenCloud\LoadBalancer\Resource\Node, OpenCloud\LoadBalancer\Resource\NodeEvent, OpenCloud\LoadBalancer\Resource\NonIdUriResource, OpenCloud\LoadBalancer\Resource\Protocol, OpenCloud\CloudMonitoring\Resource\Agent, OpenCloud\LoadBalancer\Resource\ReadOnlyResource, OpenCloud\LoadBalancer\Resource\SessionPersistence, OpenCloud\LoadBalancer\Resource\SSLTermination, OpenCloud\LoadBalancer\Resource\Stats, OpenCloud\LoadBalancer\Resource\UsageRecord, OpenCloud\LoadBalancer\Resource\VirtualIp, OpenCloud\Orchestration\Resource, OpenCloud\Orchestration\Stack, OpenCloud\Queues\Resource\Claim, OpenCloud\Queues\Resource\Message, OpenCloud\CloudMonitoring\Resource\AgentConnection, OpenCloud\Queues\Resource\Queue, OpenCloud\Volume\Resource\Snapshot, OpenCloud\Volume\Resource\Volume, OpenCloud\Volume\Resource\VolumeType, OpenCloud\CloudMonitoring\Resource\AgentHost, OpenCloud\CloudMonitoring\Resource\AgentHostInfo
Abstract
Namespace: OpenCloud\Common\Resource
Located at OpenCloud/Common/Resource/BaseResource.php

Methods summary
`public` | # `__construct( `OpenCloud\Common\Service\ServiceInterface` $service, mixed $data = null )` #### Parameters $service ``OpenCloud\Common\Service\ServiceInterface`` $service The service that this resource belongs to $data `mixed` $data $data
`public OpenCloud\Common\PersistentObject` | # `setService( `OpenCloud\Common\Service\ServiceInterface` $service )` #### Parameters $service ``OpenCloud\Common\Service\ServiceInterface`` $service #### Returns `OpenCloud\Common\PersistentObject`
`public `OpenCloud\Common\Service\ServiceInterface`` | # `getService( )` #### Returns ``OpenCloud\Common\Service\ServiceInterface`` #### Throws ``OpenCloud\Common\Exceptions\ServiceException``
`public `OpenCloud\Common\Resource\BaseResource`` | # `setParent( `OpenCloud\Common\Resource\BaseResource` $parent )` #### Parameters $parent ``OpenCloud\Common\Resource\BaseResource`` $parent #### Returns ``OpenCloud\Common\Resource\BaseResource``
`public mixed` | # `getParent( )` #### Returns `mixed`
`public Guzzle\Http\ClientInterface` | # `getClient( )` Convenience method to return the service's client Convenience method to return the service's client #### Returns `Guzzle\Http\ClientInterface`
`public mixed` | # `setMetadata( mixed $data )` #### Parameters $data `mixed` $metadata #### Returns `mixed` $this
`public `OpenCloud\Common\Metadata`` | # `getMetadata( )` #### Returns ``OpenCloud\Common\Metadata``
`public mixed` | # `getUrl( null $path = null, array $query = array() )` Get this resource's URL Get this resource's URL #### Parameters $path `null` $path URI path to add on $query `array` $query Query to add on #### Returns `mixed`
`public boolean` | # `findLink( string $type = 'self' )` Find a resource link based on a type Find a resource link based on a type #### Parameters $type `string` $type #### Returns `boolean`
`protected string` | # `primaryKeyField( )` Returns the primary key field for the object Returns the primary key field for the object #### Returns `string`
`public static` | # `jsonName( )` Returns the top-level key for the returned response JSON document Returns the top-level key for the returned response JSON document #### Throws ``OpenCloud\Common\Exceptions\DocumentError``
`public static string` | # `jsonCollectionName( )` Returns the top-level key for collection responses Returns the top-level key for collection responses #### Returns `string`
`public static string` | # `jsonCollectionElement( )` Returns the nested keys that could (rarely) prefix collection items. For example: Returns the nested keys that could (rarely) prefix collection items. For example: { "keypairs": [ { "keypair": { "fingerprint": "...", "name": "key1", "public_key": "..." } }, { "keypair": { "fingerprint": "...", "name": "key2", "public_key": "..." } } ] } In the above example, "keypairs" would be the $json_collection_name and "keypair" would be the $json_collection_element #### Returns `string`
`public static` | # `resourceName( )` Returns the URI path for this resource Returns the URI path for this resource #### Throws ``OpenCloud\Common\Exceptions\UrlError``
`public mixed` | # `parseResponse( Guzzle\Http\Message\Response $response )` Parse a HTTP response for the required content Parse a HTTP response for the required content #### Parameters $response `Guzzle\Http\Message\Response` $response #### Returns `mixed`

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

Properties summary
`protected `OpenCloud\Common\Service\ServiceInterface`` | $service | `` | #
`protected `OpenCloud\Common\Resource\BaseResource`` | $parent | `` | #
`protected `OpenCloud\Common\Metadata`` | $metadata | `` | #

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