<?php
namespace Airavata\Service\Iam\Admin\Services\CPI;
/**
 * 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;


interface IamAdminServicesIf extends \Airavata\Base\API\BaseAPIIf {
  /**
   * @param \Airavata\Model\Security\AuthzToken $authzToken
   * @param \Airavata\Model\Workspace\Gateway $gateway
   * @return \Airavata\Model\Workspace\Gateway
   * @throws \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
   * @throws \Airavata\API\Error\AuthorizationException
   */
  public function setUpGateway(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\Workspace\Gateway $gateway);
  /**
   * @param \Airavata\Model\Security\AuthzToken $authzToken
   * @param string $username
   * @return bool
   * @throws \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
   * @throws \Airavata\API\Error\AuthorizationException
   */
  public function isUsernameAvailable(\Airavata\Model\Security\AuthzToken $authzToken, $username);
  /**
   * @param \Airavata\Model\Security\AuthzToken $authzToken
   * @param string $username
   * @param string $emailAddress
   * @param string $firstName
   * @param string $lastName
   * @param string $newPassword
   * @return bool
   * @throws \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
   * @throws \Airavata\API\Error\AuthorizationException
   */
  public function registerUser(\Airavata\Model\Security\AuthzToken $authzToken, $username, $emailAddress, $firstName, $lastName, $newPassword);
  /**
   * @param \Airavata\Model\Security\AuthzToken $authzToken
   * @param string $username
   * @return bool
   * @throws \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
   * @throws \Airavata\API\Error\AuthorizationException
   */
  public function enableUser(\Airavata\Model\Security\AuthzToken $authzToken, $username);
  /**
   * @param \Airavata\Model\Security\AuthzToken $authzToken
   * @param string $username
   * @return bool
   * @throws \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
   * @throws \Airavata\API\Error\AuthorizationException
   */
  public function isUserEnabled(\Airavata\Model\Security\AuthzToken $authzToken, $username);
  /**
   * @param \Airavata\Model\Security\AuthzToken $authzToken
   * @param string $username
   * @return bool
   * @throws \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
   * @throws \Airavata\API\Error\AuthorizationException
   */
  public function isUserExist(\Airavata\Model\Security\AuthzToken $authzToken, $username);
  /**
   * @param \Airavata\Model\Security\AuthzToken $authzToken
   * @param string $username
   * @return \Airavata\Model\User\UserProfile * A structure holding the user profile and its child models.
   * *
   * * Notes:
   * *  The model does not include passwords as it is assumed an external identity provider is used to authenticate user.
   * *  References:
   * *     NSF Demographic Information - http://www.nsf.gov/pubs/2000/00form1225/00form1225.doc
   * *     LDAP Schema - https://tools.ietf.org/html/rfc4519
   * *     SCIM 2.0 - https://tools.ietf.org/html/rfc7643
   * *
   * * userModelVersion:
   * *  Version number of profile
   * *
   * * airavataInternalUserId:
   * *  internal to Airavata, not intended to be used outside of the Airavata platform or possibly by gateways
   * *  (that is, never shown to users), never reassigned, REQUIRED
   * *
   * * userId:
   * *  Externally assertable unique identifier. SAML (primarly in higher education, academic) tends to keep
   * *   user name less opaque. OpenID Connect maintains them to be opaque.
   * *
   * * firstName, middleName, lastName:
   * *  First and Last names as assertede by the user
   * *
   * * namePrefix, nameSuffix:
   * *  prefix and suffix to the users name as asserted by the user
   * *
   * * emails:
   * *   Email identifier are Verified, REQUIRED and MULTIVALUED
   * *
   * * userName:
   * *  Name-based identifiers can be multivalues. To keep it simple, Airavata will make it a string.
   * *   In the future these can be enumerated as:
   *     *   Official name (as asserted possibly by some external identity provider)
   *     *   Prefered name (as asserted or suggested by user directly)
   *     *   Components:
   *     *      givenName
   *     *      surname (familyName)
   *     *      displayName (often asserted by user to handle things like middle names, suffix, prefix, and the like)
   * *
   * * orcidId: ORCID ID - http://orcid.org/about/what-is-orcid)
   * *
   * * phones: Telephone MULTIVALUED
   * *
   * * country: Country of Residance
   * *
   * * nationality Countries of citizenship
   * *
   * * comments:
   * *   Free-form information (treated as opaque by Airavata and simply passed to resource).
   * *
   * * labeledURI:
   *   * Google Scholar, Web of Science, ACS, e.t.c
   * *
   * * timeZone:
   * *  User’s preferred timezone - IANA Timezone Databases - http://www.iana.org/time-zones.
   * *
   * 
   * @throws \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
   * @throws \Airavata\API\Error\AuthorizationException
   */
  public function getUser(\Airavata\Model\Security\AuthzToken $authzToken, $username);
  /**
   * @param \Airavata\Model\Security\AuthzToken $authzToken
   * @param int $offset
   * @param int $limit
   * @param string $search
   * @return \Airavata\Model\User\UserProfile[]
   * @throws \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
   * @throws \Airavata\API\Error\AuthorizationException
   */
  public function getUsers(\Airavata\Model\Security\AuthzToken $authzToken, $offset, $limit, $search);
  /**
   * @param \Airavata\Model\Security\AuthzToken $authzToken
   * @param string $username
   * @param string $newPassword
   * @return bool
   * @throws \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
   * @throws \Airavata\API\Error\AuthorizationException
   */
  public function resetUserPassword(\Airavata\Model\Security\AuthzToken $authzToken, $username, $newPassword);
  /**
   * @param \Airavata\Model\Security\AuthzToken $authzToken
   * @param string $email
   * @param string $userId
   * @return \Airavata\Model\User\UserProfile[]
   * @throws \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
   * @throws \Airavata\API\Error\AuthorizationException
   */
  public function findUsers(\Airavata\Model\Security\AuthzToken $authzToken, $email, $userId);
  /**
   * @param \Airavata\Model\Security\AuthzToken $authzToken
   * @param \Airavata\Model\User\UserProfile $userDetails
   * @throws \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
   * @throws \Airavata\API\Error\AuthorizationException
   */
  public function updateUserProfile(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userDetails);
  /**
   * @param \Airavata\Model\Security\AuthzToken $authzToken
   * @param string $username
   * @return bool
   * @throws \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
   * @throws \Airavata\API\Error\AuthorizationException
   */
  public function deleteUser(\Airavata\Model\Security\AuthzToken $authzToken, $username);
  /**
   * @param \Airavata\Model\Security\AuthzToken $authzToken
   * @param string $username
   * @param string $roleName
   * @return bool
   * @throws \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
   * @throws \Airavata\API\Error\AuthorizationException
   */
  public function addRoleToUser(\Airavata\Model\Security\AuthzToken $authzToken, $username, $roleName);
  /**
   * @param \Airavata\Model\Security\AuthzToken $authzToken
   * @param string $username
   * @param string $roleName
   * @return bool
   * @throws \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
   * @throws \Airavata\API\Error\AuthorizationException
   */
  public function removeRoleFromUser(\Airavata\Model\Security\AuthzToken $authzToken, $username, $roleName);
  /**
   * @param \Airavata\Model\Security\AuthzToken $authzToken
   * @param string $roleName
   * @return \Airavata\Model\User\UserProfile[]
   * @throws \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
   * @throws \Airavata\API\Error\AuthorizationException
   */
  public function getUsersWithRole(\Airavata\Model\Security\AuthzToken $authzToken, $roleName);
}


class IamAdminServicesClient extends \Airavata\Base\API\BaseAPIClient implements \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServicesIf {
  public function __construct($input, $output=null) {
    parent::__construct($input, $output);
  }

  public function setUpGateway(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\Workspace\Gateway $gateway)
  {
    $this->send_setUpGateway($authzToken, $gateway);
    return $this->recv_setUpGateway();
  }

