Cloud/Infrastructure/Adapter/Ec2.php
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Cloud_Infrastructure
- Subpackage
- Adapter
\Zend_Cloud_Infrastructure_Adapter_Ec2
Package: Zend\Cloud\Infrastructure\Adapter























Amazon EC2 adapter for infrastructure service
- Parent(s)
- \Zend_Cloud_Infrastructure_Adapter_AbstractAdapter
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Constants
HTTP_ADAPTER
= 'http_adapter'inheritedInherited from:
\Zend_Cloud_Infrastructure_Adapter::HTTP_ADAPTER\Zend_Cloud_Infrastructure_Adapter_AbstractAdapter::HTTP_ADAPTER
- Inherited_from
- \Zend_Cloud_Infrastructure_Adapter::HTTP_ADAPTER
- Inherited_from
- \Zend_Cloud_Infrastructure_Adapter_AbstractAdapter::HTTP_ADAPTER
TIMEOUT_STATUS_CHANGE
= 30inherited
The max.
Inherited from:
\Zend_Cloud_Infrastructure_Adapter::TIMEOUT_STATUS_CHANGE\Zend_Cloud_Infrastructure_Adapter_AbstractAdapter::TIMEOUT_STATUS_CHANGEamount of time, in seconds, to wait for a status change
TIME_STEP_STATUS_CHANGE
= 5inherited
The time step, in seconds, for the status change
Inherited from:
\Zend_Cloud_Infrastructure_Adapter::TIME_STEP_STATUS_CHANGE\Zend_Cloud_Infrastructure_Adapter_AbstractAdapter::TIME_STEP_STATUS_CHANGEProperties

array $adapterResultinherited
Store the last response from the adpter
Inherited from:
\Zend_Cloud_Infrastructure_Adapter_AbstractAdapter::$$adapterResultDetails
- Type
- array
- Inherited_from
- \Zend_Cloud_Infrastructure_Adapter_AbstractAdapter::$$adapterResult

array $mapMetrics = array(\Zend_Cloud_Infrastructure_Instance::MONITOR_CPU => 'CPUUtilization', \Zend_Cloud_Infrastructure_Instance::MONITOR_DISK_READ => 'DiskReadBytes', \Zend_Cloud_Infrastructure_Instance::MONITOR_DISK_WRITE => 'DiskWriteBytes', \Zend_Cloud_Infrastructure_Instance::MONITOR_NETWORK_IN => 'NetworkIn', \Zend_Cloud_Infrastructure_Instance::MONITOR_NETWORK_OUT => 'NetworkOut')Map monitor metrics between Infrastructure and EC2
Default value
array(\Zend_Cloud_Infrastructure_Instance::MONITOR_CPU => 'CPUUtilization', \Zend_Cloud_Infrastructure_Instance::MONITOR_DISK_READ => 'DiskReadBytes', \Zend_Cloud_Infrastructure_Instance::MONITOR_DISK_WRITE => 'DiskWriteBytes', \Zend_Cloud_Infrastructure_Instance::MONITOR_NETWORK_IN => 'NetworkIn', \Zend_Cloud_Infrastructure_Instance::MONITOR_NETWORK_OUT => 'NetworkOut')Details- Type
- array

array $mapStatus = array('running' => \Zend_Cloud_Infrastructure_Instance::STATUS_RUNNING, 'terminated' => \Zend_Cloud_Infrastructure_Instance::STATUS_TERMINATED, 'pending' => \Zend_Cloud_Infrastructure_Instance::STATUS_PENDING, 'shutting-down' => \Zend_Cloud_Infrastructure_Instance::STATUS_SHUTTING_DOWN, 'stopping' => \Zend_Cloud_Infrastructure_Instance::STATUS_PENDING, 'stopped' => \Zend_Cloud_Infrastructure_Instance::STATUS_STOPPED, 'rebooting' => \Zend_Cloud_Infrastructure_Instance::STATUS_REBOOTING)Map array between EC2 and Infrastructure status
Default value
array('running' => \Zend_Cloud_Infrastructure_Instance::STATUS_RUNNING, 'terminated' => \Zend_Cloud_Infrastructure_Instance::STATUS_TERMINATED, 'pending' => \Zend_Cloud_Infrastructure_Instance::STATUS_PENDING, 'shutting-down' => \Zend_Cloud_Infrastructure_Instance::STATUS_SHUTTING_DOWN, 'stopping' => \Zend_Cloud_Infrastructure_Instance::STATUS_PENDING, 'stopped' => \Zend_Cloud_Infrastructure_Instance::STATUS_STOPPED, 'rebooting' => \Zend_Cloud_Infrastructure_Instance::STATUS_REBOOTING)Details- Type
- array

