Пример #1
0
 public function __construct($accessKey, $accessSecret)
 {
     //argument testing
     Eden_Amazon_Error::i()->argument(1, 'string')->argument(2, 'string');
     $this->_accessKey = $accessKey;
     $this->_accessSecret = $accessSecret;
 }
Пример #2
0
 /**
  * Instance ID
  *
  * @param string
  * @return array
  */
 public function setInstanceId($instanceId)
 {
     //argument 1 must be a string
     Eden_Amazon_Error::i()->argument(1, 'string');
     $this->_query['InstanceId_'][isset($this->_query['InstanceId_']) ? count($this->_query['InstanceId_']) + 1 : 1] = $instanceId;
     return $this;
 }
Пример #3
0
 /**
  * Retrieves console output for the specified instance.
  *
  * @param string The ID of the instance.
  * @return array
  */
 public function getConsoleOutput($instanceId)
 {
     //argument 1 must be a string
     Eden_Amazon_Error::i()->argument(1, 'string');
     $this->_query['Action'] = 'GetConsoleOutput';
     $this->_query['InstanceId'] = $instanceId;
     return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query);
 }
Пример #4
0
 /**
  * Determines whether a product code is associated with an instance. 
  * This action can only be used by the owner of the product code. 
  * It is useful when a product code owner needs to verify whether 
  * another EC2 user’s instance is eligible for support.
  *
  * @param string The product code
  * @param string The instance.
  * @return array
  */
 public function confirmProductInstance($productCode, $instanceId)
 {
     //argument test
     Eden_Amazon_Error::i()->argument(1, 'string')->argument(2, 'string');
     //argument 2 must be a string
     $query = array('Action' => self::CONFIRM_PRODUCT_INSTACE, 'ProductCode' => $productCode, 'InstanceId' => $instanceId);
     return $this->_getResponse(self::AMAZON_EC2_HOST, $query);
 }
Пример #5
0
 /**
  * A prefix that is prepended to datafeed files.
  *
  * @param string
  * @return array
  */
 public function setSpotInstanceRequestId($prefix)
 {
     //argument 1 must be a string
     Eden_Amazon_Error::i()->argument(1, 'string');
     $this->_query['Prefix'] = $prefix;
     return $this;
 }
Пример #6
0
 /**
  * The CIDR range. Cannot be used when specifying a source security group.
  *
  * @param string
  * @return array
  */
 public function setIpPermissionsCidrIp($cidrIp)
 {
     //argument 1 must be a string
     Eden_Amazon_Error::i()->argument(1, 'string');
     $this->_query['IpPermissions_IpRanges_CidrIp'][isset($this->_query['IpPermissions_IpRanges_CidrIp']) ? count($this->_query['IpPermissions_IpRanges_CidrIp']) + 1 : 1] = $cidrIp;
     return $this;
 }
Пример #7
0
 /**
  * A value for the DHCP option.
  *
  * @param string
  * @return array
  */
 public function setDhcpConfigurationValue($value)
 {
     //argument 1 must be a string
     Eden_Amazon_Error::i()->argument(1, 'string');
     $this->_query['DhcpConfiguration_Value_'][isset($this->_query['DhcpConfiguration_Value_']) ? count($this->_query['DhcpConfiguration_Value_']) + 1 : 1] = $value;
     return $this;
 }
Пример #8
0
 /**
  * The number of Reserved Instances to purchase
  *
  * @param Integer
  * @return array
  */
 public function setInstanceCount($instanceCount)
 {
     //argument 1 must be a Integer
     Eden_Amazon_Error::i()->argument(1, 'int');
     $this->_query['InstanceCount'] = $instanceCount;
     return $this;
 }
Пример #9
0
 public function setVersion($version)
 {
     Eden_Amazon_Error::i()->argument(1, 'string');
     $this->_params['Version'] = $version;
     return $this;
 }
Пример #10
0
 /**
  * One or more export task IDs. If no task IDs are provided, 
  * all active export tasks are described
  *
  * @param string
  * @return array
  */
 public function setExportTaskId($exportTaskId)
 {
     //argument 1 must be a string
     Eden_Amazon_Error::i()->argument(1, 'string');
     $this->_query['ExportTaskId_'][isset($this->_query['ExportTaskId_']) ? count($this->_query['ExportTaskId_']) + 1 : 1] = $exportTaskId;
     return $this;
 }
Пример #11
0
 /**
  * Placement group names
  *
  * @param string
  * @return array
  */
 public function setGroupName($groupName)
 {
     //argument 1 must be a string
     Eden_Amazon_Error::i()->argument(1, 'string');
     $this->_query['GroupName_'][isset($this->_query['GroupName_']) ? count($this->_query['GroupName_']) + 1 : 1] = $groupName;
     return $this;
 }
Пример #12
0
 /**
  * Returns Amazon sns
  *
  * @param *string
  * @param *string
  * @return Eden_Amazon_Sns
  */
 public function sns($accessKey, $accessSecret)
 {
     //argument test
     Eden_Amazon_Error::i()->argument(1, 'string')->argument(2, 'string');
     //Argument 2 must be a string
     return Eden_Amazon_Sns::i($accessKey, $accessSecret);
 }
Пример #13
0
 /**
  * Allows an Elastic IP address that is already associated with another network 
  * interface or instance to be re-associated with the specified instance or interface. 
  * If the Elastic IP address is associated, and this option is not specified, the 
  * operation fails. This is only available in Amazon VPC.
  *
  * @param boolean
  * @return array
  */
 public function setAllowReassociation($allowReassociation)
 {
     //argument 1 must be a boolean
     Eden_Amazon_Error::i()->argument(1, 'bool');
     $this->_query['AllowReassociation'] = $allowReassociation;
     return $this;
 }
