public function updateNode(Node $node, ParameterBag $parameters)
 {
     switch ($parameters->get('action')) {
         case 'passwordReset':
             return $this->digitalocean->droplet()->passwordReset($node->getId());
         case 'enableBackups':
             return $this->digitalocean->droplet()->enableBackups($node->getId());
         case 'disableBackups':
             return $this->digitalocean->droplet()->disableBackups($node->getId());
         case 'rename':
             return $this->digitalocean->droplet()->rename($node->getId(), $parameters->get('name'));
         case 'enableIpv6':
             return $this->digitalocean->droplet()->enableIpv6($node->getId());
         case 'enablePrivateNetworking':
             return $this->digitalocean->droplet()->enablePrivateNetworking($node->getId());
     }
 }
示例#2
0
 public function updateNode(Node $node, ParameterBag $parameters)
 {
     try {
         $command = new LinodeCommand('update');
         $options = ['linodeid' => $node->getId()];
         foreach ($command->getAllowedParameters() as $parameter) {
             $parameters->get($parameter) ? $options[$parameter] = $parameters->get($parameter) : null;
         }
         $command->setOptions($options);
         return $this->linode->execute($command);
     } catch (\Exception $e) {
         throw $e;
     }
 }
 /**
  * Get a server instance represented by the supplied Node, or an empty
  * server instance if a Node is not supplied.
  *
  * @param Node|null $node
  *
  * @return \OpenCloud\Compute\Resource\Server
  */
 protected function toServer(Node $node = null)
 {
     return $this->service->server($node ? $node->getId() : null);
 }