  public function send_setUpGateway(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\Workspace\Gateway $gateway)
  {
    $args = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_setUpGateway_args();
    $args->authzToken = $authzToken;
    $args->gateway = $gateway;
    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
    if ($bin_accel)
    {
      thrift_protocol_write_binary($this->output_, 'setUpGateway', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
    }
    else
    {
      $this->output_->writeMessageBegin('setUpGateway', TMessageType::CALL, $this->seqid_);
      $args->write($this->output_);
      $this->output_->writeMessageEnd();
      $this->output_->getTransport()->flush();
    }
  }

  public function recv_setUpGateway()
  {
    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_setUpGateway_result', $this->input_->isStrictRead());
    else
    {
      $rseqid = 0;
      $fname = null;
      $mtype = 0;

      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
      if ($mtype == TMessageType::EXCEPTION) {
        $x = new TApplicationException();
        $x->read($this->input_);
        $this->input_->readMessageEnd();
        throw $x;
      }
      $result = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_setUpGateway_result();
      $result->read($this->input_);
      $this->input_->readMessageEnd();
    }
    if ($result->success !== null) {
      return $result->success;
    }
    if ($result->Idse !== null) {
      throw $result->Idse;
    }
    if ($result->ae !== null) {
      throw $result->ae;
    }
    throw new \Exception("setUpGateway failed: unknown result");
  }

  public function isUsernameAvailable(\Airavata\Model\Security\AuthzToken $authzToken, $username)
  {
    $this->send_isUsernameAvailable($authzToken, $username);
    return $this->recv_isUsernameAvailable();
  }

  public function send_isUsernameAvailable(\Airavata\Model\Security\AuthzToken $authzToken, $username)
  {
    $args = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_isUsernameAvailable_args();
    $args->authzToken = $authzToken;
    $args->username = $username;
    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
    if ($bin_accel)
    {
      thrift_protocol_write_binary($this->output_, 'isUsernameAvailable', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
    }
    else
    {
      $this->output_->writeMessageBegin('isUsernameAvailable', TMessageType::CALL, $this->seqid_);
      $args->write($this->output_);
      $this->output_->writeMessageEnd();
      $this->output_->getTransport()->flush();
    }
  }

  public function recv_isUsernameAvailable()
  {
    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_isUsernameAvailable_result', $this->input_->isStrictRead());
    else
    {
      $rseqid = 0;
      $fname = null;
      $mtype = 0;

      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
      if ($mtype == TMessageType::EXCEPTION) {
        $x = new TApplicationException();
        $x->read($this->input_);
        $this->input_->readMessageEnd();
        throw $x;
      }
      $result = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_isUsernameAvailable_result();
      $result->read($this->input_);
      $this->input_->readMessageEnd();
    }
    if ($result->success !== null) {
      return $result->success;
    }
    if ($result->Idse !== null) {
      throw $result->Idse;
    }
    if ($result->ae !== null) {
      throw $result->ae;
    }
    throw new \Exception("isUsernameAvailable failed: unknown result");
  }

  public function registerUser(\Airavata\Model\Security\AuthzToken $authzToken, $username, $emailAddress, $firstName, $lastName, $newPassword)
  {
    $this->send_registerUser($authzToken, $username, $emailAddress, $firstName, $lastName, $newPassword);
    return $this->recv_registerUser();
  }

  public function send_registerUser(\Airavata\Model\Security\AuthzToken $authzToken, $username, $emailAddress, $firstName, $lastName, $newPassword)
  {
    $args = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_registerUser_args();
    $args->authzToken = $authzToken;
    $args->username = $username;
    $args->emailAddress = $emailAddress;
    $args->firstName = $firstName;
    $args->lastName = $lastName;
    $args->newPassword = $newPassword;
    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
    if ($bin_accel)
    {
      thrift_protocol_write_binary($this->output_, 'registerUser', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
    }
    else
    {
      $this->output_->writeMessageBegin('registerUser', TMessageType::CALL, $this->seqid_);
      $args->write($this->output_);
      $this->output_->writeMessageEnd();
      $this->output_->getTransport()->flush();
    }
  }

  public function recv_registerUser()
  {
    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_registerUser_result', $this->input_->isStrictRead());
    else
    {
      $rseqid = 0;
      $fname = null;
      $mtype = 0;

      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
      if ($mtype == TMessageType::EXCEPTION) {
        $x = new TApplicationException();
        $x->read($this->input_);
        $this->input_->readMessageEnd();
        throw $x;
      }
      $result = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_registerUser_result();
      $result->read($this->input_);
      $this->input_->readMessageEnd();
    }
    if ($result->success !== null) {
      return $result->success;
    }
    if ($result->Idse !== null) {
      throw $result->Idse;
    }
    if ($result->ae !== null) {
      throw $result->ae;
    }
    throw new \Exception("registerUser failed: unknown result");
  }

  public function enableUser(\Airavata\Model\Security\AuthzToken $authzToken, $username)
  {
    $this->send_enableUser($authzToken, $username);
    return $this->recv_enableUser();
  }

  public function send_enableUser(\Airavata\Model\Security\AuthzToken $authzToken, $username)
  {
    $args = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_enableUser_args();
    $args->authzToken = $authzToken;
    $args->username = $username;
    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
    if ($bin_accel)
    {
      thrift_protocol_write_binary($this->output_, 'enableUser', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
    }
    else
    {
      $this->output_->writeMessageBegin('enableUser', TMessageType::CALL, $this->seqid_);
      $args->write($this->output_);
      $this->output_->writeMessageEnd();
      $this->output_->getTransport()->flush();
    }
  }

  public function recv_enableUser()
  {
    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_enableUser_result', $this->input_->isStrictRead());
    else
    {
      $rseqid = 0;
      $fname = null;
      $mtype = 0;

      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
      if ($mtype == TMessageType::EXCEPTION) {
        $x = new TApplicationException();
        $x->read($this->input_);
        $this->input_->readMessageEnd();
        throw $x;
      }
      $result = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_enableUser_result();
      $result->read($this->input_);
      $this->input_->readMessageEnd();
    }
    if ($result->success !== null) {
      return $result->success;
    }
    if ($result->Idse !== null) {
      throw $result->Idse;
    }
    if ($result->ae !== null) {
      throw $result->ae;
    }
    throw new \Exception("enableUser failed: unknown result");
  }

  public function isUserEnabled(\Airavata\Model\Security\AuthzToken $authzToken, $username)
  {
    $this->send_isUserEnabled($authzToken, $username);
    return $this->recv_isUserEnabled();
  }

  public function send_isUserEnabled(\Airavata\Model\Security\AuthzToken $authzToken, $username)
  {
    $args = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_isUserEnabled_args();
    $args->authzToken = $authzToken;
    $args->username = $username;
    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
    if ($bin_accel)
    {
      thrift_protocol_write_binary($this->output_, 'isUserEnabled', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
    }
    else
    {
      $this->output_->writeMessageBegin('isUserEnabled', TMessageType::CALL, $this->seqid_);
      $args->write($this->output_);
      $this->output_->writeMessageEnd();
      $this->output_->getTransport()->flush();
    }
  }

  public function recv_isUserEnabled()
  {
    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_isUserEnabled_result', $this->input_->isStrictRead());
    else
    {
      $rseqid = 0;
      $fname = null;
      $mtype = 0;

      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
      if ($mtype == TMessageType::EXCEPTION) {
        $x = new TApplicationException();
        $x->read($this->input_);
        $this->input_->readMessageEnd();
        throw $x;
      }
      $result = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_isUserEnabled_result();
      $result->read($this->input_);
      $this->input_->readMessageEnd();
    }
    if ($result->success !== null) {
      return $result->success;
    }
    if ($result->Idse !== null) {
      throw $result->Idse;
    }
    if ($result->ae !== null) {
      throw $result->ae;
    }
    throw new \Exception("isUserEnabled failed: unknown result");
  }

  public function isUserExist(\Airavata\Model\Security\AuthzToken $authzToken, $username)
  {
    $this->send_isUserExist($authzToken, $username);
    return $this->recv_isUserExist();
  }

  public function send_isUserExist(\Airavata\Model\Security\AuthzToken $authzToken, $username)
  {
    $args = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_isUserExist_args();
    $args->authzToken = $authzToken;
    $args->username = $username;
    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
    if ($bin_accel)
    {
      thrift_protocol_write_binary($this->output_, 'isUserExist', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
    }
    else
    {
      $this->output_->writeMessageBegin('isUserExist', TMessageType::CALL, $this->seqid_);
      $args->write($this->output_);
      $this->output_->writeMessageEnd();
      $this->output_->getTransport()->flush();
    }
  }

  public function recv_isUserExist()
  {
    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_isUserExist_result', $this->input_->isStrictRead());
    else
    {
      $rseqid = 0;
      $fname = null;
      $mtype = 0;

      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
      if ($mtype == TMessageType::EXCEPTION) {
        $x = new TApplicationException();
        $x->read($this->input_);
        $this->input_->readMessageEnd();
        throw $x;
      }
      $result = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_isUserExist_result();
      $result->read($this->input_);
      $this->input_->readMessageEnd();
    }
    if ($result->success !== null) {
      return $result->success;
    }
    if ($result->Idse !== null) {
      throw $result->Idse;
    }
    if ($result->ae !== null) {
      throw $result->ae;
    }
    throw new \Exception("isUserExist failed: unknown result");
  }

  public function getUser(\Airavata\Model\Security\AuthzToken $authzToken, $username)
  {
    $this->send_getUser($authzToken, $username);
    return $this->recv_getUser();
  }

  public function send_getUser(\Airavata\Model\Security\AuthzToken $authzToken, $username)
  {
    $args = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_getUser_args();
    $args->authzToken = $authzToken;
    $args->username = $username;
    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
    if ($bin_accel)
    {
      thrift_protocol_write_binary($this->output_, 'getUser', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
    }
    else
    {
      $this->output_->writeMessageBegin('getUser', TMessageType::CALL, $this->seqid_);
      $args->write($this->output_);
      $this->output_->writeMessageEnd();
      $this->output_->getTransport()->flush();
    }
  }

  public function recv_getUser()
  {
    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_getUser_result', $this->input_->isStrictRead());
    else
    {
      $rseqid = 0;
      $fname = null;
      $mtype = 0;

      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
      if ($mtype == TMessageType::EXCEPTION) {
        $x = new TApplicationException();
        $x->read($this->input_);
        $this->input_->readMessageEnd();
        throw $x;
      }
      $result = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_getUser_result();
      $result->read($this->input_);
      $this->input_->readMessageEnd();
    }
    if ($result->success !== null) {
      return $result->success;
    }
    if ($result->Idse !== null) {
      throw $result->Idse;
    }
    if ($result->ae !== null) {
      throw $result->ae;
    }
    throw new \Exception("getUser failed: unknown result");
  }

  public function getUsers(\Airavata\Model\Security\AuthzToken $authzToken, $offset, $limit, $search)
  {
    $this->send_getUsers($authzToken, $offset, $limit, $search);
    return $this->recv_getUsers();
  }

  public function send_getUsers(\Airavata\Model\Security\AuthzToken $authzToken, $offset, $limit, $search)
  {
    $args = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_getUsers_args();
    $args->authzToken = $authzToken;
    $args->offset = $offset;
    $args->limit = $limit;
    $args->search = $search;
    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
    if ($bin_accel)
    {
      thrift_protocol_write_binary($this->output_, 'getUsers', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
    }
    else
    {
      $this->output_->writeMessageBegin('getUsers', TMessageType::CALL, $this->seqid_);
      $args->write($this->output_);
      $this->output_->writeMessageEnd();
      $this->output_->getTransport()->flush();
    }
  }

  public function recv_getUsers()
  {
    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_getUsers_result', $this->input_->isStrictRead());
    else
    {
      $rseqid = 0;
      $fname = null;
      $mtype = 0;

      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
      if ($mtype == TMessageType::EXCEPTION) {
        $x = new TApplicationException();
        $x->read($this->input_);
        $this->input_->readMessageEnd();
        throw $x;
      }
      $result = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_getUsers_result();
      $result->read($this->input_);
      $this->input_->readMessageEnd();
    }
    if ($result->success !== null) {
      return $result->success;
    }
    if ($result->Idse !== null) {
      throw $result->Idse;
    }
    if ($result->ae !== null) {
      throw $result->ae;
    }
    throw new \Exception("getUsers failed: unknown result");
  }

  public function resetUserPassword(\Airavata\Model\Security\AuthzToken $authzToken, $username, $newPassword)
  {
    $this->send_resetUserPassword($authzToken, $username, $newPassword);
    return $this->recv_resetUserPassword();
  }

  public function send_resetUserPassword(\Airavata\Model\Security\AuthzToken $authzToken, $username, $newPassword)
  {
    $args = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_resetUserPassword_args();
    $args->authzToken = $authzToken;
    $args->username = $username;
    $args->newPassword = $newPassword;
    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
    if ($bin_accel)
    {
      thrift_protocol_write_binary($this->output_, 'resetUserPassword', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
    }
    else
    {
      $this->output_->writeMessageBegin('resetUserPassword', TMessageType::CALL, $this->seqid_);
      $args->write($this->output_);
      $this->output_->writeMessageEnd();
      $this->output_->getTransport()->flush();
    }
  }

  public function recv_resetUserPassword()
  {
    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_resetUserPassword_result', $this->input_->isStrictRead());
    else
    {
      $rseqid = 0;
      $fname = null;
      $mtype = 0;

      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
      if ($mtype == TMessageType::EXCEPTION) {
        $x = new TApplicationException();
        $x->read($this->input_);
        $this->input_->readMessageEnd();
        throw $x;
      }
      $result = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_resetUserPassword_result();
      $result->read($this->input_);
      $this->input_->readMessageEnd();
    }
    if ($result->success !== null) {
      return $result->success;
    }
    if ($result->Idse !== null) {
      throw $result->Idse;
    }
    if ($result->ae !== null) {
      throw $result->ae;
    }
    throw new \Exception("resetUserPassword failed: unknown result");
  }

  public function findUsers(\Airavata\Model\Security\AuthzToken $authzToken, $email, $userId)
  {
    $this->send_findUsers($authzToken, $email, $userId);
    return $this->recv_findUsers();
  }

  public function send_findUsers(\Airavata\Model\Security\AuthzToken $authzToken, $email, $userId)
  {
    $args = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_findUsers_args();
    $args->authzToken = $authzToken;
    $args->email = $email;
    $args->userId = $userId;
    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
    if ($bin_accel)
    {
      thrift_protocol_write_binary($this->output_, 'findUsers', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
    }
    else
    {
      $this->output_->writeMessageBegin('findUsers', TMessageType::CALL, $this->seqid_);
      $args->write($this->output_);
      $this->output_->writeMessageEnd();
      $this->output_->getTransport()->flush();
    }
  }

  public function recv_findUsers()
  {
    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_findUsers_result', $this->input_->isStrictRead());
    else
    {
      $rseqid = 0;
      $fname = null;
      $mtype = 0;

      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
      if ($mtype == TMessageType::EXCEPTION) {
        $x = new TApplicationException();
        $x->read($this->input_);
        $this->input_->readMessageEnd();
        throw $x;
      }
      $result = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_findUsers_result();
      $result->read($this->input_);
      $this->input_->readMessageEnd();
    }
    if ($result->success !== null) {
      return $result->success;
    }
    if ($result->Idse !== null) {
      throw $result->Idse;
    }
    if ($result->ae !== null) {
      throw $result->ae;
    }
    throw new \Exception("findUsers failed: unknown result");
  }

  public function updateUserProfile(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userDetails)
  {
    $this->send_updateUserProfile($authzToken, $userDetails);
    $this->recv_updateUserProfile();
  }

  public function send_updateUserProfile(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userDetails)
  {
    $args = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_updateUserProfile_args();
    $args->authzToken = $authzToken;
    $args->userDetails = $userDetails;
    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
    if ($bin_accel)
    {
      thrift_protocol_write_binary($this->output_, 'updateUserProfile', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
    }
    else
    {
      $this->output_->writeMessageBegin('updateUserProfile', TMessageType::CALL, $this->seqid_);
      $args->write($this->output_);
      $this->output_->writeMessageEnd();
      $this->output_->getTransport()->flush();
    }
  }

  public function recv_updateUserProfile()
  {
    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_updateUserProfile_result', $this->input_->isStrictRead());
    else
    {
      $rseqid = 0;
      $fname = null;
      $mtype = 0;

      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
      if ($mtype == TMessageType::EXCEPTION) {
        $x = new TApplicationException();
        $x->read($this->input_);
        $this->input_->readMessageEnd();
        throw $x;
      }
      $result = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_updateUserProfile_result();
      $result->read($this->input_);
      $this->input_->readMessageEnd();
    }
    if ($result->Idse !== null) {
      throw $result->Idse;
    }
    if ($result->ae !== null) {
      throw $result->ae;
    }
    return;
  }

  public function deleteUser(\Airavata\Model\Security\AuthzToken $authzToken, $username)
  {
    $this->send_deleteUser($authzToken, $username);
    return $this->recv_deleteUser();
  }

  public function send_deleteUser(\Airavata\Model\Security\AuthzToken $authzToken, $username)
  {
    $args = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_deleteUser_args();
    $args->authzToken = $authzToken;
    $args->username = $username;
    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
    if ($bin_accel)
    {
      thrift_protocol_write_binary($this->output_, 'deleteUser', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
    }
    else
    {
      $this->output_->writeMessageBegin('deleteUser', TMessageType::CALL, $this->seqid_);
      $args->write($this->output_);
      $this->output_->writeMessageEnd();
      $this->output_->getTransport()->flush();
    }
  }

  public function recv_deleteUser()
  {
    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_deleteUser_result', $this->input_->isStrictRead());
    else
    {
      $rseqid = 0;
      $fname = null;
      $mtype = 0;

      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
      if ($mtype == TMessageType::EXCEPTION) {
        $x = new TApplicationException();
        $x->read($this->input_);
        $this->input_->readMessageEnd();
        throw $x;
      }
      $result = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_deleteUser_result();
      $result->read($this->input_);
      $this->input_->readMessageEnd();
    }
    if ($result->success !== null) {
      return $result->success;
    }
    if ($result->Idse !== null) {
      throw $result->Idse;
    }
    if ($result->ae !== null) {
      throw $result->ae;
    }
    throw new \Exception("deleteUser failed: unknown result");
  }

  public function addRoleToUser(\Airavata\Model\Security\AuthzToken $authzToken, $username, $roleName)
  {
    $this->send_addRoleToUser($authzToken, $username, $roleName);
    return $this->recv_addRoleToUser();
  }

  public function send_addRoleToUser(\Airavata\Model\Security\AuthzToken $authzToken, $username, $roleName)
  {
    $args = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_addRoleToUser_args();
    $args->authzToken = $authzToken;
    $args->username = $username;
    $args->roleName = $roleName;
    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
    if ($bin_accel)
    {
      thrift_protocol_write_binary($this->output_, 'addRoleToUser', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
    }
    else
    {
      $this->output_->writeMessageBegin('addRoleToUser', TMessageType::CALL, $this->seqid_);
      $args->write($this->output_);
      $this->output_->writeMessageEnd();
      $this->output_->getTransport()->flush();
    }
  }

  public function recv_addRoleToUser()
  {
    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_addRoleToUser_result', $this->input_->isStrictRead());
    else
    {
      $rseqid = 0;
      $fname = null;
      $mtype = 0;

      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
      if ($mtype == TMessageType::EXCEPTION) {
        $x = new TApplicationException();
        $x->read($this->input_);
        $this->input_->readMessageEnd();
        throw $x;
      }
      $result = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_addRoleToUser_result();
      $result->read($this->input_);
      $this->input_->readMessageEnd();
    }
    if ($result->success !== null) {
      return $result->success;
    }
    if ($result->Idse !== null) {
      throw $result->Idse;
    }
    if ($result->ae !== null) {
      throw $result->ae;
    }
    throw new \Exception("addRoleToUser failed: unknown result");
  }

  public function removeRoleFromUser(\Airavata\Model\Security\AuthzToken $authzToken, $username, $roleName)
  {
    $this->send_removeRoleFromUser($authzToken, $username, $roleName);
    return $this->recv_removeRoleFromUser();
  }

  public function send_removeRoleFromUser(\Airavata\Model\Security\AuthzToken $authzToken, $username, $roleName)
  {
    $args = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_removeRoleFromUser_args();
    $args->authzToken = $authzToken;
    $args->username = $username;
    $args->roleName = $roleName;
    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
    if ($bin_accel)
    {
      thrift_protocol_write_binary($this->output_, 'removeRoleFromUser', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
    }
    else
    {
      $this->output_->writeMessageBegin('removeRoleFromUser', TMessageType::CALL, $this->seqid_);
      $args->write($this->output_);
      $this->output_->writeMessageEnd();
      $this->output_->getTransport()->flush();
    }
  }

  public function recv_removeRoleFromUser()
  {
    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_removeRoleFromUser_result', $this->input_->isStrictRead());
    else
    {
      $rseqid = 0;
      $fname = null;
      $mtype = 0;

      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
      if ($mtype == TMessageType::EXCEPTION) {
        $x = new TApplicationException();
        $x->read($this->input_);
        $this->input_->readMessageEnd();
        throw $x;
      }
      $result = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_removeRoleFromUser_result();
      $result->read($this->input_);
      $this->input_->readMessageEnd();
    }
    if ($result->success !== null) {
      return $result->success;
    }
    if ($result->Idse !== null) {
      throw $result->Idse;
    }
    if ($result->ae !== null) {
      throw $result->ae;
    }
    throw new \Exception("removeRoleFromUser failed: unknown result");
  }

  public function getUsersWithRole(\Airavata\Model\Security\AuthzToken $authzToken, $roleName)
  {
    $this->send_getUsersWithRole($authzToken, $roleName);
    return $this->recv_getUsersWithRole();
  }

  public function send_getUsersWithRole(\Airavata\Model\Security\AuthzToken $authzToken, $roleName)
  {
    $args = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_getUsersWithRole_args();
    $args->authzToken = $authzToken;
    $args->roleName = $roleName;
    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
    if ($bin_accel)
    {
      thrift_protocol_write_binary($this->output_, 'getUsersWithRole', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
    }
    else
    {
      $this->output_->writeMessageBegin('getUsersWithRole', TMessageType::CALL, $this->seqid_);
      $args->write($this->output_);
      $this->output_->writeMessageEnd();
      $this->output_->getTransport()->flush();
    }
  }

  public function recv_getUsersWithRole()
  {
    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_getUsersWithRole_result', $this->input_->isStrictRead());
    else
    {
      $rseqid = 0;
      $fname = null;
      $mtype = 0;

      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
      if ($mtype == TMessageType::EXCEPTION) {
        $x = new TApplicationException();
        $x->read($this->input_);
        $this->input_->readMessageEnd();
        throw $x;
      }
      $result = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_getUsersWithRole_result();
      $result->read($this->input_);
      $this->input_->readMessageEnd();
    }
    if ($result->success !== null) {
      return $result->success;
    }
    if ($result->Idse !== null) {
      throw $result->Idse;
    }
    if ($result->ae !== null) {
      throw $result->ae;
    }
    throw new \Exception("getUsersWithRole failed: unknown result");
  }

}


// HELPER FUNCTIONS AND STRUCTURES

class IamAdminServices_setUpGateway_args {
  static $_TSPEC;

  /**
   * @var \Airavata\Model\Security\AuthzToken
   */
  public $authzToken = null;
  /**
   * @var \Airavata\Model\Workspace\Gateway
   */
  public $gateway = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'authzToken',
          'type' => TType::STRUCT,
          'class' => '\Airavata\Model\Security\AuthzToken',
          ),
        2 => array(
          'var' => 'gateway',
          'type' => TType::STRUCT,
          'class' => '\Airavata\Model\Workspace\Gateway',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['authzToken'])) {
        $this->authzToken = $vals['authzToken'];
      }
      if (isset($vals['gateway'])) {
        $this->gateway = $vals['gateway'];
      }
    }
  }

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

  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::STRUCT) {
            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
            $xfer += $this->authzToken->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->gateway = new \Airavata\Model\Workspace\Gateway();
            $xfer += $this->gateway->read($input);
          } 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('IamAdminServices_setUpGateway_args');
    if ($this->authzToken !== null) {
      if (!is_object($this->authzToken)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
      $xfer += $this->authzToken->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->gateway !== null) {
      if (!is_object($this->gateway)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('gateway', TType::STRUCT, 2);
      $xfer += $this->gateway->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class IamAdminServices_setUpGateway_result {
  static $_TSPEC;

  /**
   * @var \Airavata\Model\Workspace\Gateway
   */
  public $success = null;
  /**
   * @var \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
   */
  public $Idse = null;
  /**
   * @var \Airavata\API\Error\AuthorizationException
   */
  public $ae = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        0 => array(
          'var' => 'success',
          'type' => TType::STRUCT,
          'class' => '\Airavata\Model\Workspace\Gateway',
          ),
        1 => array(
          'var' => 'Idse',
          'type' => TType::STRUCT,
          'class' => '\Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException',
          ),
        2 => array(
          'var' => 'ae',
          'type' => TType::STRUCT,
          'class' => '\Airavata\API\Error\AuthorizationException',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['success'])) {
        $this->success = $vals['success'];
      }
      if (isset($vals['Idse'])) {
        $this->Idse = $vals['Idse'];
      }
      if (isset($vals['ae'])) {
        $this->ae = $vals['ae'];
      }
    }
  }

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

  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 0:
          if ($ftype == TType::STRUCT) {
            $this->success = new \Airavata\Model\Workspace\Gateway();
            $xfer += $this->success->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->Idse = new \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException();
            $xfer += $this->Idse->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->ae = new \Airavata\API\Error\AuthorizationException();
            $xfer += $this->ae->read($input);
          } 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('IamAdminServices_setUpGateway_result');
    if ($this->success !== null) {
      if (!is_object($this->success)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);
      $xfer += $this->success->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->Idse !== null) {
      $xfer += $output->writeFieldBegin('Idse', TType::STRUCT, 1);
      $xfer += $this->Idse->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->ae !== null) {
      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 2);
      $xfer += $this->ae->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class IamAdminServices_isUsernameAvailable_args {
  static $_TSPEC;

  /**
   * @var \Airavata\Model\Security\AuthzToken
   */
  public $authzToken = null;
  /**
   * @var string
   */
  public $username = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'authzToken',
          'type' => TType::STRUCT,
          'class' => '\Airavata\Model\Security\AuthzToken',
          ),
        2 => array(
          'var' => 'username',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['authzToken'])) {
        $this->authzToken = $vals['authzToken'];
      }
      if (isset($vals['username'])) {
        $this->username = $vals['username'];
      }
    }
  }

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

  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::STRUCT) {
            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
            $xfer += $this->authzToken->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->username);
          } 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('IamAdminServices_isUsernameAvailable_args');
    if ($this->authzToken !== null) {
      if (!is_object($this->authzToken)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
      $xfer += $this->authzToken->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->username !== null) {
      $xfer += $output->writeFieldBegin('username', TType::STRING, 2);
      $xfer += $output->writeString($this->username);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class IamAdminServices_isUsernameAvailable_result {
  static $_TSPEC;

  /**
   * @var bool
   */
  public $success = null;
  /**
   * @var \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
   */
  public $Idse = null;
  /**
   * @var \Airavata\API\Error\AuthorizationException
   */
  public $ae = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        0 => array(
          'var' => 'success',
          'type' => TType::BOOL,
          ),
        1 => array(
          'var' => 'Idse',
          'type' => TType::STRUCT,
          'class' => '\Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException',
          ),
        2 => array(
          'var' => 'ae',
          'type' => TType::STRUCT,
          'class' => '\Airavata\API\Error\AuthorizationException',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['success'])) {
        $this->success = $vals['success'];
      }
      if (isset($vals['Idse'])) {
        $this->Idse = $vals['Idse'];
      }
      if (isset($vals['ae'])) {
        $this->ae = $vals['ae'];
      }
    }
  }

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

  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 0:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->success);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->Idse = new \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException();
            $xfer += $this->Idse->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->ae = new \Airavata\API\Error\AuthorizationException();
            $xfer += $this->ae->read($input);
          } 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('IamAdminServices_isUsernameAvailable_result');
    if ($this->success !== null) {
      $xfer += $output->writeFieldBegin('success', TType::BOOL, 0);
      $xfer += $output->writeBool($this->success);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->Idse !== null) {
      $xfer += $output->writeFieldBegin('Idse', TType::STRUCT, 1);
      $xfer += $this->Idse->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->ae !== null) {
      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 2);
      $xfer += $this->ae->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class IamAdminServices_registerUser_args {
  static $_TSPEC;

  /**
   * @var \Airavata\Model\Security\AuthzToken
   */
  public $authzToken = null;
  /**
   * @var string
   */
  public $username = null;
  /**
   * @var string
   */
  public $emailAddress = null;
  /**
   * @var string
   */
  public $firstName = null;
  /**
   * @var string
   */
  public $lastName = null;
  /**
   * @var string
   */
  public $newPassword = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'authzToken',
          'type' => TType::STRUCT,
          'class' => '\Airavata\Model\Security\AuthzToken',
          ),
        2 => array(
          'var' => 'username',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'emailAddress',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'firstName',
          'type' => TType::STRING,
          ),
        5 => array(
          'var' => 'lastName',
          'type' => TType::STRING,
          ),
        6 => array(
          'var' => 'newPassword',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['authzToken'])) {
        $this->authzToken = $vals['authzToken'];
      }
      if (isset($vals['username'])) {
        $this->username = $vals['username'];
      }
      if (isset($vals['emailAddress'])) {
        $this->emailAddress = $vals['emailAddress'];
      }
      if (isset($vals['firstName'])) {
        $this->firstName = $vals['firstName'];
      }
      if (isset($vals['lastName'])) {
        $this->lastName = $vals['lastName'];
      }
      if (isset($vals['newPassword'])) {
        $this->newPassword = $vals['newPassword'];
      }
    }
  }

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

  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::STRUCT) {
            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
            $xfer += $this->authzToken->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->username);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->emailAddress);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->firstName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->lastName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->newPassword);
          } 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('IamAdminServices_registerUser_args');
    if ($this->authzToken !== null) {
      if (!is_object($this->authzToken)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
      $xfer += $this->authzToken->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->username !== null) {
      $xfer += $output->writeFieldBegin('username', TType::STRING, 2);
      $xfer += $output->writeString($this->username);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->emailAddress !== null) {
      $xfer += $output->writeFieldBegin('emailAddress', TType::STRING, 3);
      $xfer += $output->writeString($this->emailAddress);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->firstName !== null) {
      $xfer += $output->writeFieldBegin('firstName', TType::STRING, 4);
      $xfer += $output->writeString($this->firstName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->lastName !== null) {
      $xfer += $output->writeFieldBegin('lastName', TType::STRING, 5);
      $xfer += $output->writeString($this->lastName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->newPassword !== null) {
      $xfer += $output->writeFieldBegin('newPassword', TType::STRING, 6);
      $xfer += $output->writeString($this->newPassword);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class IamAdminServices_registerUser_result {
  static $_TSPEC;

  /**
   * @var bool
   */
  public $success = null;
  /**
   * @var \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
   */
  public $Idse = null;
  /**
   * @var \Airavata\API\Error\AuthorizationException
   */
  public $ae = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        0 => array(
          'var' => 'success',
          'type' => TType::BOOL,
          ),
        1 => array(
          'var' => 'Idse',
          'type' => TType::STRUCT,
          'class' => '\Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException',
          ),
        2 => array(
          'var' => 'ae',
          'type' => TType::STRUCT,
          'class' => '\Airavata\API\Error\AuthorizationException',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['success'])) {
        $this->success = $vals['success'];
      }
      if (isset($vals['Idse'])) {
        $this->Idse = $vals['Idse'];
      }
      if (isset($vals['ae'])) {
        $this->ae = $vals['ae'];
      }
    }
  }

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

  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 0:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->success);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->Idse = new \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException();
            $xfer += $this->Idse->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->ae = new \Airavata\API\Error\AuthorizationException();
            $xfer += $this->ae->read($input);
          } 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('IamAdminServices_registerUser_result');
    if ($this->success !== null) {
      $xfer += $output->writeFieldBegin('success', TType::BOOL, 0);
      $xfer += $output->writeBool($this->success);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->Idse !== null) {
      $xfer += $output->writeFieldBegin('Idse', TType::STRUCT, 1);
      $xfer += $this->Idse->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->ae !== null) {
      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 2);
      $xfer += $this->ae->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class IamAdminServices_enableUser_args {
  static $_TSPEC;

  /**
   * @var \Airavata\Model\Security\AuthzToken
   */
  public $authzToken = null;
  /**
   * @var string
   */
  public $username = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'authzToken',
          'type' => TType::STRUCT,
          'class' => '\Airavata\Model\Security\AuthzToken',
          ),
        2 => array(
          'var' => 'username',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['authzToken'])) {
        $this->authzToken = $vals['authzToken'];
      }
      if (isset($vals['username'])) {
        $this->username = $vals['username'];
      }
    }
  }

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

  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::STRUCT) {
            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
            $xfer += $this->authzToken->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->username);
          } 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('IamAdminServices_enableUser_args');
    if ($this->authzToken !== null) {
      if (!is_object($this->authzToken)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
      $xfer += $this->authzToken->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->username !== null) {
      $xfer += $output->writeFieldBegin('username', TType::STRING, 2);
      $xfer += $output->writeString($this->username);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class IamAdminServices_enableUser_result {
  static $_TSPEC;

  /**
   * @var bool
   */
  public $success = null;
  /**
   * @var \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
   */
  public $Idse = null;
  /**
   * @var \Airavata\API\Error\AuthorizationException
   */
  public $ae = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        0 => array(
          'var' => 'success',
          'type' => TType::BOOL,
          ),
        1 => array(
          'var' => 'Idse',
          'type' => TType::STRUCT,
          'class' => '\Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException',
          ),
        2 => array(
          'var' => 'ae',
          'type' => TType::STRUCT,
          'class' => '\Airavata\API\Error\AuthorizationException',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['success'])) {
        $this->success = $vals['success'];
      }
      if (isset($vals['Idse'])) {
        $this->Idse = $vals['Idse'];
      }
      if (isset($vals['ae'])) {
        $this->ae = $vals['ae'];
      }
    }
  }

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

  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 0:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->success);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->Idse = new \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException();
            $xfer += $this->Idse->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->ae = new \Airavata\API\Error\AuthorizationException();
            $xfer += $this->ae->read($input);
          } 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('IamAdminServices_enableUser_result');
    if ($this->success !== null) {
      $xfer += $output->writeFieldBegin('success', TType::BOOL, 0);
      $xfer += $output->writeBool($this->success);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->Idse !== null) {
      $xfer += $output->writeFieldBegin('Idse', TType::STRUCT, 1);
      $xfer += $this->Idse->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->ae !== null) {
      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 2);
      $xfer += $this->ae->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class IamAdminServices_isUserEnabled_args {
  static $_TSPEC;

  /**
   * @var \Airavata\Model\Security\AuthzToken
   */
  public $authzToken = null;
  /**
   * @var string
   */
  public $username = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'authzToken',
          'type' => TType::STRUCT,
          'class' => '\Airavata\Model\Security\AuthzToken',
          ),
        2 => array(
          'var' => 'username',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['authzToken'])) {
        $this->authzToken = $vals['authzToken'];
      }
      if (isset($vals['username'])) {
        $this->username = $vals['username'];
      }
    }
  }

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

  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::STRUCT) {
            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
            $xfer += $this->authzToken->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->username);
          } 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('IamAdminServices_isUserEnabled_args');
    if ($this->authzToken !== null) {
      if (!is_object($this->authzToken)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
      $xfer += $this->authzToken->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->username !== null) {
      $xfer += $output->writeFieldBegin('username', TType::STRING, 2);
      $xfer += $output->writeString($this->username);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class IamAdminServices_isUserEnabled_result {
  static $_TSPEC;

  /**
   * @var bool
   */
  public $success = null;
  /**
   * @var \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
   */
  public $Idse = null;
  /**
   * @var \Airavata\API\Error\AuthorizationException
   */
  public $ae = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        0 => array(
          'var' => 'success',
          'type' => TType::BOOL,
          ),
        1 => array(
          'var' => 'Idse',
          'type' => TType::STRUCT,
          'class' => '\Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException',
          ),
        2 => array(
          'var' => 'ae',
          'type' => TType::STRUCT,
          'class' => '\Airavata\API\Error\AuthorizationException',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['success'])) {
        $this->success = $vals['success'];
      }
      if (isset($vals['Idse'])) {
        $this->Idse = $vals['Idse'];
      }
      if (isset($vals['ae'])) {
        $this->ae = $vals['ae'];
      }
    }
  }

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

  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 0:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->success);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->Idse = new \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException();
            $xfer += $this->Idse->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->ae = new \Airavata\API\Error\AuthorizationException();
            $xfer += $this->ae->read($input);
          } 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('IamAdminServices_isUserEnabled_result');
    if ($this->success !== null) {
      $xfer += $output->writeFieldBegin('success', TType::BOOL, 0);
      $xfer += $output->writeBool($this->success);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->Idse !== null) {
      $xfer += $output->writeFieldBegin('Idse', TType::STRUCT, 1);
      $xfer += $this->Idse->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->ae !== null) {
      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 2);
      $xfer += $this->ae->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class IamAdminServices_isUserExist_args {
  static $_TSPEC;

  /**
   * @var \Airavata\Model\Security\AuthzToken
   */
  public $authzToken = null;
  /**
   * @var string
   */
  public $username = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'authzToken',
          'type' => TType::STRUCT,
          'class' => '\Airavata\Model\Security\AuthzToken',
          ),
        2 => array(
          'var' => 'username',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['authzToken'])) {
        $this->authzToken = $vals['authzToken'];
      }
      if (isset($vals['username'])) {
        $this->username = $vals['username'];
      }
    }
  }

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

  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::STRUCT) {
            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
            $xfer += $this->authzToken->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->username);
          } 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('IamAdminServices_isUserExist_args');
    if ($this->authzToken !== null) {
      if (!is_object($this->authzToken)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
      $xfer += $this->authzToken->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->username !== null) {
      $xfer += $output->writeFieldBegin('username', TType::STRING, 2);
      $xfer += $output->writeString($this->username);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class IamAdminServices_isUserExist_result {
  static $_TSPEC;

  /**
   * @var bool
   */
  public $success = null;
  /**
   * @var \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
   */
  public $Idse = null;
  /**
   * @var \Airavata\API\Error\AuthorizationException
   */
  public $ae = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        0 => array(
          'var' => 'success',
          'type' => TType::BOOL,
          ),
        1 => array(
          'var' => 'Idse',
          'type' => TType::STRUCT,
          'class' => '\Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException',
          ),
        2 => array(
          'var' => 'ae',
          'type' => TType::STRUCT,
          'class' => '\Airavata\API\Error\AuthorizationException',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['success'])) {
        $this->success = $vals['success'];
      }
      if (isset($vals['Idse'])) {
        $this->Idse = $vals['Idse'];
      }
      if (isset($vals['ae'])) {
        $this->ae = $vals['ae'];
      }
    }
  }

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

  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 0:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->success);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->Idse = new \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException();
            $xfer += $this->Idse->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->ae = new \Airavata\API\Error\AuthorizationException();
            $xfer += $this->ae->read($input);
          } 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('IamAdminServices_isUserExist_result');
    if ($this->success !== null) {
      $xfer += $output->writeFieldBegin('success', TType::BOOL, 0);
      $xfer += $output->writeBool($this->success);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->Idse !== null) {
      $xfer += $output->writeFieldBegin('Idse', TType::STRUCT, 1);
      $xfer += $this->Idse->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->ae !== null) {
      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 2);
      $xfer += $this->ae->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class IamAdminServices_getUser_args {
  static $_TSPEC;

  /**
   * @var \Airavata\Model\Security\AuthzToken
   */
  public $authzToken = null;
  /**
   * @var string
   */
  public $username = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'authzToken',
          'type' => TType::STRUCT,
          'class' => '\Airavata\Model\Security\AuthzToken',
          ),
        2 => array(
          'var' => 'username',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['authzToken'])) {
        $this->authzToken = $vals['authzToken'];
      }
      if (isset($vals['username'])) {
        $this->username = $vals['username'];
      }
    }
  }

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

  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::STRUCT) {
            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
            $xfer += $this->authzToken->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->username);
          } 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('IamAdminServices_getUser_args');
    if ($this->authzToken !== null) {
      if (!is_object($this->authzToken)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
      $xfer += $this->authzToken->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->username !== null) {
      $xfer += $output->writeFieldBegin('username', TType::STRING, 2);
      $xfer += $output->writeString($this->username);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class IamAdminServices_getUser_result {
  static $_TSPEC;

  /**
   * @var \Airavata\Model\User\UserProfile
   */
  public $success = null;
  /**
   * @var \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
   */
  public $Idse = null;
  /**
   * @var \Airavata\API\Error\AuthorizationException
   */
  public $ae = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        0 => array(
          'var' => 'success',
          'type' => TType::STRUCT,
          'class' => '\Airavata\Model\User\UserProfile',
          ),
        1 => array(
          'var' => 'Idse',
          'type' => TType::STRUCT,
          'class' => '\Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException',
          ),
        2 => array(
          'var' => 'ae',
          'type' => TType::STRUCT,
          'class' => '\Airavata\API\Error\AuthorizationException',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['success'])) {
        $this->success = $vals['success'];
      }
      if (isset($vals['Idse'])) {
        $this->Idse = $vals['Idse'];
      }
      if (isset($vals['ae'])) {
        $this->ae = $vals['ae'];
      }
    }
  }

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

  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 0:
          if ($ftype == TType::STRUCT) {
            $this->success = new \Airavata\Model\User\UserProfile();
            $xfer += $this->success->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->Idse = new \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException();
            $xfer += $this->Idse->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->ae = new \Airavata\API\Error\AuthorizationException();
            $xfer += $this->ae->read($input);
          } 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('IamAdminServices_getUser_result');
    if ($this->success !== null) {
      if (!is_object($this->success)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);
      $xfer += $this->success->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->Idse !== null) {
      $xfer += $output->writeFieldBegin('Idse', TType::STRUCT, 1);
      $xfer += $this->Idse->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->ae !== null) {
      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 2);
      $xfer += $this->ae->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class IamAdminServices_getUsers_args {
  static $_TSPEC;

  /**
   * @var \Airavata\Model\Security\AuthzToken
   */
  public $authzToken = null;
  /**
   * @var int
   */
  public $offset = null;
  /**
   * @var int
   */
  public $limit = null;
  /**
   * @var string
   */
  public $search = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'authzToken',
          'type' => TType::STRUCT,
          'class' => '\Airavata\Model\Security\AuthzToken',
          ),
        2 => array(
          'var' => 'offset',
          'type' => TType::I32,
          ),
        3 => array(
          'var' => 'limit',
          'type' => TType::I32,
          ),
        4 => array(
          'var' => 'search',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['authzToken'])) {
        $this->authzToken = $vals['authzToken'];
      }
      if (isset($vals['offset'])) {
        $this->offset = $vals['offset'];
      }
      if (isset($vals['limit'])) {
        $this->limit = $vals['limit'];
      }
      if (isset($vals['search'])) {
        $this->search = $vals['search'];
      }
    }
  }

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

  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::STRUCT) {
            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
            $xfer += $this->authzToken->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->offset);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->limit);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->search);
          } 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('IamAdminServices_getUsers_args');
    if ($this->authzToken !== null) {
      if (!is_object($this->authzToken)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
      $xfer += $this->authzToken->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->offset !== null) {
      $xfer += $output->writeFieldBegin('offset', TType::I32, 2);
      $xfer += $output->writeI32($this->offset);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->limit !== null) {
      $xfer += $output->writeFieldBegin('limit', TType::I32, 3);
      $xfer += $output->writeI32($this->limit);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->search !== null) {
      $xfer += $output->writeFieldBegin('search', TType::STRING, 4);
      $xfer += $output->writeString($this->search);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class IamAdminServices_getUsers_result {
  static $_TSPEC;

  /**
   * @var \Airavata\Model\User\UserProfile[]
   */
  public $success = null;
  /**
   * @var \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
   */
  public $Idse = null;
  /**
   * @var \Airavata\API\Error\AuthorizationException
   */
  public $ae = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        0 => array(
          'var' => 'success',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\Airavata\Model\User\UserProfile',
            ),
          ),
        1 => array(
          'var' => 'Idse',
          'type' => TType::STRUCT,
          'class' => '\Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException',
          ),
        2 => array(
          'var' => 'ae',
          'type' => TType::STRUCT,
          'class' => '\Airavata\API\Error\AuthorizationException',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['success'])) {
        $this->success = $vals['success'];
      }
      if (isset($vals['Idse'])) {
        $this->Idse = $vals['Idse'];
      }
      if (isset($vals['ae'])) {
        $this->ae = $vals['ae'];
      }
    }
  }

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

  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 0:
          if ($ftype == TType::LST) {
            $this->success = array();
            $_size0 = 0;
            $_etype3 = 0;
            $xfer += $input->readListBegin($_etype3, $_size0);
            for ($_i4 = 0; $_i4 < $_size0; ++$_i4)
            {
              $elem5 = null;
              $elem5 = new \Airavata\Model\User\UserProfile();
              $xfer += $elem5->read($input);
              $this->success []= $elem5;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->Idse = new \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException();
            $xfer += $this->Idse->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->ae = new \Airavata\API\Error\AuthorizationException();
            $xfer += $this->ae->read($input);
          } 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('IamAdminServices_getUsers_result');
    if ($this->success !== null) {
      if (!is_array($this->success)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('success', TType::LST, 0);
      {
        $output->writeListBegin(TType::STRUCT, count($this->success));
        {
          foreach ($this->success as $iter6)
          {
            $xfer += $iter6->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->Idse !== null) {
      $xfer += $output->writeFieldBegin('Idse', TType::STRUCT, 1);
      $xfer += $this->Idse->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->ae !== null) {
      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 2);
      $xfer += $this->ae->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class IamAdminServices_resetUserPassword_args {
  static $_TSPEC;

  /**
   * @var \Airavata\Model\Security\AuthzToken
   */
  public $authzToken = null;
  /**
   * @var string
   */
  public $username = null;
  /**
   * @var string
   */
  public $newPassword = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'authzToken',
          'type' => TType::STRUCT,
          'class' => '\Airavata\Model\Security\AuthzToken',
          ),
        2 => array(
          'var' => 'username',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'newPassword',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['authzToken'])) {
        $this->authzToken = $vals['authzToken'];
      }
      if (isset($vals['username'])) {
        $this->username = $vals['username'];
      }
      if (isset($vals['newPassword'])) {
        $this->newPassword = $vals['newPassword'];
      }
    }
  }

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

  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::STRUCT) {
            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
            $xfer += $this->authzToken->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->username);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->newPassword);
          } 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('IamAdminServices_resetUserPassword_args');
    if ($this->authzToken !== null) {
      if (!is_object($this->authzToken)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
      $xfer += $this->authzToken->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->username !== null) {
      $xfer += $output->writeFieldBegin('username', TType::STRING, 2);
      $xfer += $output->writeString($this->username);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->newPassword !== null) {
      $xfer += $output->writeFieldBegin('newPassword', TType::STRING, 3);
      $xfer += $output->writeString($this->newPassword);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class IamAdminServices_resetUserPassword_result {
  static $_TSPEC;

  /**
   * @var bool
   */
  public $success = null;
  /**
   * @var \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
   */
  public $Idse = null;
  /**
   * @var \Airavata\API\Error\AuthorizationException
   */
  public $ae = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        0 => array(
          'var' => 'success',
          'type' => TType::BOOL,
          ),
        1 => array(
          'var' => 'Idse',
          'type' => TType::STRUCT,
          'class' => '\Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException',
          ),
        2 => array(
          'var' => 'ae',
          'type' => TType::STRUCT,
          'class' => '\Airavata\API\Error\AuthorizationException',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['success'])) {
        $this->success = $vals['success'];
      }
      if (isset($vals['Idse'])) {
        $this->Idse = $vals['Idse'];
      }
      if (isset($vals['ae'])) {
        $this->ae = $vals['ae'];
      }
    }
  }

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

  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 0:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->success);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->Idse = new \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException();
            $xfer += $this->Idse->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->ae = new \Airavata\API\Error\AuthorizationException();
            $xfer += $this->ae->read($input);
          } 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('IamAdminServices_resetUserPassword_result');
    if ($this->success !== null) {
      $xfer += $output->writeFieldBegin('success', TType::BOOL, 0);
      $xfer += $output->writeBool($this->success);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->Idse !== null) {
      $xfer += $output->writeFieldBegin('Idse', TType::STRUCT, 1);
      $xfer += $this->Idse->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->ae !== null) {
      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 2);
      $xfer += $this->ae->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class IamAdminServices_findUsers_args {
  static $_TSPEC;

  /**
   * @var \Airavata\Model\Security\AuthzToken
   */
  public $authzToken = null;
  /**
   * @var string
   */
  public $email = null;
  /**
   * @var string
   */
  public $userId = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'authzToken',
          'type' => TType::STRUCT,
          'class' => '\Airavata\Model\Security\AuthzToken',
          ),
        2 => array(
          'var' => 'email',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'userId',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['authzToken'])) {
        $this->authzToken = $vals['authzToken'];
      }
      if (isset($vals['email'])) {
        $this->email = $vals['email'];
      }
      if (isset($vals['userId'])) {
        $this->userId = $vals['userId'];
      }
    }
  }

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

  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::STRUCT) {
            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
            $xfer += $this->authzToken->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->email);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->userId);
          } 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('IamAdminServices_findUsers_args');
    if ($this->authzToken !== null) {
      if (!is_object($this->authzToken)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
      $xfer += $this->authzToken->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->email !== null) {
      $xfer += $output->writeFieldBegin('email', TType::STRING, 2);
      $xfer += $output->writeString($this->email);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->userId !== null) {
      $xfer += $output->writeFieldBegin('userId', TType::STRING, 3);
      $xfer += $output->writeString($this->userId);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class IamAdminServices_findUsers_result {
  static $_TSPEC;

  /**
   * @var \Airavata\Model\User\UserProfile[]
   */
  public $success = null;
  /**
   * @var \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
   */
  public $Idse = null;
  /**
   * @var \Airavata\API\Error\AuthorizationException
   */
  public $ae = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        0 => array(
          'var' => 'success',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\Airavata\Model\User\UserProfile',
            ),
          ),
        1 => array(
          'var' => 'Idse',
          'type' => TType::STRUCT,
          'class' => '\Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException',
          ),
        2 => array(
          'var' => 'ae',
          'type' => TType::STRUCT,
          'class' => '\Airavata\API\Error\AuthorizationException',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['success'])) {
        $this->success = $vals['success'];
      }
      if (isset($vals['Idse'])) {
        $this->Idse = $vals['Idse'];
      }
      if (isset($vals['ae'])) {
        $this->ae = $vals['ae'];
      }
    }
  }

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

  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 0:
          if ($ftype == TType::LST) {
            $this->success = array();
            $_size7 = 0;
            $_etype10 = 0;
            $xfer += $input->readListBegin($_etype10, $_size7);
            for ($_i11 = 0; $_i11 < $_size7; ++$_i11)
            {
              $elem12 = null;
              $elem12 = new \Airavata\Model\User\UserProfile();
              $xfer += $elem12->read($input);
              $this->success []= $elem12;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->Idse = new \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException();
            $xfer += $this->Idse->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->ae = new \Airavata\API\Error\AuthorizationException();
            $xfer += $this->ae->read($input);
          } 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('IamAdminServices_findUsers_result');
    if ($this->success !== null) {
      if (!is_array($this->success)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('success', TType::LST, 0);
      {
        $output->writeListBegin(TType::STRUCT, count($this->success));
        {
          foreach ($this->success as $iter13)
          {
            $xfer += $iter13->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->Idse !== null) {
      $xfer += $output->writeFieldBegin('Idse', TType::STRUCT, 1);
      $xfer += $this->Idse->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->ae !== null) {
      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 2);
      $xfer += $this->ae->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class IamAdminServices_updateUserProfile_args {
  static $_TSPEC;

  /**
   * @var \Airavata\Model\Security\AuthzToken
   */
  public $authzToken = null;
  /**
   * @var \Airavata\Model\User\UserProfile
   */
  public $userDetails = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'authzToken',
          'type' => TType::STRUCT,
          'class' => '\Airavata\Model\Security\AuthzToken',
          ),
        2 => array(
          'var' => 'userDetails',
          'type' => TType::STRUCT,
          'class' => '\Airavata\Model\User\UserProfile',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['authzToken'])) {
        $this->authzToken = $vals['authzToken'];
      }
      if (isset($vals['userDetails'])) {
        $this->userDetails = $vals['userDetails'];
      }
    }
  }

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

  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::STRUCT) {
            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
            $xfer += $this->authzToken->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->userDetails = new \Airavata\Model\User\UserProfile();
            $xfer += $this->userDetails->read($input);
          } 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('IamAdminServices_updateUserProfile_args');
    if ($this->authzToken !== null) {
      if (!is_object($this->authzToken)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
      $xfer += $this->authzToken->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->userDetails !== null) {
      if (!is_object($this->userDetails)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('userDetails', TType::STRUCT, 2);
      $xfer += $this->userDetails->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class IamAdminServices_updateUserProfile_result {
  static $_TSPEC;

  /**
   * @var \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
   */
  public $Idse = null;
  /**
   * @var \Airavata\API\Error\AuthorizationException
   */
  public $ae = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'Idse',
          'type' => TType::STRUCT,
          'class' => '\Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException',
          ),
        2 => array(
          'var' => 'ae',
          'type' => TType::STRUCT,
          'class' => '\Airavata\API\Error\AuthorizationException',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['Idse'])) {
        $this->Idse = $vals['Idse'];
      }
      if (isset($vals['ae'])) {
        $this->ae = $vals['ae'];
      }
    }
  }

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

  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::STRUCT) {
            $this->Idse = new \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException();
            $xfer += $this->Idse->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->ae = new \Airavata\API\Error\AuthorizationException();
            $xfer += $this->ae->read($input);
          } 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('IamAdminServices_updateUserProfile_result');
    if ($this->Idse !== null) {
      $xfer += $output->writeFieldBegin('Idse', TType::STRUCT, 1);
      $xfer += $this->Idse->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->ae !== null) {
      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 2);
      $xfer += $this->ae->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class IamAdminServices_deleteUser_args {
  static $_TSPEC;

  /**
   * @var \Airavata\Model\Security\AuthzToken
   */
  public $authzToken = null;
  /**
   * @var string
   */
  public $username = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'authzToken',
          'type' => TType::STRUCT,
          'class' => '\Airavata\Model\Security\AuthzToken',
          ),
        2 => array(
          'var' => 'username',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['authzToken'])) {
        $this->authzToken = $vals['authzToken'];
      }
      if (isset($vals['username'])) {
        $this->username = $vals['username'];
      }
    }
  }

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

  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::STRUCT) {
            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
            $xfer += $this->authzToken->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->username);
          } 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('IamAdminServices_deleteUser_args');
    if ($this->authzToken !== null) {
      if (!is_object($this->authzToken)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
      $xfer += $this->authzToken->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->username !== null) {
      $xfer += $output->writeFieldBegin('username', TType::STRING, 2);
      $xfer += $output->writeString($this->username);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class IamAdminServices_deleteUser_result {
  static $_TSPEC;

  /**
   * @var bool
   */
  public $success = null;
  /**
   * @var \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
   */
  public $Idse = null;
  /**
   * @var \Airavata\API\Error\AuthorizationException
   */
  public $ae = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        0 => array(
          'var' => 'success',
          'type' => TType::BOOL,
          ),
        1 => array(
          'var' => 'Idse',
          'type' => TType::STRUCT,
          'class' => '\Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException',
          ),
        2 => array(
          'var' => 'ae',
          'type' => TType::STRUCT,
          'class' => '\Airavata\API\Error\AuthorizationException',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['success'])) {
        $this->success = $vals['success'];
      }
      if (isset($vals['Idse'])) {
        $this->Idse = $vals['Idse'];
      }
      if (isset($vals['ae'])) {
        $this->ae = $vals['ae'];
      }
    }
  }

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

  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 0:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->success);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->Idse = new \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException();
            $xfer += $this->Idse->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->ae = new \Airavata\API\Error\AuthorizationException();
            $xfer += $this->ae->read($input);
          } 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('IamAdminServices_deleteUser_result');
    if ($this->success !== null) {
      $xfer += $output->writeFieldBegin('success', TType::BOOL, 0);
      $xfer += $output->writeBool($this->success);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->Idse !== null) {
      $xfer += $output->writeFieldBegin('Idse', TType::STRUCT, 1);
      $xfer += $this->Idse->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->ae !== null) {
      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 2);
      $xfer += $this->ae->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class IamAdminServices_addRoleToUser_args {
  static $_TSPEC;

  /**
   * @var \Airavata\Model\Security\AuthzToken
   */
  public $authzToken = null;
  /**
   * @var string
   */
  public $username = null;
  /**
   * @var string
   */
  public $roleName = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'authzToken',
          'type' => TType::STRUCT,
          'class' => '\Airavata\Model\Security\AuthzToken',
          ),
        2 => array(
          'var' => 'username',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'roleName',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['authzToken'])) {
        $this->authzToken = $vals['authzToken'];
      }
      if (isset($vals['username'])) {
        $this->username = $vals['username'];
      }
      if (isset($vals['roleName'])) {
        $this->roleName = $vals['roleName'];
      }
    }
  }

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

  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::STRUCT) {
            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
            $xfer += $this->authzToken->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->username);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->roleName);
          } 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('IamAdminServices_addRoleToUser_args');
    if ($this->authzToken !== null) {
      if (!is_object($this->authzToken)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
      $xfer += $this->authzToken->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->username !== null) {
      $xfer += $output->writeFieldBegin('username', TType::STRING, 2);
      $xfer += $output->writeString($this->username);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->roleName !== null) {
      $xfer += $output->writeFieldBegin('roleName', TType::STRING, 3);
      $xfer += $output->writeString($this->roleName);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class IamAdminServices_addRoleToUser_result {
  static $_TSPEC;

  /**
   * @var bool
   */
  public $success = null;
  /**
   * @var \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
   */
  public $Idse = null;
  /**
   * @var \Airavata\API\Error\AuthorizationException
   */
  public $ae = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        0 => array(
          'var' => 'success',
          'type' => TType::BOOL,
          ),
        1 => array(
          'var' => 'Idse',
          'type' => TType::STRUCT,
          'class' => '\Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException',
          ),
        2 => array(
          'var' => 'ae',
          'type' => TType::STRUCT,
          'class' => '\Airavata\API\Error\AuthorizationException',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['success'])) {
        $this->success = $vals['success'];
      }
      if (isset($vals['Idse'])) {
        $this->Idse = $vals['Idse'];
      }
      if (isset($vals['ae'])) {
        $this->ae = $vals['ae'];
      }
    }
  }

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

  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 0:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->success);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->Idse = new \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException();
            $xfer += $this->Idse->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->ae = new \Airavata\API\Error\AuthorizationException();
            $xfer += $this->ae->read($input);
          } 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('IamAdminServices_addRoleToUser_result');
    if ($this->success !== null) {
      $xfer += $output->writeFieldBegin('success', TType::BOOL, 0);
      $xfer += $output->writeBool($this->success);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->Idse !== null) {
      $xfer += $output->writeFieldBegin('Idse', TType::STRUCT, 1);
      $xfer += $this->Idse->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->ae !== null) {
      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 2);
      $xfer += $this->ae->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class IamAdminServices_removeRoleFromUser_args {
  static $_TSPEC;

  /**
   * @var \Airavata\Model\Security\AuthzToken
   */
  public $authzToken = null;
  /**
   * @var string
   */
  public $username = null;
  /**
   * @var string
   */
  public $roleName = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'authzToken',
          'type' => TType::STRUCT,
          'class' => '\Airavata\Model\Security\AuthzToken',
          ),
        2 => array(
          'var' => 'username',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'roleName',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['authzToken'])) {
        $this->authzToken = $vals['authzToken'];
      }
      if (isset($vals['username'])) {
        $this->username = $vals['username'];
      }
      if (isset($vals['roleName'])) {
        $this->roleName = $vals['roleName'];
      }
    }
  }

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

  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::STRUCT) {
            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
            $xfer += $this->authzToken->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->username);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->roleName);
          } 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('IamAdminServices_removeRoleFromUser_args');
    if ($this->authzToken !== null) {
      if (!is_object($this->authzToken)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
      $xfer += $this->authzToken->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->username !== null) {
      $xfer += $output->writeFieldBegin('username', TType::STRING, 2);
      $xfer += $output->writeString($this->username);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->roleName !== null) {
      $xfer += $output->writeFieldBegin('roleName', TType::STRING, 3);
      $xfer += $output->writeString($this->roleName);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class IamAdminServices_removeRoleFromUser_result {
  static $_TSPEC;

  /**
   * @var bool
   */
  public $success = null;
  /**
   * @var \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
   */
  public $Idse = null;
  /**
   * @var \Airavata\API\Error\AuthorizationException
   */
  public $ae = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        0 => array(
          'var' => 'success',
          'type' => TType::BOOL,
          ),
        1 => array(
          'var' => 'Idse',
          'type' => TType::STRUCT,
          'class' => '\Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException',
          ),
        2 => array(
          'var' => 'ae',
          'type' => TType::STRUCT,
          'class' => '\Airavata\API\Error\AuthorizationException',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['success'])) {
        $this->success = $vals['success'];
      }
      if (isset($vals['Idse'])) {
        $this->Idse = $vals['Idse'];
      }
      if (isset($vals['ae'])) {
        $this->ae = $vals['ae'];
      }
    }
  }

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

  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 0:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->success);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->Idse = new \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException();
            $xfer += $this->Idse->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->ae = new \Airavata\API\Error\AuthorizationException();
            $xfer += $this->ae->read($input);
          } 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('IamAdminServices_removeRoleFromUser_result');
    if ($this->success !== null) {
      $xfer += $output->writeFieldBegin('success', TType::BOOL, 0);
      $xfer += $output->writeBool($this->success);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->Idse !== null) {
      $xfer += $output->writeFieldBegin('Idse', TType::STRUCT, 1);
      $xfer += $this->Idse->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->ae !== null) {
      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 2);
      $xfer += $this->ae->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class IamAdminServices_getUsersWithRole_args {
  static $_TSPEC;

  /**
   * @var \Airavata\Model\Security\AuthzToken
   */
  public $authzToken = null;
  /**
   * @var string
   */
  public $roleName = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'authzToken',
          'type' => TType::STRUCT,
          'class' => '\Airavata\Model\Security\AuthzToken',
          ),
        2 => array(
          'var' => 'roleName',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['authzToken'])) {
        $this->authzToken = $vals['authzToken'];
      }
      if (isset($vals['roleName'])) {
        $this->roleName = $vals['roleName'];
      }
    }
  }

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

  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::STRUCT) {
            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
            $xfer += $this->authzToken->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->roleName);
          } 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('IamAdminServices_getUsersWithRole_args');
    if ($this->authzToken !== null) {
      if (!is_object($this->authzToken)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
      $xfer += $this->authzToken->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->roleName !== null) {
      $xfer += $output->writeFieldBegin('roleName', TType::STRING, 2);
      $xfer += $output->writeString($this->roleName);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class IamAdminServices_getUsersWithRole_result {
  static $_TSPEC;

  /**
   * @var \Airavata\Model\User\UserProfile[]
   */
  public $success = null;
  /**
   * @var \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
   */
  public $Idse = null;
  /**
   * @var \Airavata\API\Error\AuthorizationException
   */
  public $ae = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        0 => array(
          'var' => 'success',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\Airavata\Model\User\UserProfile',
            ),
          ),
        1 => array(
          'var' => 'Idse',
          'type' => TType::STRUCT,
          'class' => '\Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException',
          ),
        2 => array(
          'var' => 'ae',
          'type' => TType::STRUCT,
          'class' => '\Airavata\API\Error\AuthorizationException',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['success'])) {
        $this->success = $vals['success'];
      }
      if (isset($vals['Idse'])) {
        $this->Idse = $vals['Idse'];
      }
      if (isset($vals['ae'])) {
        $this->ae = $vals['ae'];
      }
    }
  }

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

  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 0:
          if ($ftype == TType::LST) {
            $this->success = array();
            $_size14 = 0;
            $_etype17 = 0;
            $xfer += $input->readListBegin($_etype17, $_size14);
            for ($_i18 = 0; $_i18 < $_size14; ++$_i18)
            {
              $elem19 = null;
              $elem19 = new \Airavata\Model\User\UserProfile();
              $xfer += $elem19->read($input);
              $this->success []= $elem19;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->Idse = new \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException();
            $xfer += $this->Idse->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->ae = new \Airavata\API\Error\AuthorizationException();
            $xfer += $this->ae->read($input);
          } 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('IamAdminServices_getUsersWithRole_result');
    if ($this->success !== null) {
      if (!is_array($this->success)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('success', TType::LST, 0);
      {
        $output->writeListBegin(TType::STRUCT, count($this->success));
        {
          foreach ($this->success as $iter20)
          {
            $xfer += $iter20->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->Idse !== null) {
      $xfer += $output->writeFieldBegin('Idse', TType::STRUCT, 1);
      $xfer += $this->Idse->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->ae !== null) {
      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 2);
      $xfer += $this->ae->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}


