Add upstream

This commit is contained in:
root
2019-10-24 00:12:05 +02:00
parent 85d41e4216
commit ac980f592c
3504 changed files with 1049983 additions and 29971 deletions

View File

@@ -0,0 +1,73 @@
Contributing to php-opencloud
-----------------------------
Welcome! If you'd like to work on php-opencloud, we appreciate your
efforts. Here are a few general guidelines to follow:
1. Use the `working` branch for your pull requests. Except in the case of
an emergency hotfix, we will only update `master` with official releases.
2. All code needs to come with unit tests. If you're introducing new code, you
will need to write new test cases; if you're updating existing code, you will
need to make sure the methods you're updating are still completely covered.
3. Please abide by [PSR-2 code styling](#ensuring-psr-2-coding-style-compliance).
4. Explaining your pull requests is appreciated. Unless you're fixing a
minor typographical error, create a description which explains your changes
and, where relevant, references the existing issue you're hoping to fix.
5. If your pull request introduces a large change or addition, please consider
creating a work-in-progress (WIP) pull request. This lets us review your changes
and provide feedback early and often rather than all at once when the entire pull
request is ready. To denote a pull request as WIP, simply add the "PR: Work In Progress"
label to it. When you are finished with your work in the pull request and
are ready for a final review and merge, please remove the "PR: Work In Progress"
label.
6. Document your code!
If you submit code, please add your name and email address to the
CONTRIBUTORS file.
Test Instructions
-----------------
### To run unit tests:
```bash
vendor/bin/phpunit
```
### To run the full suite of acceptance tests:
1. Make sure your [variables-order](http://www.php.net/manual/en/ini.core.php#ini.variables-order) is set to "EGCRS"
2. Set your *PHP_OpenCloud_USERNAME* and *PHP_OpenCloud_API_KEY* variables
3. Run: ```php tests/OpenCloud/Smoke/Runner.php```
## Conventions
* When working on a `Service` class (e.g. [`OpenCloud\Image\Service`](/lib/OpenCloud/Image/Service.php), name methods like so:
* Methods that return a single resource, say `Foo`, should be named `getFoo`. For example, [`getImage`](/lib/OpenCloud/Image/Service.php#L67).
* Methods that return a collection of resources, say `Foo`, should be named `listFoos`. For example, [`listImages`](/lib/OpenCloud/Image/Service.php#L53).
* Methods that create a new resource, say `Foo`, should be named `createFoo`. For example, [`createEntity`](/lib/OpenCloud/CloudMonitoring/Service.php#L105).
* When validating arguments to a method, please throw `\InvalidArgumentException` when an invalid argument is found. For example, see [here](/lib/OpenCloud/LoadBalancer/Resource/LoadBalancer.php#L212-L215).
## Ensuring PSR-2 coding style compliance
The code in this library is compliant with the [PSR-2 Coding Style Guide](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md). To ensure that any code you contribute is also PSR-2 compliant, please run the following command from the base directory of this project _before_ submitting your contribution:
$ vendor/bin/php-cs-fixer fix --level psr2 .
Running this command will _change_ your code to become PSR-2 compliant. You will need to _commit_ these changes and make them part of your pull request.
## Releasing a new version of php-opencloud
If you are a core contributor to php-opencloud, you have the power to release new versions of it. Here are the steps to follow to ensure a proper release:
1. Update the value of the the [`VERSION` constant](/lib/OpenCloud/Version.php#L30).
2. Merge the `working` branch into the `master` branch.
3. [Run the smoke tests](#to-run-the-full-suite-of-acceptance-tests). If they fail, make necessary changes and go to step 2.
4. [Create new release notes](https://github.com/rackspace/php-opencloud/releases/new).
5. Publish release notes.
6. Announce release via appropriate channels.
7. Party :tada: :balloon:

View File

@@ -0,0 +1,16 @@
Copyright 2012-2013 Rackspace US, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
All contributions to this repository are covered under the same license,
terms, and conditions.

View File

@@ -0,0 +1,73 @@
**php-opencloud**
=============
PHP SDK for OpenStack/Rackspace APIs
[![Latest Stable Version](https://poser.pugx.org/rackspace/php-opencloud/v/stable.png)](https://packagist.org/packages/rackspace/php-opencloud) [![Travis CI](https://secure.travis-ci.org/rackspace/php-opencloud.png)](https://travis-ci.org/rackspace/php-opencloud) [![Total Downloads](https://poser.pugx.org/rackspace/php-opencloud/downloads.png)](https://packagist.org/packages/rackspace/php-opencloud)
For SDKs in different languages, see http://developer.rackspace.com.
The PHP SDK should work with most OpenStack-based cloud deployments,
though it specifically targets the Rackspace public cloud. In
general, whenever a Rackspace deployment is substantially different
than a pure OpenStack one, a separate Rackspace subclass is provided
so that you can still use the SDK with a pure OpenStack instance
(for example, see the `OpenStack` class (for OpenStack) and the
`Rackspace` subclass).
Requirements
------------
* PHP >=5.3.3
* cURL extension for PHP
Installation
------------
You must install this library through Composer:
```bash
# Install Composer
curl -sS https://getcomposer.org/installer | php
# Require php-opencloud as a dependency
php composer.phar require rackspace/php-opencloud
```
Once you have installed the library, you will need to load Composer's autoloader (which registers all the required
namespaces). To do this, place the following line of PHP code at the top of your application's PHP files:
```php
require 'vendor/autoload.php';
```
**Note**: this assumes your application's PHP files are located in the same folder as `vendor/`. If your files are located
elsewhere, please supply the path to `vendor/autoload.php` in the `require` statement above.
And you're ready to go!
You can also check out the [Getting Started guide](docs/getting-started.md) for a quick tutorial.
- - -
Alternatively, if you would like to fork or clone the repository into a directory (to work and submit pull requests),
you will need to execute:
```bash
php composer.phar install
```
Instead of the `require` command. You can also specify the `--no-dev` option if you do not want to install phpDocumentor
(which has lots of vendor folders).
Support and Feedback
--------------------
Your feedback is appreciated! If you have specific problems or bugs with this SDK, please file an issue on Github. We
also have a [mailing list](https://groups.google.com/forum/#!forum/php-opencloud), so feel free to join to keep up to
date with all the latest changes and announcements to the library.
For general feedback and support requests, contact us at https://developer.rackspace.com/support/
You can also find assistance via IRC on #rackspace at freenode.net.
Contributing
------------
If you'd like to contribute to the project, or require help running the unit/acceptance tests, please view the
[contributing guidelines](https://github.com/rackspace/php-opencloud/blob/master/CONTRIBUTING.md).

View File

@@ -0,0 +1,3 @@
templateTheme: bootstrap
accessLevels: [public]

View File

@@ -0,0 +1,40 @@
{
"name": "rackspace/php-opencloud",
"description": "PHP SDK for Rackspace/OpenStack APIs",
"keywords": ["rackspace", "openstack", "opencloud", "swift", "nova"],
"type": "library",
"license": "Apache-2.0",
"authors": [
{
"name": "Jamie Hannaford",
"email": "jamie.hannaford@rackspace.com",
"homepage" : "https://github.com/jamiehannaford"
},
{
"name": "Glen Campbell",
"email": "glen.campbell@rackspace.com"
},
{
"name": "Shaunak Kashyap",
"email": "shaunak.kashyap@rackspace.com",
"homepage": "https://github.com/ycombinator"
}
],
"autoload": {
"psr-0": {
"OpenCloud": ["lib/", "tests/"]
}
},
"require": {
"php" : ">=5.3.3",
"guzzle/guzzle" : "~3.8",
"psr/log": "~1.0"
},
"require-dev" : {
"phpunit/phpunit": "4.3.*",
"satooshi/php-coveralls": "0.6.*@dev",
"jakub-onderka/php-parallel-lint": "0.*",
"fabpot/php-cs-fixer": "1.0.*@dev",
"apigen/apigen": "~2.8"
}
}

View File

@@ -0,0 +1,60 @@
<?php
namespace OpenCloud\Common;
class ArrayAccess implements \ArrayAccess
{
protected $elements;
public function __construct($data = array())
{
$this->elements = (array) $data;
}
/**
* Sets a value to a particular offset.
*
* @param mixed $offset
* @param mixed $value
*/
public function offsetSet($offset, $value)
{
if ($offset === null) {
$this->elements[] = $value;
} else {
$this->elements[$offset] = $value;
}
}
/**
* Checks to see whether a particular offset key exists.
*
* @param mixed $offset
* @return bool
*/
public function offsetExists($offset)
{
return array_key_exists($offset, $this->elements);
}
/**
* Unset a particular key.
*
* @param mixed $offset
*/
public function offsetUnset($offset)
{
unset($this->elements[$offset]);
}
/**
* Get the value for a particular offset key.
*
* @param mixed $offset
* @return mixed|null
*/
public function offsetGet($offset)
{
return $this->offsetExists($offset) ? $this->elements[$offset] : null;
}
}

View File

@@ -0,0 +1,430 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common;
use OpenCloud\Common\Collection\ResourceIterator;
use OpenCloud\Common\Constants\Header as HeaderConst;
use OpenCloud\Common\Constants\Mime as MimeConst;
use OpenCloud\Common\Exceptions\JsonError;
use Psr\Log\LoggerInterface;
/**
* 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.
*/
abstract class Base
{
/**
* Holds all the properties added by overloading.
*
* @var array
*/
private $properties = array();
/**
* The logger instance
*
* @var LoggerInterface
*/
private $logger;
/**
* The aliases configure for the properties of the instance.
*
* @var array
*/
protected $aliases = array();
/**
* @return static
*/
public static function getInstance()
{
return new static();
}
/**
* Intercept non-existent method calls for dynamic getter/setter functionality.
*
* @param $method
* @param $args
* @throws Exceptions\RuntimeException
*/
public function __call($method, $args)
{
$prefix = substr($method, 0, 3);
// Get property - convert from camel case to underscore
$property = lcfirst(substr($method, 3));
// Only do these methods on properties which exist
if ($this->propertyExists($property) && $prefix == 'get') {
return $this->getProperty($property);
}
// Do setter
if ($this->propertyExists($property) && $prefix == 'set') {
return $this->setProperty($property, $args[0]);
}
throw new Exceptions\RuntimeException(sprintf(
'No method %s::%s()',
get_class($this),
$method
));
}
/**
* We can set a property under three conditions:
*
* 1. If it has a concrete setter: setProperty()
* 2. If the property exists
* 3. If the property name's prefix is in an approved list
*
* @param mixed $property
* @param mixed $value
* @return mixed
*/
protected function setProperty($property, $value)
{
$setter = 'set' . $this->toCamel($property);
if (method_exists($this, $setter)) {
return call_user_func(array($this, $setter), $value);
} elseif (false !== ($propertyVal = $this->propertyExists($property))) {
// Are we setting a public or private property?
if ($this->isAccessible($propertyVal)) {
$this->$propertyVal = $value;
} else {
$this->properties[$propertyVal] = $value;
}
return $this;
} else {
$this->getLogger()->warning(
'Attempted to set {property} with value {value}, but the'
. ' property has not been defined. Please define first.',
array(
'property' => $property,
'value' => print_r($value, true)
)
);
}
}
/**
* Basic check to see whether property exists.
*
* @param string $property The property name being investigated.
* @param bool $allowRetry If set to TRUE, the check will try to format the name in underscores because
* there are sometimes discrepancies between camelCaseNames and underscore_names.
* @return bool
*/
protected function propertyExists($property, $allowRetry = true)
{
if (!property_exists($this, $property) && !$this->checkAttributePrefix($property)) {
// Convert to under_score and retry
if ($allowRetry) {
return $this->propertyExists($this->toUnderscores($property), false);
} else {
$property = false;
}
}
return $property;
}
/**
* Convert a string to camelCase format.
*
* @param $string
* @param bool $capitalise Optional flag which allows for word capitalization.
* @return mixed
*/
public function toCamel($string, $capitalise = true)
{
if ($capitalise) {
$string = ucfirst($string);
}
return preg_replace_callback('/_([a-z])/', function ($char) {
return strtoupper($char[1]);
}, $string);
}
/**
* Convert string to underscore format.
*
* @param $string
* @return mixed
*/
public function toUnderscores($string)
{
$string = lcfirst($string);
return preg_replace_callback('/([A-Z])/', function ($char) {
return "_" . strtolower($char[1]);
}, $string);
}
/**
* Does the property exist in the object variable list (i.e. does it have public or protected visibility?)
*
* @param $property
* @return bool
*/
private function isAccessible($property)
{
return array_key_exists($property, get_object_vars($this));
}
/**
* Checks the attribute $property and only permits it if the prefix is
* in the specified $prefixes array
*
* This is to support extension namespaces in some services.
*
* @param string $property the name of the attribute
* @return boolean
*/
private function checkAttributePrefix($property)
{
if (!method_exists($this, 'getService')) {
return false;
}
$prefix = strstr($property, ':', true);
return in_array($prefix, $this->getService()->namespaces());
}
/**
* Grab value out of the data array.
*
* @param string $property
* @return mixed
*/
protected function getProperty($property)
{
if (array_key_exists($property, $this->properties)) {
return $this->properties[$property];
} elseif (array_key_exists($this->toUnderscores($property), $this->properties)) {
return $this->properties[$this->toUnderscores($property)];
} elseif (method_exists($this, 'get' . ucfirst($property))) {
return call_user_func(array($this, 'get' . ucfirst($property)));
} elseif (false !== ($propertyVal = $this->propertyExists($property)) && $this->isAccessible($propertyVal)) {
return $this->$propertyVal;
}
return null;
}
/**
* Sets the logger.
*
* @param LoggerInterface $logger
*
* @return $this
*/
public function setLogger(LoggerInterface $logger = null)
{
$this->logger = $logger;
return $this;
}
/**
* Returns the Logger object.
*
* @return LoggerInterface
*/
public function getLogger()
{
if (null === $this->logger) {
$this->setLogger(new Log\Logger);
}
return $this->logger;
}
/**
* @return bool
*/
public function hasLogger()
{
return (null !== $this->logger);
}
/**
* @deprecated
*/
public function url($path = null, array $query = array())
{
return $this->getUrl($path, $query);
}
/**
* Populates the current object based on an unknown data type.
*
* @param mixed $info
* @param bool
* @throws Exceptions\InvalidArgumentError
*/
public function populate($info, $setObjects = true)
{
if (is_string($info) || is_integer($info)) {
$this->setProperty($this->primaryKeyField(), $info);
$this->refresh($info);
} elseif (is_object($info) || is_array($info)) {
foreach ($info as $key => $value) {
if ($key == 'metadata' || $key == 'meta') {
// Try retrieving existing value
if (null === ($metadata = $this->getProperty($key))) {
// If none exists, create new object
$metadata = new Metadata;
}
// Set values for metadata
$metadata->setArray($value);
// Set object property
$this->setProperty($key, $metadata);
} elseif (!empty($this->associatedResources[$key]) && $setObjects === true) {
// Associated resource
try {
$resource = $this->getService()->resource($this->associatedResources[$key], $value);
$resource->setParent($this);
$this->setProperty($key, $resource);
} catch (Exception\ServiceException $e) {
}
} elseif (!empty($this->associatedCollections[$key]) && $setObjects === true) {
// Associated collection
try {
$className = $this->associatedCollections[$key];
$options = $this->makeResourceIteratorOptions($className);
$iterator = ResourceIterator::factory($this, $options, $value);
$this->setProperty($key, $iterator);
} catch (Exception\ServiceException $e) {
}
} elseif (!empty($this->aliases[$key])) {
// Sometimes we might want to preserve camelCase
// or covert `rax-bandwidth:bandwidth` to `raxBandwidth`
$this->setProperty($this->aliases[$key], $value);
} else {
// Normal key/value pair
$this->setProperty($key, $value);
}
}
} elseif (null !== $info) {
throw new Exceptions\InvalidArgumentError(sprintf(
Lang::translate('Argument for [%s] must be string or object'),
get_class()
));
}
}
/**
* Checks the most recent JSON operation for errors.
*
* @throws Exceptions\JsonError
* @codeCoverageIgnore
*/
public static function checkJsonError()
{
switch (json_last_error()) {
case JSON_ERROR_NONE:
return;
case JSON_ERROR_DEPTH:
$jsonError = 'JSON error: The maximum stack depth has been exceeded';
break;
case JSON_ERROR_STATE_MISMATCH:
$jsonError = 'JSON error: Invalid or malformed JSON';
break;
case JSON_ERROR_CTRL_CHAR:
$jsonError = 'JSON error: Control character error, possibly incorrectly encoded';
break;
case JSON_ERROR_SYNTAX:
$jsonError = 'JSON error: Syntax error';
break;
case JSON_ERROR_UTF8:
$jsonError = 'JSON error: Malformed UTF-8 characters, possibly incorrectly encoded';
break;
default:
$jsonError = 'Unexpected JSON error';
break;
}
if (isset($jsonError)) {
throw new JsonError(Lang::translate($jsonError));
}
}
public static function generateUuid()
{
return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
// 32 bits for "time_low"
mt_rand(0, 0xffff), mt_rand(0, 0xffff),
// 16 bits for "time_mid"
mt_rand(0, 0xffff),
// 16 bits for "time_hi_and_version",
// four most significant bits holds version number 4
mt_rand(0, 0x0fff) | 0x4000,
// 16 bits, 8 bits for "clk_seq_hi_res",
// 8 bits for "clk_seq_low",
// two most significant bits holds zero and one for variant DCE1.1
mt_rand(0, 0x3fff) | 0x8000,
// 48 bits for "node"
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)
);
}
public function makeResourceIteratorOptions($resource)
{
$options = array('resourceClass' => $this->stripNamespace($resource));
if (method_exists($resource, 'jsonCollectionName')) {
$options['key.collection'] = $resource::jsonCollectionName();
}
if (method_exists($resource, 'jsonCollectionElement')) {
$options['key.collectionElement'] = $resource::jsonCollectionElement();
}
return $options;
}
public function stripNamespace($namespace)
{
$array = explode('\\', $namespace);
return end($array);
}
protected static function getJsonHeader()
{
return array(HeaderConst::CONTENT_TYPE => MimeConst::JSON);
}
}

View File

@@ -0,0 +1,423 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common;
use OpenCloud\Common\Log\Logger;
/**
* @deprecated
* @codeCoverageIgnore
*/
class Collection extends Base
{
private $service;
private $itemClass;
private $itemList = array();
private $pointer = 0;
private $sortKey;
private $nextPageClass;
private $nextPageCallback;
private $nextPageUrl;
/**
* A Collection is an array of objects
*
* Some assumptions:
* * The `Collection` class assumes that there exists on its service
* a factory method with the same name of the class. For example, if
* you create a Collection of class `Foobar`, it will attempt to call
* the method `parent::Foobar()` to create instances of that class.
* * It assumes that the factory method can take an array of values, and
* it passes that to the method.
*
* @param Service $service - the service associated with the collection
* @param string $itemclass - the Class of each item in the collection
* (assumed to be the name of the factory method)
* @param array $arr - the input array
*/
public function __construct($service, $class, array $array = array())
{
$service->getLogger()->warning(Logger::deprecated(__METHOD__, 'OpenCloud\Common\Collection\CollectionBuilder'));
$this->setService($service);
$this->setNextPageClass($class);
// If they've supplied a FQCN, only get the last part
$class = (false !== ($classNamePos = strrpos($class, '\\')))
? substr($class, $classNamePos + 1)
: $class;
$this->setItemClass($class);
// Set data
$this->setItemList($array);
}
/**
* Set the entire data array.
*
* @param array $array
*/
private function setItemList(array $array)
{
$this->itemList = $array;
return $this;
}
/**
* Retrieve the entire data array.
*
* @return array
*/
public function getItemList()
{
return $this->itemList;
}
/**
* Set the service.
*
* @param Service|PersistentObject $service
*/
public function setService($service)
{
$this->service = $service;
return $this;
}
/**
* Retrieves the service associated with the Collection
*
* @return Service
*/
public function getService()
{
return $this->service;
}
/**
* Set the resource class name.
*/
private function setItemClass($itemClass)
{
$this->itemClass = $itemClass;
return $this;
}
/**
* Get item class.
*/
private function getItemClass()
{
return $this->itemClass;
}
/**
* Set the key that will be used for sorting.
*/
private function setSortKey($sortKey)
{
$this->sortKey = $sortKey;
return $this;
}
/**
* Get the key that will be used for sorting.
*/
private function getSortKey()
{
return $this->sortKey;
}
/**
* Set next page class.
*/
private function setNextPageClass($nextPageClass)
{
$this->nextPageClass = $nextPageClass;
return $this;
}
/**
* Get next page class.
*/
private function getNextPageClass()
{
return $this->nextPageClass;
}
/**
* for paginated collection, sets the callback function and URL for
* the next page
*
* The callback function should have the signature:
*
* function Whatever($class, $url, $parent)
*
* and the `$url` should be the URL of the next page of results
*
* @param callable $callback the name of the function (or array of
* object, function name)
* @param string $url the URL of the next page of results
* @return void
*/
public function setNextPageCallback($callback, $url)
{
$this->nextPageCallback = $callback;
$this->nextPageUrl = $url;
return $this;
}
/**
* Get next page callback.
*/
private function getNextPageCallback()
{
return $this->nextPageCallback;
}
/**
* Get next page URL.
*/
private function getNextPageUrl()
{
return $this->nextPageUrl;
}
/**
* Returns the number of items in the collection
*
* For most services, this is the total number of items. If the Collection
* is paginated, however, this only returns the count of items in the
* current page of data.
*
* @return int
*/
public function count()
{
return count($this->getItemList());
}
/**
* Pseudonym for count()
*
* @codeCoverageIgnore
*/
public function size()
{
return $this->count();
}
/**
* Resets the pointer to the beginning, but does NOT return the first item
*
* @api
* @return void
*/
public function reset()
{
$this->pointer = 0;
}
/**
* Resets the collection pointer back to the first item in the page
* and returns it
*
* This is useful if you're only interested in the first item in the page.
*
* @api
* @return Base the first item in the set
*/
public function first()
{
$this->reset();
return $this->next();
}
/**
* Return the item at a particular point of the array.
*
* @param mixed $offset
* @return mixed
*/
public function getItem($pointer)
{
return (isset($this->itemList[$pointer])) ? $this->itemList[$pointer] : false;
}
/**
* Add an item to this collection
*
* @param mixed $item
*/
public function addItem($item)
{
$this->itemList[] = $item;
}
/**
* Returns the next item in the page
*
* @api
* @return Base the next item or FALSE if at the end of the page
*/
public function next()
{
if ($this->pointer >= $this->count()) {
return false;
}
$data = $this->getItem($this->pointer++);
$class = $this->getItemClass();
// Are there specific methods in the parent/service that can be used to
// instantiate the resource? Currently supported: getResource(), resource()
foreach (array($class, 'get' . ucfirst($class)) as $method) {
if (method_exists($this->service, $method)) {
return call_user_func(array($this->service, $method), $data);
}
}
// Backup method
if (method_exists($this->service, 'resource')) {
return $this->service->resource($class, $data);
}
return false;
}
/**
* sorts the collection on a specified key
*
* Note: only top-level keys can be used as the sort key. Note that this
* only sorts the data in the current page of the Collection (for
* multi-page data).
*
* @api
* @param string $keyname the name of the field to use as the sort key
* @return void
*/
public function sort($keyname = 'id')
{
$this->setSortKey($keyname);
usort($this->itemList, array($this, 'sortCompare'));
}
/**
* selects only specified items from the Collection
*
* This provides a simple form of filtering on Collections. For each item
* in the collection, it calls the callback function, passing it the item.
* If the callback returns `TRUE`, then the item is retained; if it returns
* `FALSE`, then the item is deleted from the collection.
*
* Note that this should not supersede server-side filtering; the
* `Collection::Select()` method requires that *all* of the data for the
* Collection be retrieved from the server before the filtering is
* performed; this can be very inefficient, especially for large data
* sets. This method is mostly useful on smaller-sized sets.
*
* Example:
* <code>
* $services = $connection->ServiceList();
* $services->Select(function ($item) { return $item->region=='ORD';});
* // now the $services Collection only has items from the ORD region
* </code>
*
* `Select()` is *destructive*; that is, it actually removes entries from
* the collection. For example, if you use `Select()` to find items with
* the ID > 10, then use it again to find items that are <= 10, it will
* return an empty list.
*
* @api
* @param callable $testfunc a callback function that is passed each item
* in turn. Note that `Select()` performs an explicit test for
* `FALSE`, so functions like `strpos()` need to be cast into a
* boolean value (and not just return the integer).
* @returns void
* @throws DomainError if callback doesn't return a boolean value
*/
public function select($testfunc)
{
foreach ($this->getItemList() as $index => $item) {
$test = call_user_func($testfunc, $item);
if (!is_bool($test)) {
throw new Exceptions\DomainError(
Lang::translate('Callback function for Collection::Select() did not return boolean')
);
}
if ($test === false) {
unset($this->itemList[$index]);
}
}
}
/**
* returns the Collection object for the next page of results, or
* FALSE if there are no more pages
*
* Generally, the structure for a multi-page collection will look like
* this:
*
* $coll = $obj->Collection();
* do {
* while ($item = $coll->Next()) {
* // do something with the item
* }
* } while ($coll = $coll->NextPage());
*
* @api
* @return Collection if there are more pages of results, otherwise FALSE
*/
public function nextPage()
{
return ($this->getNextPageUrl() !== null)
? call_user_func($this->getNextPageCallback(), $this->getNextPageClass(), $this->getNextPageUrl())
: false;
}
/**
* Compares two values of sort keys
*/
private function sortCompare($a, $b)
{
$key = $this->getSortKey();
// Handle strings
if (is_string($a->$key)) {
return strcmp($a->$key, $b->$key);
}
// Handle others with logical comparisons
if ($a->$key == $b->$key) {
return 0;
} elseif ($a->$key < $b->$key) {
return -1;
} else {
return 1;
}
}
}

View File

@@ -0,0 +1,82 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Collection;
use Countable;
use OpenCloud\Common\ArrayAccess;
/**
* A generic, abstract collection class that allows collections to exhibit array functionality.
*
* @package OpenCloud\Common\Collection
*/
abstract class ArrayCollection extends ArrayAccess implements Countable
{
/**
* @var array The elements being held by this iterator.
*/
protected $elements;
/**
* @param array $data
*/
public function __construct(array $data = array())
{
$this->setElements($data);
}
/**
* @return int
*/
public function count()
{
return count($this->elements);
}
/**
* @param array $data
* @return $this
*/
public function setElements(array $data = array())
{
$this->elements = $data;
return $this;
}
/**
* Appends a value to the container.
*
* @param $value
*/
public function append($value)
{
$this->elements[] = $value;
}
/**
* Checks to see whether a particular value exists.
*
* @param $value
* @return bool
*/
public function valueExists($value)
{
return array_search($value, $this->elements) !== false;
}
}

View File

@@ -0,0 +1,329 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Collection;
use Guzzle\Http\Exception\ClientErrorResponseException;
use Guzzle\Http\Url;
use Iterator;
use OpenCloud\Common\Http\Message\Formatter;
/**
* Class ResourceIterator is tasked with iterating over resource collections - many of which are paginated. Based on
* a base URL, the iterator will append elements based on further requests to the API. Each time this happens,
* query parameters (marker) are updated based on the current value.
*
* @package OpenCloud\Common\Collection
* @since 1.8.0
*/
class PaginatedIterator extends ResourceIterator implements Iterator
{
const MARKER = 'marker';
const LIMIT = 'limit';
/**
* @var string Used for requests which append elements.
*/
protected $currentMarker;
/**
* @var \Guzzle\Http\Url The next URL for pagination
*/
protected $nextUrl;
protected $defaults = array(
// Collection limits
'limit.total' => 10000,
'limit.page' => 100,
// The "links" element key in response
'key.links' => 'links',
// JSON structure
'key.collection' => null,
'key.collectionElement' => null,
// The property used as the marker
'key.marker' => 'name',
// Options for "next page" request
'request.method' => 'GET',
'request.headers' => array(),
'request.body' => null,
'request.curlOptions' => array()
);
protected $required = array('resourceClass', 'baseUrl');
/**
* Basic factory method to easily instantiate a new ResourceIterator.
*
* @param $parent The parent object
* @param array $options Iterator options
* @param array $data Optional data to set initially
* @return static
*/
public static function factory($parent, array $options = array(), array $data = null)
{
$list = new static();
$list->setOptions($list->parseOptions($options))
->setResourceParent($parent)
->rewind();
if ($data) {
$list->setElements($data);
} else {
$list->appendNewCollection();
}
return $list;
}
/**
* @param Url $url
* @return $this
*/
public function setBaseUrl(Url $url)
{
$this->baseUrl = $url;
return $this;
}
public function current()
{
return parent::current();
}
public function key()
{
return parent::key();
}
/**
* {@inheritDoc}
* Also update the current marker.
*/
public function next()
{
if (!$this->valid()) {
return false;
}
$current = $this->current();
$this->position++;
$this->updateMarkerToCurrent();
return $current;
}
/**
* Update the current marker based on the current element. The marker will be based on a particular property of this
* current element, so you must retrieve it first.
*/
public function updateMarkerToCurrent()
{
if (!isset($this->elements[$this->position])) {
return;
}
$element = $this->elements[$this->position];
$this->setMarkerFromElement($element);
}
protected function setMarkerFromElement($element)
{
$key = $this->getOption('key.marker');
if (isset($element->$key)) {
$this->currentMarker = $element->$key;
}
}
/**
* {@inheritDoc}
* Also reset current marker.
*/
public function rewind()
{
parent::rewind();
$this->currentMarker = null;
}
public function valid()
{
$totalLimit = $this->getOption('limit.total');
if ($totalLimit !== false && $this->position >= $totalLimit) {
return false;
} elseif (isset($this->elements[$this->position])) {
return true;
} elseif ($this->shouldAppend() === true) {
$before = $this->count();
$this->appendNewCollection();
return ($this->count() > $before) ? true : false;
}
return false;
}
protected function shouldAppend()
{
return $this->currentMarker && (
$this->nextUrl ||
$this->position % $this->getOption('limit.page') == 0
);
}
/**
* Append an array of standard objects to the current collection.
*
* @param array $elements
* @return $this
*/
public function appendElements(array $elements)
{
$this->elements = array_merge($this->elements, $elements);
return $this;
}
/**
* Retrieve a new page of elements from the API (based on a new request), parse its response, and append them to the
* collection.
*
* @return $this|bool
*/
public function appendNewCollection()
{
$request = $this->resourceParent
->getClient()
->createRequest(
$this->getOption('request.method'),
$this->constructNextUrl(),
$this->getOption('request.headers'),
$this->getOption('request.body'),
$this->getOption('request.curlOptions')
);
try {
$response = $request->send();
} catch (ClientErrorResponseException $e) {
return false;
}
if (!($body = Formatter::decode($response)) || $response->getStatusCode() == 204) {
return false;
}
$this->nextUrl = $this->extractNextLink($body);
return $this->appendElements($this->parseResponseBody($body));
}
/**
* Based on the response body, extract the explicitly set "link" value if provided.
*
* @param $body
* @return bool
*/
public function extractNextLink($body)
{
$key = $this->getOption('key.links');
$value = null;
if (isset($body->$key)) {
foreach ($body->$key as $link) {
if (isset($link->rel) && $link->rel == 'next') {
$value = $link->href;
break;
}
}
}
return $value;
}
/**
* Make the next page URL.
*
* @return Url|string
*/
public function constructNextUrl()
{
if (!$url = $this->nextUrl) {
$url = clone $this->getOption('baseUrl');
$query = $url->getQuery();
if (isset($this->currentMarker)) {
$query[static::MARKER] = $this->currentMarker;
}
if (($limit = $this->getOption('limit.page')) && !$query->hasKey(static::LIMIT)) {
$query[static::LIMIT] = $limit;
}
$url->setQuery($query);
}
return $url;
}
/**
* Based on the response from the API, parse it for the data we need (i.e. an meaningful array of elements).
*
* @param $body
* @return array
*/
public function parseResponseBody($body)
{
$collectionKey = $this->getOption('key.collection');
$data = array();
if (is_array($body)) {
$data = $body;
} elseif (isset($body->$collectionKey)) {
if (null !== ($elementKey = $this->getOption('key.collectionElement'))) {
// The object has element levels which need to be iterated over
foreach ($body->$collectionKey as $item) {
$subValues = $item->$elementKey;
unset($item->$elementKey);
$data[] = array_merge((array) $item, (array) $subValues);
}
} else {
// The object has a top-level collection name only
$data = $body->$collectionKey;
}
}
return $data;
}
/**
* Walk the entire collection, populating everything.
*/
public function populateAll()
{
while ($this->valid()) {
$this->next();
}
}
}

View File

@@ -0,0 +1,256 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Collection;
use Iterator;
use OpenCloud\Common\Exceptions\InvalidArgumentError;
use OpenCloud\Common\Log\Logger;
class ResourceIterator extends ArrayCollection implements Iterator
{
/**
* @var int Internal pointer of the iterator - reveals its current position.
*/
protected $position;
/**
* @var object The parent object which resource models are instantiated from. The parent needs to have appropriate
* methods to instantiate the particular object.
*/
protected $resourceParent;
/**
* @var array The options for this iterator.
*/
protected $options;
/**
* @var array Fallback defaults if options are not explicitly set or provided.
*/
protected $defaults = array('limit.total' => 1000);
/**
* @var array Required options
*/
protected $required = array();
public static function factory($parent, array $options = array(), array $data = array())
{
$iterator = new static($data);
$iterator->setResourceParent($parent)
->setElements($data)
->setOptions($iterator->parseOptions($options))
->rewind();
return $iterator;
}
protected function parseOptions(array $options)
{
$options = $options + $this->defaults;
if ($missing = array_diff($this->required, array_keys($options))) {
throw new InvalidArgumentError(sprintf('%s is a required option', implode(',', $missing)));
}
return $options;
}
/**
* @param $parent
* @return $this
*/
public function setResourceParent($parent)
{
$this->resourceParent = $parent;
return $this;
}
/**
* @param array $options
* @return $this
*/
public function setOptions(array $options)
{
$this->options = $options;
return $this;
}
/**
* @return array Options for the resource iterator.
*/
public function getOptions()
{
return $this->options;
}
/**
* Set a particular option.
*
* @param $key
* @param $value
* @return $this
*/
public function setOption($key, $value)
{
$this->options[$key] = $value;
return $this;
}
/**
* @param $key
* @return null
*/
public function getOption($key)
{
return (isset($this->options[$key])) ? $this->options[$key] : null;
}
/**
* This method is called after self::rewind() and self::next() to check if the current position is valid.
*
* @return bool
*/
public function valid()
{
return $this->offsetExists($this->position) && $this->position < $this->getOption('limit.total');
}
/**
* Increment the current pointer by 1, and also update the current marker.
*/
public function next()
{
$this->position++;
return $this->current();
}
/**
* Reset the pointer and current marker.
*/
public function rewind()
{
$this->position = 0;
}
/**
* @return mixed
*/
public function current()
{
return $this->constructResource($this->currentElement());
}
/**
* @return mixed
*/
public function currentElement()
{
return $this->offsetGet($this->key());
}
/**
* Using a standard object, this method populates a resource model with all the object data. It does this using a
* whatever method the parent object has for resource creation.
*
* @param $object Standard object
* @return mixed
* @throws \OpenCloud\Common\Exceptions\CollectionException
*/
public function constructResource($object)
{
$className = $this->getOption('resourceClass');
if (substr_count($className, '\\')) {
$array = explode('\\', $className);
$className = end($array);
}
$parent = $this->resourceParent;
$getter = sprintf('get%s', ucfirst($className));
if (method_exists($parent, $className)) {
// $parent->server($data)
return call_user_func(array($parent, $className), $object);
} elseif (method_exists($parent, $getter)) {
// $parent->getServer($data)
return call_user_func(array($parent, $getter), $object);
} elseif (method_exists($parent, 'resource')) {
// $parent->resource('Server', $data)
return $parent->resource($className, $object);
} else {
return $object;
}
}
/**
* Return the current position/internal pointer.
*
* @return int|mixed
*/
public function key()
{
return $this->position;
}
public function getElement($offset)
{
return (!$this->offsetExists($offset)) ? false : $this->constructResource($this->offsetGet($offset));
}
/**
* @deprecated
*/
public function first()
{
Logger::newInstance()->warning(Logger::deprecated(__METHOD__, 'getElement'));
return $this->getElement(0);
}
/**
* @todo Implement
*/
public function sort()
{
}
public function search($callback)
{
$return = false;
if (!is_callable($callback)) {
throw new InvalidArgumentError('The provided argument must be a valid callback');
}
foreach ($this->elements as $element) {
$resource = $this->constructResource($element);
if (call_user_func($callback, $resource) === true) {
$return = $resource;
break;
}
}
return $return;
}
}

View File

@@ -0,0 +1,38 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Constants;
class Datetime
{
/**
* Values in s.
*/
const SECOND = 1;
const MINUTE = 60;
const HOUR = 3600;
const DAY = 86400;
/**
* Values in ms.
*/
const MILLISECOND = 1;
const SECOND_M = 1000;
const MINUTE_M = 60000;
const HOUR_M = 3600000;
const DAY_M = 86400000;
}

View File

@@ -0,0 +1,73 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Constants;
/**
* Standard Header Field names as defined in RFC2616.
*
* @link http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
* @package OpenCloud\Common\Constants
*/
class Header
{
const ACCEPT = 'Accept';
const ACCEPT_CHARSET = 'Accept-Charset';
const ACCEPT_ENCODING = 'Accept-Encoding';
const ACCEPT_LANGUAGE = 'Accept-Language';
const ACCEPT_RANGES = 'Accept-Ranges';
const AGE = 'Age';
const ALLOW = 'Allow';
const AUTHORIZATION = 'Authorization';
const CACHE_CONTROL = 'Cache-Control';
const CONNECTION = 'Connection';
const CONTENT_ENCODING = 'Content-Encoding';
const CONTENT_LANGUAGE = 'Content-Language';
const CONTENT_LENGTH = 'Content-Length';
const CONTENT_LOCATION = 'Content-Location';
const CONTENT_MD5 = 'Content-MD5';
const CONTENT_RANGE = 'Content-Range';
const CONTENT_TYPE = 'Content-Type';
const DATE = 'Date';
const ETAG = 'ETag';
const EXPECT = 'Expect';
const EXPIRES = 'Expires';
const FROM = 'From';
const HOST = 'Host';
const IF_MATCH = 'If-Match';
const IF_MODIFIED_SINCE = 'If-Modified-Since';
const IF_NONE_MATCH = 'If-None-Match';
const IF_RANGE = 'If-Range';
const IF_UNMODIFIED_SINCE = 'If-Unmodified-Since';
const LAST_MODIFIED = 'Last-Modified';
const LOCATION = 'Location';
const MAX_FORWARDS = 'Max-Forwards';
const PRAGMA = 'Pragma';
const PROXY_AUTHENTICATION = 'Proxy-Authenticate';
const PROXY_AUTHORIZATION = 'Proxy-Authorization';
const RANGE = 'Range';
const REFERER = 'Referer';
const RETRY_AFTER = 'Retry-After';
const SERVER = 'Server';
const TE = 'TE';
const TRAILER = 'Trailer';
const TRANSFER_ENCODING = 'Transfer-Encoding';
const UPGRADE = 'Upgrade';
const USER_AGENT = 'User-Agent';
const VARY = 'Vary';
const VIA = 'Via';
}

View File

@@ -0,0 +1,24 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Constants;
class Mime
{
const JSON = 'application/json';
const TEXT = 'text/plain';
}

View File

@@ -0,0 +1,24 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Constants;
class Service
{
const INTERNAL_URL = 'internalUrl';
const PUBLIC_URL = 'publicUrl';
}

View File

@@ -0,0 +1,26 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Constants;
class Size
{
const KB = 1024;
const MB = 1048576;
const GB = 1073741824;
const TB = 1099511627776;
}

View File

@@ -0,0 +1,26 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Constants;
class State
{
const ACTIVE = 'ACTIVE';
const ERROR = 'ERROR';
const DEFAULT_TIMEOUT = 3600;
const DEFAULT_INTERVAL = 10;
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class AsyncError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class AsyncHttpError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class AsyncTimeoutError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class AttributeError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class AuthenticationError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class BaseException extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class CdnError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class CdnHttpError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class CdnNotAvailableError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class CdnTtlError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class CollectionException extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class ContainerCreateError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class ContainerDeleteError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class ContainerError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class ContainerNameError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class ContainerNotEmptyError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class ContainerNotFoundError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class CreateError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class CreateUpdateError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class CredentialError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class DatabaseCreateError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class DatabaseDeleteError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class DatabaseListError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class DatabaseNameError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class DatabaseUpdateError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class DeleteError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class DocumentError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class DomainError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class EmptyResponseError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class EndpointError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class FlavorError extends \Exception
{
}

View File

@@ -0,0 +1,25 @@
<?php
namespace OpenCloud\Common\Exceptions;
use Guzzle\Http\Exception\BadResponseException;
class ForbiddenOperationException extends HttpResponseException
{
public static function factory(BadResponseException $exception)
{
$response = $exception->getResponse();
$message = sprintf(
"This operation was forbidden; the API returned a %s status code with this message:\n%s",
$response->getStatusCode(),
(string) $response->getBody()
);
$e = new self($message);
$e->setResponse($response);
$e->setRequest($exception->getRequest());
return $e;
}
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class HttpError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class HttpForbiddenError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class HttpOverLimitError extends \Exception
{
}

View File

@@ -0,0 +1,56 @@
<?php
namespace OpenCloud\Common\Exceptions;
use Guzzle\Http\Message\RequestInterface;
use Guzzle\Http\Message\Response;
class HttpResponseException extends \Exception
{
protected $response;
protected $request;
/**
* Set the request that caused the exception
*
* @param RequestInterface $request Request to set
*
* @return RequestException
*/
public function setRequest(RequestInterface $request)
{
$this->request = $request;
return $this;
}
/**
* Get the request that caused the exception
*
* @return RequestInterface
*/
public function getRequest()
{
return $this->request;
}
/**
* Set the response that caused the exception
*
* @param Response $response Response to set
*/
public function setResponse(Response $response)
{
$this->response = $response;
}
/**
* Get the response that caused the exception
*
* @return Response
*/
public function getResponse()
{
return $this->response;
}
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class HttpRetryError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class HttpTimeoutError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class HttpUnauthorizedError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class HttpUrlError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class IOError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class IdRequiredError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class ImageError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class InstanceCreateError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class InstanceDeleteError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class InstanceError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class InstanceFlavorError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class InstanceNotFound extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class InstanceUpdateError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class InvalidArgumentError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class InvalidIdTypeError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class InvalidIpTypeError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class InvalidParameterError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class InvalidRequestError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class InvalidTemplateError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class JsonError extends \Exception
{
}

View File

@@ -0,0 +1,24 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
use Exception;
class LoggingException extends Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class MetadataCreateError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class MetadataDeleteError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class MetadataError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class MetadataJsonError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class MetadataKeyError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class MetadataPrefixError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class MetadataUpdateError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class MisMatchedChecksumError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class MissingValueError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class NameError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class NetworkCreateError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class NetworkDeleteError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class NetworkError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class NetworkUpdateError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class NetworkUrlError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class NoContentTypeError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class NoNameError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class ObjFetchError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class ObjectCopyError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class ObjectError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class RebuildError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class RecordTypeError extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class ResourceBucketException extends \Exception
{
}

View File

@@ -0,0 +1,25 @@
<?php
namespace OpenCloud\Common\Exceptions;
use Guzzle\Http\Exception\BadResponseException;
class ResourceNotFoundException extends HttpResponseException
{
public static function factory(BadResponseException $exception)
{
$response = $exception->getResponse();
$message = sprintf(
"This resource you were looking for could not be found; the API returned a %s status code with this message:\n%s",
$response->getStatusCode(),
(string) $response->getBody()
);
$e = new self($message);
$e->setResponse($response);
$e->setRequest($exception->getRequest());
return $e;
}
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class RuntimeException extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Copyright 2012-2014 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OpenCloud\Common\Exceptions;
class ServerActionError extends \Exception
{
}

Some files were not shown because too many files have changed in this diff Show More