Exemplo n.º 1
0
 public function taskProvisionServer($hostname, $region, $size, $image, $backups, $ipv6, $privateNetworking)
 {
     $configuration = new Configuration();
     $sshKeys = $configuration->sshKeys();
     $userData = $configuration->userData();
     return new ProvisionTask($hostname, $region, $size, $image, $backups, $ipv6, $privateNetworking, $sshKeys, AdapterFactory::make($configuration), $userData);
 }
Exemplo n.º 2
0
 public static function make(Configuration $config)
 {
     $provider = $config->provider();
     $adapter = null;
     switch ($provider) {
         case "digitalocean":
             $digitalOcean = new DigitalOceanV2(new Guzzle5Adapter($config->apiToken()));
             $adapter = new DigitalOceanAdapter($digitalOcean);
             break;
         default:
             throw new InvalidProviderException("{$provider} is not a valid cloud provider");
             break;
     }
     return $adapter;
 }