Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
8c0e31e
Update documentation
JPry Jan 14, 2015
9f1f98d
Change @returns to @return
JPry Jan 14, 2015
76c72d2
Adding missing inline documentation in OpenCloud\ObjectStore classes.
ycombinator Mar 4, 2015
f0fbce0
Added symlink functionality via X-Object-Manifest header management
markchalloner Mar 18, 2015
6ce77ce
Added createSymlinkFrom. Renamed symlink to createSymlinkTo. Made set…
markchalloner Mar 19, 2015
78914cb
[ci skip] Add more links to our official docs
Mar 20, 2015
9269ea8
Merge pull request #566 from jamiehannaford/readme-links
ycombinator Mar 20, 2015
ceebd95
Added getManifest assertions to symlink tests
markchalloner Mar 20, 2015
32a4cf7
[ci skip] Fix incorrect method in docs
Mar 20, 2015
a5cba84
Changed symlink failures from null to exceptions. Added tests.
markchalloner Mar 20, 2015
f3a5658
Added documentation
markchalloner Mar 20, 2015
41ec163
Merge pull request #567 from jamiehannaford/doc-fix
ycombinator Mar 20, 2015
27ed610
Added example of how to retrieve more than 10,000 objects
iamfinky Mar 21, 2015
7d6a182
Updated to use foreach rather than while
iamfinky Mar 21, 2015
c52783e
Merge pull request #568 from ilithium/working
Mar 21, 2015
4e6b676
Fixing return type.
ycombinator Mar 22, 2015
163b035
Adding return type.
ycombinator Mar 22, 2015
1caf1d3
Adding docblock.
ycombinator Mar 22, 2015
f965399
Merge pull request #569 from ycombinator/fix-dns-collection-return-ty…
Mar 23, 2015
9958eb9
Updated phpdoc for createSymlink functions
markchalloner Mar 23, 2015
412229a
Merge pull request #565 from markchalloner/working
ycombinator Mar 23, 2015
4503563
Appeasing the PSR-2 linter.
ycombinator Mar 23, 2015
90dfc12
Lazily initialize CDN container object composed insider regular conta…
ycombinator Mar 23, 2015
dd6a36a
Merge branch 'working' of github.com:rackspace/php-opencloud into wor…
ycombinator Mar 23, 2015
7868606
Removing mocking for refreshing CDN container composed object.
ycombinator Mar 23, 2015
2ee71c3
Merge pull request #570 from ycombinator/working
Mar 24, 2015
a1500bb
Merge pull request #550 from ycombinator/improve-api-docs
Mar 24, 2015
2bf6e0d
Fixing add, modify, and remove records links.
ycombinator Mar 27, 2015
24b5e97
Adding convenience method to retrieve domain by name.
ycombinator Mar 27, 2015
920e1f3
Adding test for domain not found, given domain name.
ycombinator Mar 27, 2015
cebb5d5
Adding support for availability zones in Compute servers.
ycombinator Mar 27, 2015
d2d3329
Fixing indentation.
ycombinator Mar 27, 2015
0fc8c87
Merge pull request #573 from ycombinator/gh-571
ycombinator Mar 27, 2015
aa93e41
Merge pull request #574 from ycombinator/gh-572
Mar 28, 2015
3fdf01b
Merge pull request #526 from JPry/server_documentation
Mar 28, 2015
6a87a92
Merge pull request #576 from ycombinator/gh-575
Mar 31, 2015
a108d31
Changed 'privateURL' to 'internalURL'
AdamMerrifield Apr 1, 2015
6b975b5
Merge pull request #578 from AdamMerrifield/working
Apr 1, 2015
14d0de8
Fix dead links; fixes #579
Apr 2, 2015
067cf97
Bump versions for development packages
Apr 2, 2015
c099ce5
Shift minimum PHP version to 5.4
Apr 2, 2015
cd838fa
Remove 5.3 from build matrix
Apr 2, 2015
6c084c6
Fix path
Apr 2, 2015
78ef25d
Fix path
Apr 2, 2015
d101346
Merge pull request #580 from jamiehannaford/gh-579
ycombinator Apr 2, 2015
8545dda
Add note to main install guide
Apr 2, 2015
9457407
Bump library version
Apr 2, 2015
2b0a696
Use correct format
Apr 2, 2015
853dd17
Merge pull request #582 from jamiehannaford/dev-5.4
ycombinator Apr 2, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ php:
- "5.6"
- "5.5"
- "5.4"
- "5.3"
- hhvm

