Ejemplo n.º 1
0
 /**
  * Edit Administrator's Note
  *
  * @param int    $id         virtual machine id
  * @param string $admin_note Administrator's Note
  *
  * @return void
  */
 function editAdminNote($id, $admin_note)
 {
     if ($admin_note) {
         $this->_admin_note = $admin_note;
     }
     if ($id) {
         $this->_id = $id;
     }
     parent::save();
 }
Ejemplo n.º 2
0
 /**
  * The method saves an Object to your account
  *
  * After sending an API request to create an object or change the data in
  * the existing object, the method checks the response and loads the
  * exisitng object with the new data.
  *
  * This method can be closed for read only objects of the inherited class
  * <code>
  *    function save() {
  *        $this->logger->error(
  *            "Call to undefined method ".__CLASS__."::save()",
  *            __FILE__,
  *            __LINE__
  *        );
  *    }
  * </code>
  *
  * @return void
  * @access public
  */
 function save()
 {
     if (is_null($this->_limit)) {
         $this->_limit = isset($this->_limits->_limit) ? $this->_limits->_limit : (isset($this->_obj->_limits->_limit) ? $this->_obj->_limits->_limit : '');
     }
     if (is_null($this->_limit_free)) {
         $this->_limit_free = isset($this->_limits->_limit_free) ? $this->_limits->_limit_free : (isset($this->_obj->_limits->_limit_free) ? $this->_obj->_limits->_limit_free : '');
     }
     if (is_null($this->_price_on)) {
         $this->_price_on = isset($this->_prices->_price_on) ? $this->_prices->_price_on : (isset($this->_obj->_prices->_price_on) ? $this->_obj->_prices->_price_on : '');
     }
     if (is_null($this->_price_off)) {
         $this->_price_off = isset($this->_limits->_price_off) ? $this->_prices->_price_off : (isset($this->_obj->_prices->_price_off) ? $this->_obj->_prices->_price_off : "");
     }
     if (is_null($this->_price)) {
         $this->_price = isset($this->_limits->_price) ? $this->_prices->_price : (isset($this->_obj->_prices->_price) ? $this->_obj->_prices->_price : '');
     }
     return parent::save();
 }
Ejemplo n.º 3
0
 /**
  * The method saves an Object to your account
  *
  * @param integer $vm_id VM ID
  *
  * @return mixed Serialized API Response
  * @access private
  */
 function save()
 {
     if ($this->_virtual_machine_id) {
         $this->fields['require_format_disk'] = array(ONAPP_FIELD_MAP => '_require_format_disk', ONAPP_FIELD_TYPE => 'integer', ONAPP_FIELD_REQUIRED => true, ONAPP_FIELD_DEFAULT_VALUE => false);
     }
     if ($this->_id) {
         $this->fields['add_to_linux_fstab'][ONAPP_FIELD_REQUIRED] = false;
         $this->fields['data_store_id'][ONAPP_FIELD_REQUIRED] = false;
         $this->fields['is_swap'][ONAPP_FIELD_REQUIRED] = false;
         $this->fields['mount_point'][ONAPP_FIELD_REQUIRED] = false;
     }
     return parent::save();
 }
 /**
  * The method saves an Object to your account
  *
  * After sending an API request to create an object or change the data in
  * the existing object, the method checks the response and loads the
  * exisitng object with the new data.
  *
  * @return void
  * @access public
  */
 function save()
 {
     $fields = $this->fields;
     $_unset = array('priority', 'hostname', 'port', 'weight', 'ip', 'txt', 'serial', 'primaryNs', 'retry', 'refresh', 'minimum', 'expire', 'hostmaster');
     foreach ($_unset as $field) {
         $this->fields[$field][ONAPP_FIELD_REQUIRED] = false;
     }
     switch ($this->_type) {
         case 'MX':
             $this->fields['priority'][ONAPP_FIELD_REQUIRED] = $this->fields['hostname'][ONAPP_FIELD_REQUIRED] = true;
             break;
         case 'SRV':
             $this->fields['port'][ONAPP_FIELD_REQUIRED] = $this->fields['weight'][ONAPP_FIELD_REQUIRED] = $this->fields['priority'][ONAPP_FIELD_REQUIRED] = $this->fields['hostname'][ONAPP_FIELD_REQUIRED] = true;
             break;
         case 'A':
         case 'AAAA':
             $this->fields['ip'][ONAPP_FIELD_REQUIRED] = true;
             break;
         case 'CNAME':
         case 'NS':
             $this->fields['hostname'][ONAPP_FIELD_REQUIRED] = true;
             break;
         case 'TXT':
             $this->fields['txt'][ONAPP_FIELD_REQUIRED] = true;
             break;
         case 'SOA':
             trigger_error('Cannot save SOA record', E_USER_ERROR);
             break;
         default:
             trigger_error(sprintf("Cannot save '%s' record", $this->_type), E_USER_ERROR);
             break;
     }
     if (isset($this->_id)) {
         $obj = $this->_edit();
         $this->load();
     } else {
         return parent::save();
     }
     $this->fields = $fields;
 }
