/** * Loads DBInstanceData from simple xml object * * @param \SimpleXMLElement $sxml * @return DBInstanceData Returns DBInstanceData */ protected function _loadDBInstanceData(\SimpleXMLElement $sxml) { $item = null; if ($this->exist($sxml)) { $dbInstanceIdentifier = (string) $sxml->DBInstanceIdentifier; $item = $this->rds->getEntityManagerEnabled() ? $this->rds->dbInstance->get($dbInstanceIdentifier) : null; if ($item === null) { $item = new DBInstanceData(); $item->setRds($this->rds); $bAttach = true; } else { $item->resetObject(); $bAttach = false; } $item->dBInstanceIdentifier = $dbInstanceIdentifier; $item->allocatedStorage = $this->exist($sxml->AllocatedStorage) ? (int) $sxml->AllocatedStorage : null; $item->autoMinorVersionUpgrade = $this->exist($sxml->AutoMinorVersionUpgrade) ? (string) $sxml->AutoMinorVersionUpgrade == 'true' : null; $item->availabilityZone = $this->exist($sxml->AvailabilityZone) ? (string) $sxml->AvailabilityZone : null; $item->backupRetentionPeriod = $this->exist($sxml->BackupRetentionPeriod) ? (int) $sxml->BackupRetentionPeriod : null; $item->characterSetName = $this->exist($sxml->CharacterSetName) ? (string) $sxml->CharacterSetName : null; $item->dBInstanceClass = $this->exist($sxml->DBInstanceClass) ? (string) $sxml->DBInstanceClass : null; $item->dBInstanceStatus = $this->exist($sxml->DBInstanceStatus) ? (string) $sxml->DBInstanceStatus : null; $item->dBName = $this->exist($sxml->DBName) ? (string) $sxml->DBName : null; $item->engine = $this->exist($sxml->Engine) ? (string) $sxml->Engine : null; $item->engineVersion = $this->exist($sxml->EngineVersion) ? (string) $sxml->EngineVersion : null; $item->instanceCreateTime = $this->exist($sxml->InstanceCreateTime) ? new DateTime((string) $sxml->InstanceCreateTime, new DateTimeZone('UTC')) : null; $item->iops = $this->exist($sxml->Iops) ? (int) $sxml->Iops : null; $item->latestRestorableTime = $this->exist($sxml->LatestRestorableTime) ? new DateTime((string) $sxml->LatestRestorableTime, new DateTimeZone('UTC')) : null; $item->licenseModel = $this->exist($sxml->LicenseModel) ? (string) $sxml->LicenseModel : null; $item->masterUsername = $this->exist($sxml->MasterUsername) ? (string) $sxml->MasterUsername : null; $item->multiAZ = $this->exist($sxml->MultiAZ) ? (string) $sxml->MultiAZ == 'true' : null; $item->preferredBackupWindow = $this->exist($sxml->PreferredBackupWindow) ? (string) $sxml->PreferredBackupWindow : null; $item->preferredMaintenanceWindow = $this->exist($sxml->PreferredMaintenanceWindow) ? (string) $sxml->PreferredMaintenanceWindow : null; $item->publiclyAccessible = $this->exist($sxml->PubliclyAccessible) ? (string) $sxml->PubliclyAccessible == 'true' : null; $item->readReplicaSourceDBInstanceIdentifier = $this->exist($sxml->ReadReplicaSourceDBInstanceIdentifier) ? (string) $sxml->ReadReplicaSourceDBInstanceIdentifier : null; $item->secondaryAvailabilityZone = $this->exist($sxml->SecondaryAvailabilityZone) ? (string) $sxml->SecondaryAvailabilityZone : null; $item->readReplicaDBInstanceIdentifiers = array(); if (!empty($sxml->ReadReplicaDBInstanceIdentifiers->ReadReplicaDBInstanceIdentifier)) { foreach ($sxml->ReadReplicaDBInstanceIdentifiers->ReadReplicaDBInstanceIdentifier as $v) { $item->readReplicaDBInstanceIdentifiers[] = (string) $v; } } $item->dBParameterGroups = $this->_loadDBParameterGroupStatusList($sxml->DBParameterGroups); $item->dBSecurityGroups = $this->_loadDBSecurityGroupMembershipList($sxml->DBSecurityGroups); $item->vpcSecurityGroups = $this->_loadVpcSecurityGroupMembershipList($sxml->VpcSecurityGroups); $item->endpoint = $this->_loadEndpointData($sxml->Endpoint); $item->optionGroupMembership = $this->_loadOptionGroupMembershipData($sxml->OptionGroupMembership); $item->pendingModifiedValues = $this->_loadPendingModifiedValuesData($sxml->PendingModifiedValues); if ($bAttach && $this->rds->getEntityManagerEnabled()) { $this->getEntityManager()->attach($item); } } return $item; }
/** * Remove test instance * @param DBInstanceData $dbi * @throws ClientException */ protected function removeDBInstance(DBInstanceData $dbi) { $dbi->delete(true); $this->assertInstanceOf($this->getRdsClassName('DataType\\DBInstanceData'), $dbi); for ($to = 1, $t = time(); time() - $t < 600 && $dbi->dBInstanceStatus == DBInstanceData::STATUS_DELETING; $to += 10) { sleep($to); try { $dbi = $dbi->refresh(); } catch (ClientException $e) { if ($e->getErrorData()->getCode() == ErrorData::ERR_DB_INSTANCE_NOT_FOUND) { break; } throw $e; } } }