<?php

namespace App\Http\Controllers;

use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;

class VpsController extends Controller {
  public function serverList (Request $r) { // /api/rpc/vps/server/list
    // 許可確認
    // GMOかこのは？
    // 受け取り
    // リターン
    /*$check = $this->objAuth->checkLegit($r->kero_token);

    if ($check == 0) {
      return 'Err!';
    }
    else {
      $valid = $this->objAuth->getPermissions($r->kero_token);

      if ($valid['vps_list'] == 1) {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL,            'https://api.gmocloud.com/jp002/?Action=listNodes&AccessKeyId=HWWS0VHL1QJO59F0MK3E&Version=1.0'                   );
        // curl_setopt($ch, CURLOPT_HTTPHEADER,     array("Content-Type: text/xml"));
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE                           );
        curl_setopt($ch, CURLOPT_TIMEOUT,        30               );
        // curl_setopt($ch, CURLOPT_POSTFIELDS,     array();                           );
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE                           );

        $res = curl_exec($ch);
        return $res;
        // 'https://api.gmocloud.com/jp002/?Action=listNodes&AccessKeyId=HWWS0VHL1QJO59F0MK3E&Version=1.0'
      }
      else {
        return 'Permission denied.';
      }
    }*/
  }

  public function serverView (Request $r) { // /api/rpc/vps/server/view
  }

  public function domainList (Request $r) { // /api/rpc/vps/domain/list
    // 許可確認
    // OpenProviderかjp-domainかお名前？
    // 受け取り
    // リターン
  }

  public function domainView (Request $r) { // /api/rpc/vps/domain/view
  }
}