Ejemplo n.º 5
0
 public function save()
 {
     if (count($this->_countries) == 0) {
         unset($this->fields['countries']);
     }
     return parent::save();
 }
 /**
  * The method saves an Object to your account
  *
  * After sending an API request to create an object or change the data in
  * the existing object, the method checks the response and loads the
  * exisitng object with the new data.
  *
  * @return void
  * @access public
  */
 function save()
 {
     if (isset($this->_id)) {
         $obj = $this->_edit();
         $this->load();
     } else {
         parent::save();
     }
 }
Ejemplo n.º 7
0
 function save()
 {
     $passowrd = $this->fields['passwords'];
     unset($this->fields['passwords']);
     if (is_null($this->_countries) && isset($this->_obj)) {
         $this->_countries = $this->_obj->_countries;
     } elseif (is_null($this->_countries)) {
         $this->_countries = array('');
     }
     if (is_null($this->_secondary_hostnames) && isset($this->_obj) && count($this->_obj->_secondary_hostnames) != 0) {
         $this->_secondary_hostnames = $this->_obj->_secondary_hostnames;
     } else {
         $this->_secondary_hostnames = array('');
     }
     $return = parent::save();
     $this->fields['passwords'] = $passowrd;
     return $return;
 }
Ejemplo n.º 8
0
 function save()
 {
     if ($this->_target_id) {
         $this->fields['target_id'][ONAPP_FIELD_REQUIRED] = true;
         $this->fields['target_type'][ONAPP_FIELD_REQUIRED] = true;
         $this->fields['target_type'][ONAPP_FIELD_DEFAULT_VALUE] = 'Disk';
         $this->fields['action'][ONAPP_FIELD_REQUIRED] = true;
         $this->fields['action'][ONAPP_FIELD_DEFAULT_VALUE] = 'autobackup';
     }
     return parent::save();
 }
 /**
  * Creates or edits Load Balancing Cluster
  *
  * @return mixed API query response
  */
 function save()
 {
     $this->fields['load_balancer_attributes'] = array(ONAPP_FIELD_MAP => '_load_balancer_attributes');
     $this->fields['load_balancing_cluster_load_balancer_attributes'] = array(ONAPP_FIELD_MAP => '_load_balancing_cluster_load_balancer_attributes');
     $this->fields['auto_scaling_out_memory_attributes'] = array(ONAPP_FIELD_MAP => '_auto_scaling_out_memory_attributes');
     $this->fields['auto_scaling_out_cpu_attributes'] = array(ONAPP_FIELD_MAP => '_auto_scaling_out_cpu_attributes');
     $this->fields['auto_scaling_in_memory_attributes'] = array(ONAPP_FIELD_MAP => '_auto_scaling_in_memory_attributes');
     $this->fields['auto_scaling_in_cpu_attributes'] = array(ONAPP_FIELD_MAP => '_auto_scaling_in_cpu_attributes');
     $this->fields['available_vms'] = array(ONAPP_FIELD_MAP => '_available_vms');
     $this->fields['image_template_id'] = array(ONAPP_FIELD_MAP => '_image_template_id');
     parent::save();
     $this->initFields($this->getAPIVersion());
     return $result;
 }
 function save()
 {
     if ($this->_id) {
         $this->fields['hypervisor_group_id'][ONAPP_FIELD_REQUIRED] = false;
     }
     return parent::save();
 }