public function describeReservedInstances(ListDataType $reservedInstanceIdList = null, ReservedInstanceFilterList $filter = null, OfferingType $offefingType = null)
{
$result = null;
$options = array();
if ($reservedInstanceIdList !== null) {
$options = array_merge($options, $this->getInstanceIdListQuery($reservedInstanceIdList, 'ReservedInstancesId'));
}
if ($filter !== null) {
$options = array_merge($options, $filter->getQueryArrayBare('Filter'));
}
if ($offefingType !== null) {
$options['OfferingType'] = (string) $offefingType;
}
$response = $this->client->call(ucfirst(__FUNCTION__), $options);
if ($response->getError() === false) {
//Success
$sxml = simplexml_load_string($response->getRawContent());
$response = null;
$result = new ReservedInstanceList();
$result->setEc2($this->ec2);
$result->setRequestId((string) $sxml->requestId);
if (!empty($sxml->reservedInstancesSet->item)) {
foreach ($sxml->reservedInstancesSet->item as $v) {
$reservedInstancesId = (string) $v->reservedInstancesId;
$item = $this->ec2->getEntityManagerEnabled() ? $this->ec2->reservedInstance->get($reservedInstancesId) : null;
if ($item === null) {
$item = new ReservedInstanceData();
$item->setEc2($this->ec2);
$bAttach = true;
} else {
$item->resetObject();
$bAttach = false;
}
$item->reservedInstancesId = $reservedInstancesId;
$item->instanceType = $this->exist($v->instanceType) ? (string) $v->instanceType : null;
$item->availabilityZone = $this->exist($v->availabilityZone) ? (string) $v->availabilityZone : null;
$item->duration = $this->exist($v->duration) ? $v->duration - 0 : null;
$item->fixedPrice = $this->exist($v->fixedPrice) ? floatval($v->fixedPrice) : null;
$item->usagePrice = $this->exist($v->usagePrice) ? floatval($v->usagePrice) : null;
$item->instanceCount = $this->exist($v->instanceCount) ? intval($v->instanceCount) : null;
$item->state = $this->exist($v->state) ? (string) $v->state : null;
$item->productDescription = $this->exist($v->productDescription) ? (string) $v->productDescription : null;
$item->start = $this->exist($v->start) ? new \DateTime((string) $v->start, new \DateTimeZone('UTC')) : null;
$item->end = $this->exist($v->end) ? new \DateTime((string) $v->end, new \DateTimeZone('UTC')) : null;
$item->instanceTenancy = $this->exist($v->instanceTenancy) ? (string) $v->instanceTenancy : null;
$item->currencyCode = $this->exist($v->currencyCode) ? (string) $v->currencyCode : null;
$item->offeringType = $this->exist($v->offeringType) ? (string) $v->offeringType : null;
$item->setTagSet($this->_loadResourceTagSetList($v->tagSet))->setRecurringCharges($this->_loadRecurringChargesSetList($v->recurringCharges));
$result->append($item);
if ($bAttach && $this->ec2->getEntityManagerEnabled()) {
$this->getEntityManager()->attach($item);
}
unset($item);
}
}
}
return $result;
}