sudo: false
Expand Down Expand Up @@ -33,4 +32,4 @@ notifications:
- shaunak.kashyap@rackspace.com

env:
- secure: "bdrUeYb3nSGgBB+QtDZxUHVPw6B/wjb3KXLm8TgonWrQm4GPeWKK29qhmDnFZmQjwQPfuebe7wAk1ZxGoZKbEiELVpJJ+8XYVOt6W/6V53H31JL6FqiIE5+7qBwDe+9ziveM6GcTXHT1GI5mUeACIbeBDPZaNubIJH3U6MPim64="
- secure: "bdrUeYb3nSGgBB+QtDZxUHVPw6B/wjb3KXLm8TgonWrQm4GPeWKK29qhmDnFZmQjwQPfuebe7wAk1ZxGoZKbEiELVpJJ+8XYVOt6W/6V53H31JL6FqiIE5+7qBwDe+9ziveM6GcTXHT1GI5mUeACIbeBDPZaNubIJH3U6MPim64="
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ 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.
Our official documentation is now available on http://docs.php-opencloud.com. 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
Expand All @@ -16,9 +16,11 @@ so that you can still use the SDK with a pure OpenStack instance

Requirements
------------
* PHP >=5.3.3
* PHP >=5.4
* cURL extension for PHP

**Note**: Since PHP 5.3 has reached [end of life](http://php.net/eol.php) and is no longer officially supported, we are moving to 5.4 as a minimum requirement. If upgrading is not an option and you still need a stable version of the SDK for 5.3, please follow [this guide](http://docs.php-opencloud.com/en/latest/using-php-5.3).

Installation
------------
You must install this library through Composer:
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
}
},
"require": {
"php" : ">=5.3.3",
"php" : ">=5.4",
"guzzle/guzzle" : "~3.8",
"psr/log": "~1.0"
},
Expand All @@ -35,6 +35,6 @@
"satooshi/php-coveralls": "0.6.*@dev",
"jakub-onderka/php-parallel-lint": "0.*",
"fabpot/php-cs-fixer": "1.0.*@dev",
"apigen/apigen": "~2.8"
"apigen/apigen": "~4.0"
}
}
4 changes: 4 additions & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ Read the :doc:`getting-started-with-openstack` or
:doc:`getting-started-with-rackspace` to help you get started with basic
Compute operations.

.. note::

If you are running PHP 5.3, please see our :doc:`using-php-5.3` guide.

Services
--------

Expand Down
6 changes: 3 additions & 3 deletions doc/services/common/service-args.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
default will be provided if you pass in ``null``.

* ``{region}`` is the region the service will operate in. For Rackspace
users, you can select one of the following from the `supported regions page
</regions>`_.
users, you can select one of the following from the :doc:`supported regions page
</regions>`.

* ``{urlType}`` is the `type of URL </url-types>`_ to use, depending on which
* ``{urlType}`` is the :doc:`type of URL </url-types>` to use, depending on which
endpoints your catalog provides. If omitted, it will default to the public
network.
4 changes: 2 additions & 2 deletions doc/services/dns/domains.rst
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@ Modify domain

Only the TTL, email address and comment attributes of a domain can be modified.
Records cannot be added, modified, or removed through this API operation - you
will need to use the `add records <records#add-record>`__, `modify records
<records#modify-record>`__ or `remove records <records#delete-record>`__
will need to use the `add records <records.html#add-record>`__, `modify records
<records.html#modify-record>`__ or `remove records <records.html#delete-record>`__
operations respectively.

.. code-block:: php
Expand Down
4 changes: 2 additions & 2 deletions doc/services/object-store/migrating-containers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ You can access all this functionality by executing:


It's advisable to do this process in a Cloud Server in one of the two
regions you're migrating to/from. This allows you to use ``privateURL``
regions you're migrating to/from. This allows you to use ``internalURL``
as the third argument in the ``objectStoreService`` methods like this:

.. code-block:: php

$client->objectStoreService('cloudFiles', 'IAD', 'privateURL');
$client->objectStoreService('cloudFiles', 'IAD', 'internalURL');


This will ensure that traffic between your server and your new IAD
Expand Down
75 changes: 73 additions & 2 deletions doc/services/object-store/objects.rst
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,42 @@ docs <http://docs.openstack.org/api/openstack-object-storage/1.0/content/list-ob
`Get the executable PHP script for this example <https://raw.githubusercontent.com/rackspace/php-opencloud/master/samples/ObjectStore/list-objects.php>`_


