/** * Removes metadata tags from an Amazon RDS resource. * * @param string $resourceName Resource identifier for the Amazon RDS resource. * @param string $resourceType The type of Amazon RDS resource (db|es|og|pg|ri|secgrp|snapshot|subgrp) * @param ListDataType $tagKeyList Array of tag keys to remove * @return bool * @throws RdsException */ public function removeTagsFromResource($resourceName, $resourceType, ListDataType $tagKeyList) { $result = false; $options = $tagKeyList->getQueryArray(); $options['ResourceName'] = $this->rds->getResourceName($resourceName, $resourceType); $response = $this->client->call(ucfirst(__FUNCTION__), $options); if ($response->getError() === false) { $sxml = simplexml_load_string($response->getRawContent()); $result = true; } return $result; }
/** * DescribeEvents action * * Returns events related to DB instances, DB security groups, DB Snapshots, and DB parameter groups * for the past 14 days. Events specific to a particular DB Iinstance, DB security group, DB Snapshot, or * DB parameter group can be obtained by providing the source identifier as a parameter. By default, the * past hour of events are returned. * * @param DescribeEventRequestData $request optional Request object. * @return EventList Returns EventList on success or throws an exception. * @throws ClientException * @throws RdsException */ public function describeEvents(DescribeEventRequestData $request = null) { $result = null; if ($request !== null) { $options = $request->getQueryArray(); if ($this->rds->getApiClientType() == Aws::CLIENT_SOAP) { if (isset($options['EventCategories.member.1'])) { foreach ($options as $k => $v) { if (strpos($k, 'EventCategories.member.') === 0) { $options['EventCategories']['EventCategory'][] = $v; unset($options[$k]); } } } } } else { $options = array(); } $action = ucfirst(__FUNCTION__); $response = $this->client->call($action, $options); if ($response->getError() === false) { $sxml = simplexml_load_string($response->getRawContent()); if (!$this->exist($sxml->{$action . 'Result'})) { throw new RdsException(sprintf(self::UNEXPECTED, $action)); } $ptr = $sxml->{$action . 'Result'}; $result = new EventList(); $result->setRds($this->rds); $result->marker = $this->exist($ptr->Marker) ? (string) $ptr->Marker : null; if (isset($ptr->Events->Event)) { foreach ($ptr->Events->Event as $v) { $item = $this->_loadEventData($v); $result->append($item); unset($item); } } } return $result; }
/** * Modifies an existing DB subnet group. * DB subnet groups must contain at least one subnet in at least two AZs in the region. * * @param ModifyDBSubnetGroupRequestData $request * @return DBSubnetGroupData * @throws RdsException */ public function modifyDBSubnetGroup(ModifyDBSubnetGroupRequestData $request) { $result = null; $options = $request->getQueryArray(); if ($this->rds->getApiClientType() === Aws::CLIENT_SOAP) { if (isset($options['SubnetIds.member.1'])) { foreach ($options as $k => $v) { if (strpos($k, 'SubnetIds.member.') !== false) { $options['SubnetIds']['SubnetId'][] = $v; unset($options[$k]); } } } } $response = $this->client->call(ucfirst(__FUNCTION__), $options); if ($response->getError() === false) { $sxml = simplexml_load_string($response->getRawContent()); if (!$this->exist($sxml->ModifyDBSubnetGroupResult)) { throw new RdsException(sprintf(self::UNEXPECTED, 'modify DBSubnet group')); } $result = $this->_loadDBSubnetGroupData($sxml->ModifyDBSubnetGroupResult->DBSubnetGroup); } return $result; }
/** * Loads DBClusterData from simple xml object * * @param \SimpleXMLElement $sxml * @return DBClusterData Returns DBClusterData */ protected function _loadDBClusterData(\SimpleXMLElement $sxml) { $item = null; if ($this->exist($sxml)) { $dbClusterIdentifier = (string) $sxml->DBClusterIdentifier; $item = $this->rds->getEntityManagerEnabled() ? $this->rds->dbCluster->get($dbClusterIdentifier) : null; if ($item === null) { $item = new DBClusterData(); $item->setRds($this->rds); $bAttach = true; } else { $item->resetObject(); $bAttach = false; } $this->fill($item, $sxml, ['dBClusterIdentifier', 'dBClusterParameterGroup', 'allocatedStorage', 'dBSubnetGroup', 'backupRetentionPeriod', 'backupRetentionPeriod', 'characterSetName', 'status', 'databaseName', 'engine', 'engineVersion', 'latestRestorableTime' => 'DateTime', 'masterUsername', 'preferredBackupWindow', 'preferredMaintenanceWindow', 'port' => 'int', 'endpoint', 'availabilityZones' => '_loadAvailabilityZonesList', 'vpcSecurityGroups' => '_loadVpcSecurityGroupMembershipList', 'dBClusterOptionGroupMemberships' => '_loadOptionGroupMembershipList', 'dBClusterMembers' => '_loadDBClusterMembers']); if ($bAttach && $this->rds->getEntityManagerEnabled()) { $this->getEntityManager()->attach($item); } } return $item; }