Пример #14
0
 /**
  * A customer gateway ID. You can specify more than one in the request.
  *
  * @param string
  * @return array
  */
 public function setCustomerGatewayId($customerGatewayId)
 {
     //argument 1 must be a string
     Eden_Amazon_Error::i()->argument(1, 'string');
     $this->_query['CustomerGatewayId'][isset($this->_query['CustomerGatewayId']) ? count($this->_query['CustomerGatewayId']) + 1 : 1] = $customerGatewayId;
     return $this;
 }
Пример #15
0
 /**
  * Applies only when creating new network interfaces.
  *
  * @param string
  * @return array
  */
 public function setDescriptions($description)
 {
     //argument 1 must be a string
     Eden_Amazon_Error::i()->argument(1, 'string');
     $this->_query['NetworkInterface_Description'][isset($this->_query['NetworkInterface_Description']) ? count($this->_query['NetworkInterface_Description']) + 1 : 1] = $description;
     return $this;
 }
Пример #16
0
 /**
  * Set object or bucket Access Control Policy
  *
  * @param string Bucket name
  * @param string Object URI
  * @param array Access Control Policy Data (same as the data returned from getAccessControlPolicy)
  * @return boolean
  */
 public function setPermissions($bucket, $path = '/', array $acp = array())
 {
     //argument test
     Eden_Amazon_Error::i()->argument(1, 'string')->argument(2, 'string');
     //Argument 2 must be string
     $dom = new DOMDocument();
     $dom->formatOutput = true;
     $policy = $dom->createElement('AccessControlPolicy');
     $list = $dom->createElement('AccessControlList');
     // It seems the owner has to be passed along too
     $owner = $dom->createElement('Owner');
     $owner->appendChild($dom->createElement('ID', $acp['owner']['id']));
     $owner->appendChild($dom->createElement('DisplayName', $acp['owner']['name']));
     $policy->appendChild($owner);
     foreach ($acp['acl'] as $permission) {
         $grant = $dom->createElement('Grant');
         $grantee = $dom->createElement('Grantee');
         $grantee->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
         if (isset($permission['id'])) {
             // CanonicalUser (DisplayName is omitted)
             $grantee->setAttribute('xsi:type', 'CanonicalUser');
             $grantee->appendChild($dom->createElement('ID', $permission['id']));
         } elseif (isset($permission['email'])) {
             // AmazonCustomerByEmail
             $grantee->setAttribute('xsi:type', 'AmazonCustomerByEmail');
             $grantee->appendChild($dom->createElement('EmailAddress', $permission['email']));
         } elseif ($permission['type'] == 'Group') {
             // Group
             $grantee->setAttribute('xsi:type', 'Group');
             $grantee->appendChild($dom->createElement('URI', $permission['uri']));
         }
         $grant->appendChild($grantee);
         $grant->appendChild($dom->createElement('Permission', $permission['permission']));
         $list->appendChild($grant);
     }
     $policy->appendChild($list);
     $dom->appendChild($policy);
     $data = $dom->saveXML();
     $query = array('acl' => NULL);
     $header = array('Content-Type' => 'application/xml');
     return $this->_setResponse('PUT', $bucket, $path, $query, $data, $headers);
 }
Пример #17
0
 /**
  * Network interface ID
  *
  * @param string
  * @return array
  */
 public function setNetworkInterfaceId($networkInterfaceId)
 {
     //argument 1 must be a string
     Eden_Amazon_Error::i()->argument(1, 'string');
     $this->_query['NetworkInterfaceId_'][isset($this->_query['NetworkInterfaceId_']) ? count($this->_query['NetworkInterfaceId_']) + 1 : 1] = $networkInterfaceId;
     return $this;
 }
Пример #18
0
 /**
  * The Availability Zone for the resulting Amazon EBS volume.
  *
  * @param string 
  * @return array
  */
 public function setAvailabilityZone($availabilityZone)
 {
     //argument 1 must be a string
     Eden_Amazon_Error::i()->argument(1, 'string');
     $this->_query['AvailabilityZone'] = $availabilityZone;
     return $this;
 }
Пример #19
0
 /**
  * Check if the response is xml
  *
  * @param string|array|object|null
  * @return bollean
  */
 public function isXml($xml)
 {
     //argument 1 must be a string, array,  object or null
     Eden_Amazon_Error::i()->argument(1, 'string', 'array', 'object', 'null');
     if (is_array($xml) || is_null($xml)) {
         return false;
     }
     libxml_use_internal_errors(true);
     $doc = new DOMDocument('1.0', 'utf-8');
     $doc->loadXML($xml);
     $errors = libxml_get_errors();
     return empty($errors);
 }
Пример #20
0
 /**
  * A VPN connection ID. You can specify more than one in the request.
  *
  * @param string
  * @return array
  */
 public function setVpnConnectionId($vpnConnectionId)
 {
     //argument 1 must be a string
     Eden_Amazon_Error::i()->argument(1, 'string');
     $this->_query['VpnConnectionId_'][isset($this->_query['VpnConnectionId_']) ? count($this->_query['VpnConnectionId_']) + 1 : 1] = $vpnConnectionId;
     return $this;
 }
Пример #21
0
 /**
  * The name of the root device (for example, /dev/sda1, or xvda).
  *
  * @param string 
  * @return array
  */
 public function setRootDeviceName($rootDeviceName)
 {
     //argument 1 must be a string
     Eden_Amazon_Error::i()->argument(1, 'string');
     $this->_query['RootDeviceName'] = $rootDeviceName;
     return $this;
 }