List over 10,000 objects
------------------------

To retrieve more than 10,000 objects (the default limit), you'll need to use
the built-in paging which uses a 'marker' parameter to fetch the next page of data.

.. code-block:: php

$containerObjects = array();
$marker = '';

while ($marker !== null) {
$params = array(
'marker' => $marker,
);

$objects = $container->objectList($params);
$total = $objects->count();
$count = 0;

if ($total == 0) {
break;
}

foreach ($objects as $object) {
/** @var $object OpenCloud\ObjectStore\Resource\DataObject **/
$containerObjects[] = $object->getName();
$count++;

$marker = ($count == $total) ? $object->getName() : null;
}
}

`Get the executable PHP script for this example <https://raw.githubusercontent.com/rackspace/php-opencloud/master/samples/ObjectStore/list-objects-over-10000.php>`_


Get object
----------

Expand Down Expand Up @@ -204,8 +240,8 @@ Get file name

.. code-block:: php

/** @param $container OpenCloud\ObjectStore\Resource\Container */
$container = $object->getContainer();
/** @param $name string */
$name = $object->getName();


Get file size
Expand Down Expand Up @@ -326,6 +362,41 @@ the name of the object inside the container that does not exist yet.
`Get the executable PHP script for this example <https://raw.githubusercontent.com/rackspace/php-opencloud/master/samples/ObjectStore/copy-object.php>`_


Symlinking to this object from another location
-----------------------------------------------

To create a symlink to this file in another location you need to specify
a string-based source

.. code-block:: php

$object->createSymlinkFrom('/container_2/new_object_name');

Where ``container_2`` is the name of the container, and ``new_object_name`` is
the name of the object inside the container that either does not exist yet or
is an empty file.

`Get the executable PHP script for this example <https://raw.githubusercontent.com/rackspace/php-opencloud/master/samples/ObjectStore/symlink-object.php>`_


Setting this object to symlink to another location
--------------------------------------------------

To set this file to symlink to another location you need to specify
a string-based destination

.. code-block:: php

$object->createSymlinkTo('/container_2/new_object_name');

Where ``container_2`` is the name of the container, and ``new_object_name`` is
the name of the object inside the container.

The object must be an empty file.

`Get the executable PHP script for this example <https://raw.githubusercontent.com/rackspace/php-opencloud/master/samples/ObjectStore/symlink-object.php>`_


Get object metadata
-------------------

Expand Down
20 changes: 20 additions & 0 deletions doc/using-php-5.3.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Using the SDK with PHP v5.3
===========================

Since PHP 5.3 has entered EOL and no longer receives security updates, we have bumped the minimum requirement to 5.4. Using 5.3 is still possible, however, but you will need to use an older stable version of the SDK. There are two ways to do this.

The first way is by requiring it through the command line:

.. code-block:: bash

composer require rackspace/php-opencloud:1.12

The second way is by updating your composer.json file, and specifying the appropriate version of the SDK:

.. code-block:: json

"require": {
"rackspace/php-opencloud": "~1.12"
}

Note that **1.12** is the last minor release supporting PHP 5.3. Version 1.13 and above has shifted to PHP 5.4.
3 changes: 3 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Documentation

Our official docs are hosted on http://docs.php-opencloud.com.
1 change: 1 addition & 0 deletions lib/OpenCloud/Common/Constants/Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,5 @@ class Header
const USER_AGENT = 'User-Agent';
const VARY = 'Vary';
const VIA = 'Via';
const X_OBJECT_MANIFEST = 'X-Object-Manifest';
}
22 changes: 22 additions & 0 deletions lib/OpenCloud/Common/Exceptions/DomainNotFoundException.php
Original file line number Diff line number Diff line change
@@ -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 DomainNotFoundException extends \Exception
{
}
13 changes: 13 additions & 0 deletions lib/OpenCloud/Compute/Resource/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@ class Server extends NovaResource implements HasPtrRecordsInterface
*/
public $powerStatus;

/**
* @link http://developer.openstack.org/api-ref-compute-v2-ext.html#ext-os-ext-az
* @var string Availability zone of the VM
*/
public $availabilityZone;

protected static $json_name = 'server';
protected static $url_resource = 'servers';

