Esempio n. 1
0
 /**
  * ResetDBParameterGroup action
  *
  * Modifies the parameters of a DBParameterGroup to the engine/system default value.
  * To reset specific parameters submit a list of the following: ParameterName and ApplyMethod.
  * To reset the entire DBParameterGroup specify the DBParameterGroup name and ResetAllParameters parameters.
  * When resetting the entire group, dynamic parameters are updated immediately and static parameters are set
  * to pending-reboot to take effect on the next DB instance restart or RebootDBInstance request.
  *
  * @param   string        $dBParameterGroupName The name of DB Parameter Group to modify.
  * @param   ParameterList $parameters           optional An list of parameter names, values, and the apply method
  *                                              for the parameter update. At least one parameter name, value,
  *                                              and apply method must be supplied;
  *                                              subsequent arguments are optional.
  *                                              A maximum of 20 parameters may be modified in a single request.
  *                                              Valid Values (for the application method): immediate | pending-reboot
  * @param   bool          $resetAllParameters   optional Specifies whether (true) or not (false) to reset all parameters
  *                                              in the DB Parameter Group to default values.
  * @return  string        Returns DBParameterGroupName on success or throws an exception.
  * @throws  ClientException
  * @throws  RdsException
  */
 public function resetDBParameterGroup($dBParameterGroupName, ParameterList $parameters = null, $resetAllParameters = null)
 {
     $result = false;
     $options = array('DBParameterGroupName' => (string) $dBParameterGroupName);
     if ($parameters !== null) {
         if ($this->rds->getApiClientType() == Aws::CLIENT_SOAP) {
             $parameter = array();
             foreach ($parameters as $v) {
                 $parameter[] = $v->getQueryArray();
             }
             $options['Parameters']['Parameter'] = $parameter;
         } else {
             $options = array_merge($options, array_filter($parameters->getQueryArray('Parameters'), function ($v) {
                 return $v !== null;
             }));
         }
     } elseif ($resetAllParameters !== null) {
         $options['ResetAllParameters'] = $resetAllParameters ? 'true' : 'false';
     }
     $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 = (string) $ptr->DBParameterGroupName;
     }
     return $result;
 }