<?php
namespace Airavata\Model\AppCatalog\GroupResourceProfile;

/**
 * Autogenerated by Thrift Compiler (0.10.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
use Thrift\Base\TBase;
use Thrift\Type\TType;
use Thrift\Type\TMessageType;
use Thrift\Exception\TException;
use Thrift\Exception\TProtocolException;
use Thrift\Protocol\TProtocol;
use Thrift\Protocol\TBinaryProtocolAccelerated;
use Thrift\Exception\TApplicationException;


class GroupAccountSSHProvisionerConfig {
  static $_TSPEC;

  /**
   * @var string
   */
  public $resourceId = null;
  /**
   * @var string
   */
  public $groupResourceProfileId = "DO_NOT_SET_AT_CLIENTS";
  /**
   * @var string
   */
  public $configName = null;
  /**
   * @var string
   */
  public $configValue = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'resourceId',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'groupResourceProfileId',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'configName',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'configValue',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['resourceId'])) {
        $this->resourceId = $vals['resourceId'];
      }
      if (isset($vals['groupResourceProfileId'])) {
        $this->groupResourceProfileId = $vals['groupResourceProfileId'];
      }
      if (isset($vals['configName'])) {
        $this->configName = $vals['configName'];
      }
      if (isset($vals['configValue'])) {
        $this->configValue = $vals['configValue'];
      }
    }
  }

  public function getName() {
    return 'GroupAccountSSHProvisionerConfig';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->resourceId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->groupResourceProfileId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->configName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->configValue);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('GroupAccountSSHProvisionerConfig');
    if ($this->resourceId !== null) {
      $xfer += $output->writeFieldBegin('resourceId', TType::STRING, 1);
      $xfer += $output->writeString($this->resourceId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->groupResourceProfileId !== null) {
      $xfer += $output->writeFieldBegin('groupResourceProfileId', TType::STRING, 2);
      $xfer += $output->writeString($this->groupResourceProfileId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->configName !== null) {
      $xfer += $output->writeFieldBegin('configName', TType::STRING, 3);
      $xfer += $output->writeString($this->configName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->configValue !== null) {
      $xfer += $output->writeFieldBegin('configValue', TType::STRING, 4);
      $xfer += $output->writeString($this->configValue);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class ComputeResourceReservation {
  static $_TSPEC;

  /**
   * @var string
   */
  public $reservationId = "DO_NOT_SET_AT_CLIENTS";
  /**
   * @var string
   */
  public $reservationName = null;
  /**
   * @var string[]
   */
  public $queueNames = null;
  /**
   * @var int
   */
  public $startTime = null;
  /**
   * @var int
   */
  public $endTime = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'reservationId',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'reservationName',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'queueNames',
          'type' => TType::LST,
          'etype' => TType::STRING,
          'elem' => array(
            'type' => TType::STRING,
            ),
          ),
        4 => array(
          'var' => 'startTime',
          'type' => TType::I64,
          ),
        5 => array(
          'var' => 'endTime',
          'type' => TType::I64,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['reservationId'])) {
        $this->reservationId = $vals['reservationId'];
      }
      if (isset($vals['reservationName'])) {
        $this->reservationName = $vals['reservationName'];
      }
      if (isset($vals['queueNames'])) {
        $this->queueNames = $vals['queueNames'];
      }
      if (isset($vals['startTime'])) {
        $this->startTime = $vals['startTime'];
      }
      if (isset($vals['endTime'])) {
        $this->endTime = $vals['endTime'];
      }
    }
  }

  public function getName() {
    return 'ComputeResourceReservation';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->reservationId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->reservationName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::LST) {
            $this->queueNames = array();
            $_size0 = 0;
            $_etype3 = 0;
            $xfer += $input->readListBegin($_etype3, $_size0);
            for ($_i4 = 0; $_i4 < $_size0; ++$_i4)
            {
              $elem5 = null;
              $xfer += $input->readString($elem5);
              $this->queueNames []= $elem5;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->startTime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->endTime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('ComputeResourceReservation');
    if ($this->reservationId !== null) {
      $xfer += $output->writeFieldBegin('reservationId', TType::STRING, 1);
      $xfer += $output->writeString($this->reservationId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->reservationName !== null) {
      $xfer += $output->writeFieldBegin('reservationName', TType::STRING, 2);
      $xfer += $output->writeString($this->reservationName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->queueNames !== null) {
      if (!is_array($this->queueNames)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('queueNames', TType::LST, 3);
      {
        $output->writeListBegin(TType::STRING, count($this->queueNames));
        {
          foreach ($this->queueNames as $iter6)
          {
            $xfer += $output->writeString($iter6);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->startTime !== null) {
      $xfer += $output->writeFieldBegin('startTime', TType::I64, 4);
      $xfer += $output->writeI64($this->startTime);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->endTime !== null) {
      $xfer += $output->writeFieldBegin('endTime', TType::I64, 5);
      $xfer += $output->writeI64($this->endTime);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class GroupComputeResourcePreference {
  static $_TSPEC;

  /**
   * @var string
   */
  public $computeResourceId = null;
  /**
   * @var string
   */
  public $groupResourceProfileId = "DO_NOT_SET_AT_CLIENTS";
  /**
   * @var bool
   */
  public $overridebyAiravata = true;
  /**
   * @var string
   */
  public $loginUserName = null;
  /**
   * @var int
   */
  public $preferredJobSubmissionProtocol = null;
  /**
   * @var int
   */
  public $preferredDataMovementProtocol = null;
  /**
   * @var string
   */
  public $preferredBatchQueue = null;
  /**
   * @var string
   */
  public $scratchLocation = null;
  /**
   * @var string
   */
  public $allocationProjectNumber = null;
  /**
   * @var string
   */
  public $resourceSpecificCredentialStoreToken = null;
  /**
   * @var string
   */
  public $usageReportingGatewayId = null;
  /**
   * @var string
   */
  public $qualityOfService = null;
  /**
   * @var string
   */
  public $sshAccountProvisioner = null;
  /**
   * @var \Airavata\Model\AppCatalog\GroupResourceProfile\GroupAccountSSHProvisionerConfig[]
   */
  public $groupSSHAccountProvisionerConfigs = null;
  /**
   * @var string
   */
  public $sshAccountProvisionerAdditionalInfo = null;
  /**
   * @var \Airavata\Model\AppCatalog\GroupResourceProfile\ComputeResourceReservation[]
   */
  public $reservations = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'computeResourceId',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'groupResourceProfileId',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'overridebyAiravata',
          'type' => TType::BOOL,
          ),
        4 => array(
          'var' => 'loginUserName',
          'type' => TType::STRING,
          ),
        5 => array(
          'var' => 'preferredJobSubmissionProtocol',
          'type' => TType::I32,
          ),
        6 => array(
          'var' => 'preferredDataMovementProtocol',
          'type' => TType::I32,
          ),
        7 => array(
          'var' => 'preferredBatchQueue',
          'type' => TType::STRING,
          ),
        8 => array(
          'var' => 'scratchLocation',
          'type' => TType::STRING,
          ),
        9 => array(
          'var' => 'allocationProjectNumber',
          'type' => TType::STRING,
          ),
        10 => array(
          'var' => 'resourceSpecificCredentialStoreToken',
          'type' => TType::STRING,
          ),
        11 => array(
          'var' => 'usageReportingGatewayId',
          'type' => TType::STRING,
          ),
        12 => array(
          'var' => 'qualityOfService',
          'type' => TType::STRING,
          ),
        16 => array(
          'var' => 'sshAccountProvisioner',
          'type' => TType::STRING,
          ),
        17 => array(
          'var' => 'groupSSHAccountProvisionerConfigs',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\Airavata\Model\AppCatalog\GroupResourceProfile\GroupAccountSSHProvisionerConfig',
            ),
          ),
        18 => array(
          'var' => 'sshAccountProvisionerAdditionalInfo',
          'type' => TType::STRING,
          ),
        19 => array(
          'var' => 'reservations',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\Airavata\Model\AppCatalog\GroupResourceProfile\ComputeResourceReservation',
            ),
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['computeResourceId'])) {
        $this->computeResourceId = $vals['computeResourceId'];
      }
      if (isset($vals['groupResourceProfileId'])) {
        $this->groupResourceProfileId = $vals['groupResourceProfileId'];
      }
      if (isset($vals['overridebyAiravata'])) {
        $this->overridebyAiravata = $vals['overridebyAiravata'];
      }
      if (isset($vals['loginUserName'])) {
        $this->loginUserName = $vals['loginUserName'];
      }
      if (isset($vals['preferredJobSubmissionProtocol'])) {
        $this->preferredJobSubmissionProtocol = $vals['preferredJobSubmissionProtocol'];
      }
      if (isset($vals['preferredDataMovementProtocol'])) {
        $this->preferredDataMovementProtocol = $vals['preferredDataMovementProtocol'];
      }
      if (isset($vals['preferredBatchQueue'])) {
        $this->preferredBatchQueue = $vals['preferredBatchQueue'];
      }
      if (isset($vals['scratchLocation'])) {
        $this->scratchLocation = $vals['scratchLocation'];
      }
      if (isset($vals['allocationProjectNumber'])) {
        $this->allocationProjectNumber = $vals['allocationProjectNumber'];
      }
      if (isset($vals['resourceSpecificCredentialStoreToken'])) {
        $this->resourceSpecificCredentialStoreToken = $vals['resourceSpecificCredentialStoreToken'];
      }
      if (isset($vals['usageReportingGatewayId'])) {
        $this->usageReportingGatewayId = $vals['usageReportingGatewayId'];
      }
      if (isset($vals['qualityOfService'])) {
        $this->qualityOfService = $vals['qualityOfService'];
      }
      if (isset($vals['sshAccountProvisioner'])) {
        $this->sshAccountProvisioner = $vals['sshAccountProvisioner'];
      }
      if (isset($vals['groupSSHAccountProvisionerConfigs'])) {
        $this->groupSSHAccountProvisionerConfigs = $vals['groupSSHAccountProvisionerConfigs'];
      }
      if (isset($vals['sshAccountProvisionerAdditionalInfo'])) {
        $this->sshAccountProvisionerAdditionalInfo = $vals['sshAccountProvisionerAdditionalInfo'];
      }
      if (isset($vals['reservations'])) {
        $this->reservations = $vals['reservations'];
      }
    }
  }

  public function getName() {
    return 'GroupComputeResourcePreference';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->computeResourceId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->groupResourceProfileId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->overridebyAiravata);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->loginUserName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->preferredJobSubmissionProtocol);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->preferredDataMovementProtocol);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 7:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->preferredBatchQueue);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 8:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->scratchLocation);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 9:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->allocationProjectNumber);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 10:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->resourceSpecificCredentialStoreToken);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 11:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->usageReportingGatewayId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 12:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->qualityOfService);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 16:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->sshAccountProvisioner);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 17:
          if ($ftype == TType::LST) {
            $this->groupSSHAccountProvisionerConfigs = array();
            $_size7 = 0;
            $_etype10 = 0;
            $xfer += $input->readListBegin($_etype10, $_size7);
            for ($_i11 = 0; $_i11 < $_size7; ++$_i11)
            {
              $elem12 = null;
              $elem12 = new \Airavata\Model\AppCatalog\GroupResourceProfile\GroupAccountSSHProvisionerConfig();
              $xfer += $elem12->read($input);
              $this->groupSSHAccountProvisionerConfigs []= $elem12;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 18:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->sshAccountProvisionerAdditionalInfo);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 19:
          if ($ftype == TType::LST) {
            $this->reservations = array();
            $_size13 = 0;
            $_etype16 = 0;
            $xfer += $input->readListBegin($_etype16, $_size13);
            for ($_i17 = 0; $_i17 < $_size13; ++$_i17)
            {
              $elem18 = null;
              $elem18 = new \Airavata\Model\AppCatalog\GroupResourceProfile\ComputeResourceReservation();
              $xfer += $elem18->read($input);
              $this->reservations []= $elem18;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('GroupComputeResourcePreference');
    if ($this->computeResourceId !== null) {
      $xfer += $output->writeFieldBegin('computeResourceId', TType::STRING, 1);
      $xfer += $output->writeString($this->computeResourceId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->groupResourceProfileId !== null) {
      $xfer += $output->writeFieldBegin('groupResourceProfileId', TType::STRING, 2);
      $xfer += $output->writeString($this->groupResourceProfileId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->overridebyAiravata !== null) {
      $xfer += $output->writeFieldBegin('overridebyAiravata', TType::BOOL, 3);
      $xfer += $output->writeBool($this->overridebyAiravata);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->loginUserName !== null) {
      $xfer += $output->writeFieldBegin('loginUserName', TType::STRING, 4);
      $xfer += $output->writeString($this->loginUserName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->preferredJobSubmissionProtocol !== null) {
      $xfer += $output->writeFieldBegin('preferredJobSubmissionProtocol', TType::I32, 5);
      $xfer += $output->writeI32($this->preferredJobSubmissionProtocol);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->preferredDataMovementProtocol !== null) {
      $xfer += $output->writeFieldBegin('preferredDataMovementProtocol', TType::I32, 6);
      $xfer += $output->writeI32($this->preferredDataMovementProtocol);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->preferredBatchQueue !== null) {
      $xfer += $output->writeFieldBegin('preferredBatchQueue', TType::STRING, 7);
      $xfer += $output->writeString($this->preferredBatchQueue);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->scratchLocation !== null) {
      $xfer += $output->writeFieldBegin('scratchLocation', TType::STRING, 8);
      $xfer += $output->writeString($this->scratchLocation);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->allocationProjectNumber !== null) {
      $xfer += $output->writeFieldBegin('allocationProjectNumber', TType::STRING, 9);
      $xfer += $output->writeString($this->allocationProjectNumber);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->resourceSpecificCredentialStoreToken !== null) {
      $xfer += $output->writeFieldBegin('resourceSpecificCredentialStoreToken', TType::STRING, 10);
      $xfer += $output->writeString($this->resourceSpecificCredentialStoreToken);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->usageReportingGatewayId !== null) {
      $xfer += $output->writeFieldBegin('usageReportingGatewayId', TType::STRING, 11);
      $xfer += $output->writeString($this->usageReportingGatewayId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->qualityOfService !== null) {
      $xfer += $output->writeFieldBegin('qualityOfService', TType::STRING, 12);
      $xfer += $output->writeString($this->qualityOfService);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->sshAccountProvisioner !== null) {
      $xfer += $output->writeFieldBegin('sshAccountProvisioner', TType::STRING, 16);
      $xfer += $output->writeString($this->sshAccountProvisioner);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->groupSSHAccountProvisionerConfigs !== null) {
      if (!is_array($this->groupSSHAccountProvisionerConfigs)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('groupSSHAccountProvisionerConfigs', TType::LST, 17);
      {
        $output->writeListBegin(TType::STRUCT, count($this->groupSSHAccountProvisionerConfigs));
        {
          foreach ($this->groupSSHAccountProvisionerConfigs as $iter19)
          {
            $xfer += $iter19->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->sshAccountProvisionerAdditionalInfo !== null) {
      $xfer += $output->writeFieldBegin('sshAccountProvisionerAdditionalInfo', TType::STRING, 18);
      $xfer += $output->writeString($this->sshAccountProvisionerAdditionalInfo);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->reservations !== null) {
      if (!is_array($this->reservations)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('reservations', TType::LST, 19);
      {
        $output->writeListBegin(TType::STRUCT, count($this->reservations));
        {
          foreach ($this->reservations as $iter20)
          {
            $xfer += $iter20->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class ComputeResourcePolicy {
  static $_TSPEC;

  /**
   * @var string
   */
  public $resourcePolicyId = "DO_NOT_SET_AT_CLIENTS";
  /**
   * @var string
   */
  public $computeResourceId = null;
  /**
   * @var string
   */
  public $groupResourceProfileId = "DO_NOT_SET_AT_CLIENTS";
  /**
   * @var string[]
   */
  public $allowedBatchQueues = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'resourcePolicyId',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'computeResourceId',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'groupResourceProfileId',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'allowedBatchQueues',
          'type' => TType::LST,
          'etype' => TType::STRING,
          'elem' => array(
            'type' => TType::STRING,
            ),
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['resourcePolicyId'])) {
        $this->resourcePolicyId = $vals['resourcePolicyId'];
      }
      if (isset($vals['computeResourceId'])) {
        $this->computeResourceId = $vals['computeResourceId'];
      }
      if (isset($vals['groupResourceProfileId'])) {
        $this->groupResourceProfileId = $vals['groupResourceProfileId'];
      }
      if (isset($vals['allowedBatchQueues'])) {
        $this->allowedBatchQueues = $vals['allowedBatchQueues'];
      }
    }
  }

  public function getName() {
    return 'ComputeResourcePolicy';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->resourcePolicyId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->computeResourceId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->groupResourceProfileId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::LST) {
            $this->allowedBatchQueues = array();
            $_size21 = 0;
            $_etype24 = 0;
            $xfer += $input->readListBegin($_etype24, $_size21);
            for ($_i25 = 0; $_i25 < $_size21; ++$_i25)
            {
              $elem26 = null;
              $xfer += $input->readString($elem26);
              $this->allowedBatchQueues []= $elem26;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('ComputeResourcePolicy');
    if ($this->resourcePolicyId !== null) {
      $xfer += $output->writeFieldBegin('resourcePolicyId', TType::STRING, 1);
      $xfer += $output->writeString($this->resourcePolicyId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->computeResourceId !== null) {
      $xfer += $output->writeFieldBegin('computeResourceId', TType::STRING, 2);
      $xfer += $output->writeString($this->computeResourceId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->groupResourceProfileId !== null) {
      $xfer += $output->writeFieldBegin('groupResourceProfileId', TType::STRING, 3);
      $xfer += $output->writeString($this->groupResourceProfileId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->allowedBatchQueues !== null) {
      if (!is_array($this->allowedBatchQueues)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('allowedBatchQueues', TType::LST, 4);
      {
        $output->writeListBegin(TType::STRING, count($this->allowedBatchQueues));
        {
          foreach ($this->allowedBatchQueues as $iter27)
          {
            $xfer += $output->writeString($iter27);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class BatchQueueResourcePolicy {
  static $_TSPEC;

  /**
   * @var string
   */
  public $resourcePolicyId = "DO_NOT_SET_AT_CLIENTS";
  /**
   * @var string
   */
  public $computeResourceId = null;
  /**
   * @var string
   */
  public $groupResourceProfileId = "DO_NOT_SET_AT_CLIENTS";
  /**
   * @var string
   */
  public $queuename = null;
  /**
   * @var int
   */
  public $maxAllowedNodes = null;
  /**
   * @var int
   */
  public $maxAllowedCores = null;
  /**
   * @var int
   */
  public $maxAllowedWalltime = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'resourcePolicyId',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'computeResourceId',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'groupResourceProfileId',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'queuename',
          'type' => TType::STRING,
          ),
        5 => array(
          'var' => 'maxAllowedNodes',
          'type' => TType::I32,
          ),
        6 => array(
          'var' => 'maxAllowedCores',
          'type' => TType::I32,
          ),
        7 => array(
          'var' => 'maxAllowedWalltime',
          'type' => TType::I32,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['resourcePolicyId'])) {
        $this->resourcePolicyId = $vals['resourcePolicyId'];
      }
      if (isset($vals['computeResourceId'])) {
        $this->computeResourceId = $vals['computeResourceId'];
      }
      if (isset($vals['groupResourceProfileId'])) {
        $this->groupResourceProfileId = $vals['groupResourceProfileId'];
      }
      if (isset($vals['queuename'])) {
        $this->queuename = $vals['queuename'];
      }
      if (isset($vals['maxAllowedNodes'])) {
        $this->maxAllowedNodes = $vals['maxAllowedNodes'];
      }
      if (isset($vals['maxAllowedCores'])) {
        $this->maxAllowedCores = $vals['maxAllowedCores'];
      }
      if (isset($vals['maxAllowedWalltime'])) {
        $this->maxAllowedWalltime = $vals['maxAllowedWalltime'];
      }
    }
  }

  public function getName() {
    return 'BatchQueueResourcePolicy';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->resourcePolicyId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->computeResourceId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->groupResourceProfileId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->queuename);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->maxAllowedNodes);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->maxAllowedCores);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 7:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->maxAllowedWalltime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('BatchQueueResourcePolicy');
    if ($this->resourcePolicyId !== null) {
      $xfer += $output->writeFieldBegin('resourcePolicyId', TType::STRING, 1);
      $xfer += $output->writeString($this->resourcePolicyId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->computeResourceId !== null) {
      $xfer += $output->writeFieldBegin('computeResourceId', TType::STRING, 2);
      $xfer += $output->writeString($this->computeResourceId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->groupResourceProfileId !== null) {
      $xfer += $output->writeFieldBegin('groupResourceProfileId', TType::STRING, 3);
      $xfer += $output->writeString($this->groupResourceProfileId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->queuename !== null) {
      $xfer += $output->writeFieldBegin('queuename', TType::STRING, 4);
      $xfer += $output->writeString($this->queuename);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->maxAllowedNodes !== null) {
      $xfer += $output->writeFieldBegin('maxAllowedNodes', TType::I32, 5);
      $xfer += $output->writeI32($this->maxAllowedNodes);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->maxAllowedCores !== null) {
      $xfer += $output->writeFieldBegin('maxAllowedCores', TType::I32, 6);
      $xfer += $output->writeI32($this->maxAllowedCores);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->maxAllowedWalltime !== null) {
      $xfer += $output->writeFieldBegin('maxAllowedWalltime', TType::I32, 7);
      $xfer += $output->writeI32($this->maxAllowedWalltime);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

/**
 * Group Resource Profile
 * 
 * gatewayID:
 *  Unique identifier for the gateway assigned by Airavata. Corelate this to Airavata Admin API Gateway Registration.
 * 
 * groupResourceProfileId:
 * 
 * computeResourcePreferences:
 *  List of resource preferences for each of the registered compute resources.
 * 
 * computeResourcePolicies:
 *  List of enforced policies for each of the registered compute resources.
 * 
 * batchQueueResourcePolicies:
 *  List of enforced policies on registered batch queues
 * 
 * defaultCredentialStoreToken:
 *  The default credential store token to use for compute resources that don't specify a resource specific credential store token.
 * 
 */
class GroupResourceProfile {
  static $_TSPEC;

  /**
   * @var string
   */
  public $gatewayId = null;
  /**
   * @var string
   */
  public $groupResourceProfileId = "DO_NOT_SET_AT_CLIENTS";
  /**
   * @var string
   */
  public $groupResourceProfileName = null;
  /**
   * @var \Airavata\Model\AppCatalog\GroupResourceProfile\GroupComputeResourcePreference[]
   */
  public $computePreferences = null;
  /**
   * @var \Airavata\Model\AppCatalog\GroupResourceProfile\ComputeResourcePolicy[]
   */
  public $computeResourcePolicies = null;
  /**
   * @var \Airavata\Model\AppCatalog\GroupResourceProfile\BatchQueueResourcePolicy[]
   */
  public $batchQueueResourcePolicies = null;
  /**
   * @var int
   */
  public $creationTime = null;
  /**
   * @var int
   */
  public $updatedTime = null;
  /**
   * @var string
   */
  public $defaultCredentialStoreToken = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'gatewayId',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'groupResourceProfileId',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'groupResourceProfileName',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'computePreferences',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\Airavata\Model\AppCatalog\GroupResourceProfile\GroupComputeResourcePreference',
            ),
          ),
        5 => array(
          'var' => 'computeResourcePolicies',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\Airavata\Model\AppCatalog\GroupResourceProfile\ComputeResourcePolicy',
            ),
          ),
        6 => array(
          'var' => 'batchQueueResourcePolicies',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\Airavata\Model\AppCatalog\GroupResourceProfile\BatchQueueResourcePolicy',
            ),
          ),
        7 => array(
          'var' => 'creationTime',
          'type' => TType::I64,
          ),
        8 => array(
          'var' => 'updatedTime',
          'type' => TType::I64,
          ),
        9 => array(
          'var' => 'defaultCredentialStoreToken',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['gatewayId'])) {
        $this->gatewayId = $vals['gatewayId'];
      }
      if (isset($vals['groupResourceProfileId'])) {
        $this->groupResourceProfileId = $vals['groupResourceProfileId'];
      }
      if (isset($vals['groupResourceProfileName'])) {
        $this->groupResourceProfileName = $vals['groupResourceProfileName'];
      }
      if (isset($vals['computePreferences'])) {
        $this->computePreferences = $vals['computePreferences'];
      }
      if (isset($vals['computeResourcePolicies'])) {
        $this->computeResourcePolicies = $vals['computeResourcePolicies'];
      }
      if (isset($vals['batchQueueResourcePolicies'])) {
        $this->batchQueueResourcePolicies = $vals['batchQueueResourcePolicies'];
      }
      if (isset($vals['creationTime'])) {
        $this->creationTime = $vals['creationTime'];
      }
      if (isset($vals['updatedTime'])) {
        $this->updatedTime = $vals['updatedTime'];
      }
      if (isset($vals['defaultCredentialStoreToken'])) {
        $this->defaultCredentialStoreToken = $vals['defaultCredentialStoreToken'];
      }
    }
  }

  public function getName() {
    return 'GroupResourceProfile';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->gatewayId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->groupResourceProfileId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->groupResourceProfileName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::LST) {
            $this->computePreferences = array();
            $_size28 = 0;
            $_etype31 = 0;
            $xfer += $input->readListBegin($_etype31, $_size28);
            for ($_i32 = 0; $_i32 < $_size28; ++$_i32)
            {
              $elem33 = null;
              $elem33 = new \Airavata\Model\AppCatalog\GroupResourceProfile\GroupComputeResourcePreference();
              $xfer += $elem33->read($input);
              $this->computePreferences []= $elem33;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::LST) {
            $this->computeResourcePolicies = array();
            $_size34 = 0;
            $_etype37 = 0;
            $xfer += $input->readListBegin($_etype37, $_size34);
            for ($_i38 = 0; $_i38 < $_size34; ++$_i38)
            {
              $elem39 = null;
              $elem39 = new \Airavata\Model\AppCatalog\GroupResourceProfile\ComputeResourcePolicy();
              $xfer += $elem39->read($input);
              $this->computeResourcePolicies []= $elem39;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::LST) {
            $this->batchQueueResourcePolicies = array();
            $_size40 = 0;
            $_etype43 = 0;
            $xfer += $input->readListBegin($_etype43, $_size40);
            for ($_i44 = 0; $_i44 < $_size40; ++$_i44)
            {
              $elem45 = null;
              $elem45 = new \Airavata\Model\AppCatalog\GroupResourceProfile\BatchQueueResourcePolicy();
              $xfer += $elem45->read($input);
              $this->batchQueueResourcePolicies []= $elem45;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 7:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->creationTime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 8:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->updatedTime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 9:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->defaultCredentialStoreToken);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('GroupResourceProfile');
    if ($this->gatewayId !== null) {
      $xfer += $output->writeFieldBegin('gatewayId', TType::STRING, 1);
      $xfer += $output->writeString($this->gatewayId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->groupResourceProfileId !== null) {
      $xfer += $output->writeFieldBegin('groupResourceProfileId', TType::STRING, 2);
      $xfer += $output->writeString($this->groupResourceProfileId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->groupResourceProfileName !== null) {
      $xfer += $output->writeFieldBegin('groupResourceProfileName', TType::STRING, 3);
      $xfer += $output->writeString($this->groupResourceProfileName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->computePreferences !== null) {
      if (!is_array($this->computePreferences)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('computePreferences', TType::LST, 4);
      {
        $output->writeListBegin(TType::STRUCT, count($this->computePreferences));
        {
          foreach ($this->computePreferences as $iter46)
          {
            $xfer += $iter46->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->computeResourcePolicies !== null) {
      if (!is_array($this->computeResourcePolicies)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('computeResourcePolicies', TType::LST, 5);
      {
        $output->writeListBegin(TType::STRUCT, count($this->computeResourcePolicies));
        {
          foreach ($this->computeResourcePolicies as $iter47)
          {
            $xfer += $iter47->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->batchQueueResourcePolicies !== null) {
      if (!is_array($this->batchQueueResourcePolicies)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('batchQueueResourcePolicies', TType::LST, 6);
      {
        $output->writeListBegin(TType::STRUCT, count($this->batchQueueResourcePolicies));
        {
          foreach ($this->batchQueueResourcePolicies as $iter48)
          {
            $xfer += $iter48->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->creationTime !== null) {
      $xfer += $output->writeFieldBegin('creationTime', TType::I64, 7);
      $xfer += $output->writeI64($this->creationTime);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->updatedTime !== null) {
      $xfer += $output->writeFieldBegin('updatedTime', TType::I64, 8);
      $xfer += $output->writeI64($this->updatedTime);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->defaultCredentialStoreToken !== null) {
      $xfer += $output->writeFieldBegin('defaultCredentialStoreToken', TType::STRING, 9);
      $xfer += $output->writeString($this->defaultCredentialStoreToken);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}


