Overview

Namespaces

  • None
  • OpenCloud
    • Autoscale
      • Resource
    • CloudMonitoring
      • Exception
      • Resource
    • Common
      • Exceptions
      • Log
      • Request
        • Response
    • Compute
    • Database
    • DNS
    • LoadBalancer
      • Resources
    • ObjectStore
      • Resource
    • Orchestration
    • Volume
  • PHP

Classes

  • Base
  • Collection
  • Lang
  • Metadata
  • Nova
  • PersistentObject
  • Service
  • ServiceCatalogItem
  • Overview
  • Namespace
  • Class
  • Tree
  • Download

Class Service

This class defines a cloud service; a relationship between a specific OpenStack and a provided service, represented by a URL in the service catalog.

Because Service is an abstract class, it cannot be called directly. Provider services such as Rackspace Cloud Servers or OpenStack Swift are each subclassed from Service.

OpenCloud\Common\Base
Extended by OpenCloud\Common\Service

Direct known subclasses

OpenCloud\Autoscale\Service, OpenCloud\CloudMonitoring\Service, OpenCloud\Common\Nova, OpenCloud\DNS\Service, OpenCloud\ObjectStore\AbstractService, OpenCloud\Orchestration\Service

Indirect known subclasses

OpenCloud\Compute\Service, OpenCloud\Database\Service, OpenCloud\LoadBalancer\Service, OpenCloud\ObjectStore\CDNService, OpenCloud\ObjectStore\Service, OpenCloud\Volume\Service
Abstract
Namespace: OpenCloud\Common
Author: Glen Campbell <glen.campbell@rackspace.com>
Located at OpenCloud/Common/Service.php
Methods summary
public
# __construct( OpenCloud\OpenStack $conn, string $type, string $name, string $region, string $urltype = RAXSDK_URL_PUBLIC, mixed $customServiceUrl = null )

Creates a service on the specified connection

Creates a service on the specified connection

Usage: $x = new Service($conn, $type, $name, $region, $urltype); The service's URL is defined in the OpenStack's serviceCatalog; it uses the $type, $name, $region, and $urltype to find the proper URL and set it. If it cannot find a URL in the service catalog that matches the criteria, then an exception is thrown.

Parameters

$conn
OpenCloud\OpenStack
$conn - a Connection object
$type
string
$type - the service type (e.g., "compute")
$name
string
$name - the service name (e.g., "cloudServersOpenStack")
$region
string
$region - the region (e.g., "ORD")
$urltype
string
$urltype - the specified URL from the catalog (e.g., "publicURL")
$customServiceUrl
public
# setConnection( type $connection )

Set this service's connection.

Set this service's connection.

Parameters

$connection
type
$connection
public type
# getConnection( )

Get this service's connection.

Get this service's connection.

Returns

type
public string
# url( string $resource = '', array $param = array() )

Returns the URL for the Service

Returns the URL for the Service

Parameters

$resource
string
$resource optional sub-resource
$param
array
$query optional k/v pairs for query strings

Returns

string

Throws

UrlError

Overrides

OpenCloud\Common\Base::url()
public array
# extensions( )

Returns the /extensions for the service

Returns the /extensions for the service

Returns

array
of objects

Api

public array
# limits( )

Returns the /limits for the service

Returns the /limits for the service

Returns

array
of limits

Api

public OpenCloud\HttpResult
# request( string $url, string $method = 'GET', array $headers = array(), string $body = null )

Performs an authenticated request

Performs an authenticated request

This method handles the addition of authentication headers to each request. It always adds the X-Auth-Token: header and will add the X-Auth-Project-Id: header if there is a tenant defined on the connection.

Parameters

$url
string
$url The URL of the request
$method
string
$method The HTTP method (defaults to "GET")
$headers
array
$headers An associative array of headers
$body
string
$body An optional body for POST/PUT requests

Returns

OpenCloud\HttpResult
public OpenCloud\Common\Collection
# collection( string $class, string $url = null, mixed $parent = null )

returns a collection of objects

returns a collection of objects

Parameters

$class
string
$class the class of objects to fetch
$url
string
$url (optional) the URL to retrieve
$parent
mixed
$parent (optional) the parent service/object

Returns

OpenCloud\Common\Collection
public string
# region( )

returns the Region associated with the service

returns the Region associated with the service

Returns

string

Api

public string
# name( )

returns the serviceName associated with the service

returns the serviceName associated with the service

This is used by DNS for PTR record lookups

Returns

string

Api

public array
# namespaces( )

Returns a list of supported namespaces

Returns a list of supported namespaces

Returns

array
public
# getResources( )

Get all associated resources for this service.

Get all associated resources for this service.

protected type
# getCurrentNamespace( )

Internal method for accessing child namespace from parent scope.

Internal method for accessing child namespace from parent scope.

Returns

type
protected string
# resolveResourceClass( string $resourceName )

Resolves fully-qualified classname for associated local resource.

Resolves fully-qualified classname for associated local resource.

Parameters

$resourceName
string
$resourceName

Returns

string
public object
# resource( string $resourceName, mixed $info = null )

Factory method for instantiating resource objects.

Factory method for instantiating resource objects.

Parameters

$resourceName
string
$resourceName
$info
mixed
$info (default: null)

Returns

object
public OpenCloud\Common\Collection
# resourceList( string $resourceName, string|null $url = null, mixed $service = null )

Factory method for instantiate a resource collection.

Factory method for instantiate a resource collection.

Parameters

$resourceName
string
$resourceName
$url
string|null
$url
$service

Returns

OpenCloud\Common\Collection
Methods inherited from OpenCloud\Common\Base
__set(), checkJsonError(), getHttpRequestObject(), getLogger(), makeQueryString(), populate(), setLogger(), setProperty()
Properties summary
protected mixed $conn
#
protected array $_namespaces array()
#
PHP OpenCloud API API documentation generated by ApiGen 2.8.0