Expand Down Expand Up @@ -206,6 +212,7 @@ class Server extends NovaResource implements HasPtrRecordsInterface
'OS-EXT-STS:vm_state' => 'extendedStatus',
'OS-EXT-STS:task_state' => 'taskStatus',
'OS-EXT-STS:power_state' => 'powerStatus',
'OS-EXT-AZ:availability_zone' => 'availabilityZone'
);

/**
Expand Down Expand Up @@ -729,6 +736,12 @@ protected function createJson()
$server->user_data = $this->user_data;
}

// Availability zone
if (!empty($this->availabilityZone)) {
$this->checkExtension('OS-EXT-AZ');
$server->availability_zone = $this->availabilityZone;
}

return (object) array('server' => $server);
}

Expand Down
6 changes: 3 additions & 3 deletions lib/OpenCloud/Compute/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function __construct(Client $client, $type = null, $name = null, $region
*
* @api
* @param string $id - if specified, the server with the ID is retrieved
* @returns Resource\Server object
* @return Resource\Server object
*/
public function server($id = null)
{
Expand All @@ -102,7 +102,7 @@ public function server($id = null)
* not having all the information you need.
* @param array $filter - a set of key/value pairs that is passed to the
* servers list for filtering
* @returns \OpenCloud\Common\Collection
* @return \OpenCloud\Common\Collection\PaginatedIterator
*/
public function serverList($details = true, array $filter = array())
{
Expand All @@ -128,7 +128,7 @@ public function network($id = null)
*
* @api
* @param array $filter array of filter key/value pairs
* @return \OpenCloud\Common\Collection
* @return \OpenCloud\Common\Collection\PaginatedIterator
*/
public function networkList($filter = array())
{
Expand Down
3 changes: 2 additions & 1 deletion lib/OpenCloud/DNS/Resource/Domain.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function record($info = null)
* returns a Collection of Record objects
*
* @param array $filter query-string parameters
* @return \OpenCloud\Collection
* @return OpenCloud\DNS\Collection\DnsIterator
*/
public function recordList($filter = array())
{
Expand Down Expand Up @@ -107,6 +107,7 @@ public function subdomain($info = array())
*
* @param array $filter key/value pairs for query string parameters
* return \OpenCloud\Collection
* @return OpenCloud\DNS\Collection\DnsIterator
*/
public function subdomainList($filter = array())
{
Expand Down
30 changes: 28 additions & 2 deletions lib/OpenCloud/DNS/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

use OpenCloud\Common\Http\Message\Formatter;
use OpenCloud\Common\Service\CatalogService;
use OpenCloud\Common\Exceptions\DomainNotFoundException;
use OpenCloud\DNS\Collection\DnsIterator;
use OpenCloud\DNS\Resource\AsyncResponse;
use OpenCloud\DNS\Resource\Domain;
Expand Down Expand Up @@ -55,11 +56,29 @@ public function domain($info = null)
return $this->resource('Domain', $info);
}

/**
* Returns a domain, given a domain name
*
* @param string $domainName Domain name
* @return Domain the domain object
*/
public function domainByName($domainName)
{
$domainList = $this->domainList(array("name" => $domainName));

if (count($domainList) != 1) {
throw new DomainNotFoundException();
}

return $this->resource('Domain', $domainList[0]);
}


/**
* Returns a collection of domains
*
* @param array $filter key/value pairs to use as query strings
* @return \OpenCloud\Common\Collection
* @return OpenCloud\DNS\Collection\DnsIterator
*/
public function domainList($filter = array())
{
Expand All @@ -85,7 +104,7 @@ public function ptrRecord($info = null)
*
* @param \OpenCloud\Compute\Resource\Server $server the server for which to
* retrieve the PTR records
* @return \OpenCloud\Common\Collection
* @return OpenCloud\DNS\Collection\DnsIterator
*/
public function ptrRecordList(HasPtrRecordsInterface $parent)
{
Expand Down Expand Up @@ -181,6 +200,13 @@ public function limitTypes()
return $body->limitTypes;
}

/**
* List asynchronous responses' statuses.
* @see http://docs.rackspace.com/cdns/api/v1.0/cdns-devguide/content/viewing_status_all_asynch_jobs.html
*
* @param array $query Any query parameters. Optional.
* @return OpenCloud\DNS\Collection\DnsIterator
*/
public function listAsyncJobs(array $query = array())
{
$url = clone $this->getUrl();
Expand Down
Loading