OpenCloud/Common/Service.php

Properties

Description

An abstraction that defines a cloud service

Classes

Service

Properties

 
 
Yes 
No 

Description

This class defines a "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.

Methods

Collection, Connection, Extensions, GetMetaUrl, Limits, Name, Region, Request, Url, __construct, get_endpoint, namespaces,

Collection( string   $class, string   $url = null, mixed   $parent = null, array   $parm = array(), ) : \OpenCloud\Collection

Description

returns a collection of objects

Arguments

Name Type Description Default
$class string

the class of objects to fetch

$url string

(optional) the URL to retrieve

null
$parent mixed

(optional) the parent service/object

null
$parm array

(optional) array of key/value pairs to use as query strings

array()

Return value

Type Description
\OpenCloud\Collection

Connection( ) : \OpenCloud\Common\OpenCloud\OpenStack

Description

Returns the connection used to create the Service.

Return value

Type Description
\OpenCloud\Common\OpenCloud\OpenStack

Extensions( ) : array

Description

Returns the /extensions for the service

Return value

Type Description
array of objects

Tags

Name Description
api

GetMetaUrl( string   $resource, ) : \stdClass

Description

Constructs a specified URL from the subresource
Given a subresource (e.g., "extensions"), this constructs the proper URL and retrieves the resource.

Arguments

Name Type Description Default
$resource string

The resource requested; should NOT have slashes at the beginning or end

Return value

Type Description
\stdClass object

Limits( ) : array

Description

Returns the /limits for the service

Return value

Type Description
array of limits

Tags

Name Description
api

Name( ) : string

Description

returns the serviceName associated with the service
This is used by DNS for PTR record lookups

Return value

Type Description
string

Tags

Name Description
api

Region( ) : string

Description

returns the Region associated with the service

Return value

Type Description
string

Tags

Name Description
api

Request( string   $url, string   $method = 'GET', array   $headers = array(), string   $body = null, ) : \OpenCloud\HttpResult

Description

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.

Arguments

Name Type Description Default
$url string

The URL of the request

$method string

The HTTP method (defaults to "GET")

'GET'
$headers array

An associative array of headers

array()
$body string

An optional body for POST/PUT requests

null

Return value

Type Description
\OpenCloud\HttpResult

Url( string   $resource = '',   $param = array(), ) : string

Description

Returns the URL for the Service

Arguments

Name Type Description Default
$resource string

optional sub-resource

''
$param n/a array()

Return value

Type Description
string

__construct( \OpenCloud\OpenStack   $conn, string   $type, string   $name, string   $region, string   $urltype = RAXSDK_URL_PUBLIC, ) : n/a

Description

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.

Arguments

Name Type Description Default
$conn \OpenCloud\OpenStack
  • a Connection object
$type string
  • the service type (e.g., "compute")
$name string
  • the service name (e.g., "cloudServersOpenStack")
$region string
  • the region (e.g., "ORD")
$urltype string
  • the specified URL from the catalog (e.g., "publicURL")
RAXSDK_URL_PUBLIC

Return value

Type Description
n/a n/a

get_endpoint( string   $type, string   $name, string   $region, string   $urltype = 'publicURL', ) : string

Description

Given a service type, name, and region, return the url
This function ensures that services are represented by an entry in the service catalog, and NOT by an arbitrarily-constructed URL. Note that it will always return the first match found in the service catalog (there *should* be only one, but you never know...)

Arguments

Name Type Description Default
$type string

The OpenStack service type ("compute" or "object-store", for example

$name string

The name of the service in the service catlog

$region string

The region of the service

$urltype string

The URL type; defaults to "publicURL"

'publicURL'

Return value

Type Description
string The URL of the service

namespaces( ) : array

Description

Returns a list of supported namespaces

Return value

Type Description
array

Properties

$_namespaces, $conn, $service_name, $service_region, $service_type, $service_url,

  protected  $_namespaces = array()




  protected  $conn =




  private  $service_name =




  private  $service_region =




  private  $service_type =




  private  $service_url =




Documentation was generated by phpDocumentor 2.0.0b6 .

Namespaces

Packages