array $validMetrics = array(\Zend_Cloud_Infrastructure_Instance::MONITOR_CPU, \Zend_Cloud_Infrastructure_Instance::MONITOR_RAM, \Zend_Cloud_Infrastructure_Instance::MONITOR_DISK, \Zend_Cloud_Infrastructure_Instance::MONITOR_DISK_READ, \Zend_Cloud_Infrastructure_Instance::MONITOR_DISK_WRITE, \Zend_Cloud_Infrastructure_Instance::MONITOR_NETWORK_IN, \Zend_Cloud_Infrastructure_Instance::MONITOR_NETWORK_OUT)inherited
Valid metrics for monitor
Inherited from:
\Zend_Cloud_Infrastructure_Adapter_AbstractAdapter::$$validMetricsDefault value
array(\Zend_Cloud_Infrastructure_Instance::MONITOR_CPU, \Zend_Cloud_Infrastructure_Instance::MONITOR_RAM, \Zend_Cloud_Infrastructure_Instance::MONITOR_DISK, \Zend_Cloud_Infrastructure_Instance::MONITOR_DISK_READ, \Zend_Cloud_Infrastructure_Instance::MONITOR_DISK_WRITE, \Zend_Cloud_Infrastructure_Instance::MONITOR_NETWORK_IN, \Zend_Cloud_Infrastructure_Instance::MONITOR_NETWORK_OUT)Details- Type
- array
- Inherited_from
- \Zend_Cloud_Infrastructure_Adapter_AbstractAdapter::$$validMetrics
Methods

__construct(array | \Zend_Config $options = array()) : voidConstructor
Parameters
| Name | Type | Description |
|---|---|---|
| $options | array | \Zend_Config |

convertAttributes(array $attr) : array | booleanConvert the attributes of EC2 into attributes of Infrastructure
Parameters
Returns
| Name | Type | Description |
|---|---|---|
| $attr | array |
| Type | Description |
|---|---|
| array | boolean |

createInstance(string $name, array $options) : \Instance | booleanCreate a new instance
Parameters
Returns
| Name | Type | Description |
|---|---|---|
| $name | string | |
| $options | array |
| Type | Description |
|---|---|
| \Instance | boolean |

deployInstance(string $id, $params, string | array $cmd) : string | arrayinherited
Run arbitrary shell script on an instance
Inherited from: \Zend_Cloud_Infrastructure_Adapter_AbstractAdapter::deployInstance()Parameters
Returns
| Name | Type | Description |
|---|---|---|
| $id | string | |
| $params | ||
| $cmd | string | array |
| Type | Description |
|---|---|
| string | array |

destroyInstance(string $id) : booleanDestroy an instance
Parameters
Returns
| Name | Type | Description |
|---|---|---|
| $id | string |
| Type | Description |
|---|---|
| boolean |

getAdapter() : \Zend_Service_Amazon_Ec2_InstanceGet the adapter
Returns
| Type | Description |
|---|---|
| \Zend_Service_Amazon_Ec2_Instance |

getAdapterResult() : arrayinherited
Get the last result of the adapter
Inherited from: \Zend_Cloud_Infrastructure_Adapter_AbstractAdapter::getAdapterResult()Returns
| Type | Description |
|---|---|
| array |

getLastHttpResponse() : \Zend_Http_ResponseGet the last HTTP response
Returns
| Type | Description |
|---|---|
| \Zend_Http_Response |

imagesInstance() : \ImageListReturn a list of all the available instance images
Returns
| Type | Description |
|---|---|
| \ImageList |

listInstances() : \Zend_Cloud_Infrastructure_InstanceListReturn a list of the available instancies
Returns
| Type | Description |
|---|---|
| \Zend_Cloud_Infrastructure_InstanceList |

monitorInstance(string $id, string $metric, null | array $options = null) : arrayReturn the system information about the $metric of an instance
Parameters
Returns
| Name | Type | Description |
|---|---|---|
| $id | string | |
| $metric | string | |
| $options | null | array |
| Type | Description |
|---|---|
| array |

publicDnsInstance(string $id) : string | booleanReturn the public DNS name of the instance
Parameters
Returns
| Name | Type | Description |
|---|---|---|
| $id | string |
| Type | Description |
|---|---|
| string | boolean |

rebootInstance(string $id) : booleanReboot an instance
Parameters
Returns
| Name | Type | Description |
|---|---|---|
| $id | string |
| Type | Description |
|---|---|
| boolean |

startInstance(string $id) : booleanStart an instance
Parameters
Returns
| Name | Type | Description |
|---|---|---|
| $id | string |
| Type | Description |
|---|---|
| boolean |

statusInstance(string $id) : string | booleanReturn the status of an instance
Parameters
Returns
| Name | Type | Description |
|---|---|---|
| $id | string |
| Type | Description |
|---|---|
| string | boolean |

stopInstance(string $id) : booleanStop an instance
Parameters
Returns
| Name | Type | Description |
|---|---|---|
| $id | string |
| Type | Description |
|---|---|
| boolean |

waitStatusInstance(string $id, string $status, integer $timeout = self::TIMEOUT_STATUS_CHANGE) : booleaninherited
Wait for status $status with a timeout of $timeout seconds
Inherited from: \Zend_Cloud_Infrastructure_Adapter_AbstractAdapter::waitStatusInstance()Parameters
Returns
| Name | Type | Description |
|---|---|---|
| $id | string | |
| $status | string | |
| $timeout | integer |
| Type | Description |
|---|---|
| boolean |