compared with
Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (30)

View Page History
{zone-data:revision}
1.0 - 4 April 2011: Initial Draft.
1.1 - 17 June 2011: Alpha version of Zend\Cloud\Infrastructure ([available on github|https://github.com/ezimuel/zf2/tree/feature%2Fcloud%2Finfrastructure/library/Zend/Cloud/Infrastructure])
{zone-data}



The Zend_\Cloud class uses some specific Zend Framework components to implement the vendor adapters. These service classes are:

* Zend\Service\Amazon
* *unifiedcloud*, http://code.google.com/p/unifiedcloud/
Unified Cloud Computing is an attempt to create an open and standardized cloud interface for the unification of various cloud api's. A singular programmatic point of contact that can encompass the entire infrastructure stack as well as emerging cloud centric technologies all through a unified interface. One of the key drivers of the unified cloud interface is to create an api about other api's. A singular programmatic point of contact that can encompass the entire infrastructure stack as well as emerging cloud centric technologies all through a unified interface.
* *deltacloud*, http://incubator.apache.org/deltacloud/
an API that abstracts the differences between clouds.

We would like to provide a similar solution for PHP.
{zone-data:requirements}
* This component *will* include a factory method.
* This component *will* use the Zend_Service_* Zend\Service\* class to manage the Adapter of each cloud computing vendors (so far we have only available the class Zend_Service_Amazon_Ec2).
* This component *will not* save any data using Zend_Cache or the filesystem.
{zone-data}
* Zend\Cloud\Infrasctructure
* Zend\Cloud\Infrasctructure\Adapter
* Zend\Cloud\Infrastructure\Exception
* Zend\Cloud\Infrastructure\Instance
* Zend\Cloud\Infrastructure\InstanceList
* Zend\Cloud\Infrastructure\Image
* Zend\Cloud\Infrastructure\ImageList
{zone-data}

||UC-01||
{code:php}
$infrastructure = Zend_Cloud_Infrastructure_Factory::getAdapter(array(
Zend_Cloud_Infrastructure_Factory::INFRASTRUCTURE_ADAPTER_KEY => 'Zend_Cloud_Infrastructure_Adapter_Ec2',
Zend_Cloud_Infrastructure_Adapter_Ec2::AWS_ACCESS_KEY => $amazonKey,
Zend_Cloud_Infrastructure_Adapter_Ec2::AWS_SECRET_KEY => $amazonSecret,
));

use Zend\Cloud\Infrastructure\Factory,
Zend\Cloud\Infrastructure\Instance,
Zend\Cloud\Infrastructure\Adapter\Ec2 as Ec2Adapter;

$nodes= $infrastructure->listNode();
$amazonKey= 'xxx';
$amazonSecret= 'yyy';
$amazonZone= 'us-east-1';

$infrastructure = Factory::getAdapter(array(
Factory::INFRASTRUCTURE_ADAPTER_KEY => 'Zend\Cloud\Infrastructure\Adapter\Ec2',
Ec2Adapter::AWS_ACCESS_KEY => $amazonKey,
Ec2Adapter::AWS_SECRET_KEY => $amazonSecret,
Ec2Adapter::AWS_REGION => $amazonZone
));
print_r($nodes);
$options= array (
Instance::INSTANCE_IMAGEID => 'ami-8c1fece5',
Ec2Adapter::AWS_SECURITY_GROUP => array ('default')
);

$instance= $infrastructure->createInstance('test',$options);

if ($instance->waitStatus(Instance::STATUS_RUNNING)) {
printf("The instance %s is running now!",$instance->getId());
}
{code}

interface Adapter
{
const HTTP_ADAPTER = 'http_adapter';
const TIMEOUT_STATUS_CHANGE = 30;
/**
* Return a list of the available instances
* Return the status of an instance
*
* @param string $id
* @return string
*/
public function statusInstance($id);

/**
* Wait for status $status with a timeout of $timeout seconds
*
* @param string $id
* @param string $status
* @param integer $timeout
* @return boolean
*/
public function waitStatusInstance($id,$status,$timeout=self::TIMEOUT_STATUS_CHANGE);

/**
* Return the public DNS name of the instance
*
* @param string $id
* @return string|boolean
*/
* Create a new instance
*
* @param string $name
* @param array $options
* @return boolean
*/
* Stop the execution of an instance
*
* @param string $id
* @return boolean
*/
* Start the execution of an instance
*
* @param string $id
* @return boolean
*/
* Destroy an instance
*
* @param string $id
* @return boolean
*/
* Return the system informations about the $metric of an instance
*
* @param string $id
* @param string $metric
* @param array $options
* @return array
*/
* Run arbitrary shell script on an instance
*
* @param string $id
* @param array $param
* @param string|array $cmd
* @return string|array
*/

/**
* Get the last HTTP request
*
* @return string