Adding updated thrift data models (includes Security API changes)
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/7ab87e53 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/7ab87e53 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/7ab87e53 Branch: refs/heads/master Commit: 7ab87e5319312e93b6308384dd54f6a352639065 Parents: f515c35 Author: Supun Nakandala <[email protected]> Authored: Wed Jun 3 01:43:44 2015 +0530 Committer: Supun Nakandala <[email protected]> Committed: Wed Jun 3 01:43:44 2015 +0530 ---------------------------------------------------------------------- .../main/resources/lib/airavata/Airavata.cpp | 61 +++++++++++++++++-- .../src/main/resources/lib/airavata/Airavata.h | 38 ++++++++---- .../lib/airavata/Airavata_server.skeleton.cpp | 2 +- .../resources/lib/airavata/airavataAPI_types.h | 1 + .../lib/airavata/airavataDataModel_types.h | 1 + .../resources/lib/Airavata/API/Airavata.php | 63 ++++++++++++++++++-- .../lib/apache/airavata/api/Airavata-remote | 8 +-- .../lib/apache/airavata/api/Airavata.py | 57 ++++++++++++++++-- .../resources/lib/apache/airavata/api/ttypes.py | 1 + .../lib/apache/airavata/model/ttypes.py | 1 + 10 files changed, 202 insertions(+), 31 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/7ab87e53/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.cpp ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.cpp b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.cpp index 52751cc..a46e7e5 100644 --- a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.cpp +++ b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.cpp @@ -36,6 +36,7 @@ uint32_t Airavata_getAPIVersion_args::read(::apache::thrift::protocol::TProtocol using ::apache::thrift::protocol::TProtocolException; + bool isset_authzToken = false; while (true) { @@ -43,12 +44,27 @@ uint32_t Airavata_getAPIVersion_args::read(::apache::thrift::protocol::TProtocol if (ftype == ::apache::thrift::protocol::T_STOP) { break; } - xfer += iprot->skip(ftype); + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->authzToken.read(iprot); + isset_authzToken = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } xfer += iprot->readFieldEnd(); } xfer += iprot->readStructEnd(); + if (!isset_authzToken) + throw TProtocolException(TProtocolException::INVALID_DATA); return xfer; } @@ -56,6 +72,10 @@ uint32_t Airavata_getAPIVersion_args::write(::apache::thrift::protocol::TProtoco uint32_t xfer = 0; xfer += oprot->writeStructBegin("Airavata_getAPIVersion_args"); + xfer += oprot->writeFieldBegin("authzToken", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->authzToken.write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); return xfer; @@ -65,6 +85,10 @@ uint32_t Airavata_getAPIVersion_pargs::write(::apache::thrift::protocol::TProtoc uint32_t xfer = 0; xfer += oprot->writeStructBegin("Airavata_getAPIVersion_pargs"); + xfer += oprot->writeFieldBegin("authzToken", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += (*(this->authzToken)).write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); return xfer; @@ -122,6 +146,14 @@ uint32_t Airavata_getAPIVersion_result::read(::apache::thrift::protocol::TProtoc xfer += iprot->skip(ftype); } break; + case 4: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ae.read(iprot); + this->__isset.ae = true; + } else { + xfer += iprot->skip(ftype); + } + break; default: xfer += iprot->skip(ftype); break; @@ -156,6 +188,10 @@ uint32_t Airavata_getAPIVersion_result::write(::apache::thrift::protocol::TProto xfer += oprot->writeFieldBegin("ase", ::apache::thrift::protocol::T_STRUCT, 3); xfer += this->ase.write(oprot); xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ae) { + xfer += oprot->writeFieldBegin("ae", ::apache::thrift::protocol::T_STRUCT, 4); + xfer += this->ae.write(oprot); + xfer += oprot->writeFieldEnd(); } xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); @@ -214,6 +250,14 @@ uint32_t Airavata_getAPIVersion_presult::read(::apache::thrift::protocol::TProto xfer += iprot->skip(ftype); } break; + case 4: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ae.read(iprot); + this->__isset.ae = true; + } else { + xfer += iprot->skip(ftype); + } + break; default: xfer += iprot->skip(ftype); break; @@ -32132,18 +32176,19 @@ uint32_t Airavata_isWorkflowExistWithName_presult::read(::apache::thrift::protoc return xfer; } -void AiravataClient::getAPIVersion(std::string& _return) +void AiravataClient::getAPIVersion(std::string& _return, const ::apache::airavata::model::security::AuthzToken& authzToken) { - send_getAPIVersion(); + send_getAPIVersion(authzToken); recv_getAPIVersion(_return); } -void AiravataClient::send_getAPIVersion() +void AiravataClient::send_getAPIVersion(const ::apache::airavata::model::security::AuthzToken& authzToken) { int32_t cseqid = 0; oprot_->writeMessageBegin("getAPIVersion", ::apache::thrift::protocol::T_CALL, cseqid); Airavata_getAPIVersion_pargs args; + args.authzToken = &authzToken; args.write(oprot_); oprot_->writeMessageEnd(); @@ -32195,6 +32240,9 @@ void AiravataClient::recv_getAPIVersion(std::string& _return) if (result.__isset.ase) { throw result.ase; } + if (result.__isset.ae) { + throw result.ae; + } throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "getAPIVersion failed: unknown result"); } @@ -40785,7 +40833,7 @@ void AiravataProcessor::process_getAPIVersion(int32_t seqid, ::apache::thrift::p Airavata_getAPIVersion_result result; try { - iface_->getAPIVersion(result.success); + iface_->getAPIVersion(result.success, args.authzToken); result.__isset.success = true; } catch ( ::apache::airavata::api::error::InvalidRequestException &ire) { result.ire = ire; @@ -40796,6 +40844,9 @@ void AiravataProcessor::process_getAPIVersion(int32_t seqid, ::apache::thrift::p } catch ( ::apache::airavata::api::error::AiravataSystemException &ase) { result.ase = ase; result.__isset.ase = true; + } catch ( ::apache::airavata::api::error::AuthorizationException &ae) { + result.ae = ae; + result.__isset.ae = true; } catch (const std::exception& e) { if (this->eventHandler_.get() != NULL) { this->eventHandler_->handlerError(ctx, "Airavata.getAPIVersion"); http://git-wip-us.apache.org/repos/asf/airavata/blob/7ab87e53/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.h ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.h b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.h index bc8071c..08503bd 100644 --- a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.h +++ b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.h @@ -32,7 +32,7 @@ namespace apache { namespace airavata { namespace api { class AiravataIf { public: virtual ~AiravataIf() {} - virtual void getAPIVersion(std::string& _return) = 0; + virtual void getAPIVersion(std::string& _return, const ::apache::airavata::model::security::AuthzToken& authzToken) = 0; virtual void addGateway(std::string& _return, const ::apache::airavata::model::workspace::Gateway& gateway) = 0; virtual void updateGateway(const std::string& gatewayId, const ::apache::airavata::model::workspace::Gateway& updatedGateway) = 0; virtual void getGateway( ::apache::airavata::model::workspace::Gateway& _return, const std::string& gatewayId) = 0; @@ -188,7 +188,7 @@ class AiravataIfSingletonFactory : virtual public AiravataIfFactory { class AiravataNull : virtual public AiravataIf { public: virtual ~AiravataNull() {} - void getAPIVersion(std::string& /* _return */) { + void getAPIVersion(std::string& /* _return */, const ::apache::airavata::model::security::AuthzToken& /* authzToken */) { return; } void addGateway(std::string& /* _return */, const ::apache::airavata::model::workspace::Gateway& /* gateway */) { @@ -615,9 +615,16 @@ class Airavata_getAPIVersion_args { virtual ~Airavata_getAPIVersion_args() throw() {} + ::apache::airavata::model::security::AuthzToken authzToken; - bool operator == (const Airavata_getAPIVersion_args & /* rhs */) const + void __set_authzToken(const ::apache::airavata::model::security::AuthzToken& val) { + authzToken = val; + } + + bool operator == (const Airavata_getAPIVersion_args & rhs) const { + if (!(authzToken == rhs.authzToken)) + return false; return true; } bool operator != (const Airavata_getAPIVersion_args &rhs) const { @@ -638,17 +645,19 @@ class Airavata_getAPIVersion_pargs { virtual ~Airavata_getAPIVersion_pargs() throw() {} + const ::apache::airavata::model::security::AuthzToken* authzToken; uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; typedef struct _Airavata_getAPIVersion_result__isset { - _Airavata_getAPIVersion_result__isset() : success(false), ire(false), ace(false), ase(false) {} + _Airavata_getAPIVersion_result__isset() : success(false), ire(false), ace(false), ase(false), ae(false) {} bool success; bool ire; bool ace; bool ase; + bool ae; } _Airavata_getAPIVersion_result__isset; class Airavata_getAPIVersion_result { @@ -663,6 +672,7 @@ class Airavata_getAPIVersion_result { ::apache::airavata::api::error::InvalidRequestException ire; ::apache::airavata::api::error::AiravataClientException ace; ::apache::airavata::api::error::AiravataSystemException ase; + ::apache::airavata::api::error::AuthorizationException ae; _Airavata_getAPIVersion_result__isset __isset; @@ -682,6 +692,10 @@ class Airavata_getAPIVersion_result { ase = val; } + void __set_ae(const ::apache::airavata::api::error::AuthorizationException& val) { + ae = val; + } + bool operator == (const Airavata_getAPIVersion_result & rhs) const { if (!(success == rhs.success)) @@ -692,6 +706,8 @@ class Airavata_getAPIVersion_result { return false; if (!(ase == rhs.ase)) return false; + if (!(ae == rhs.ae)) + return false; return true; } bool operator != (const Airavata_getAPIVersion_result &rhs) const { @@ -706,11 +722,12 @@ class Airavata_getAPIVersion_result { }; typedef struct _Airavata_getAPIVersion_presult__isset { - _Airavata_getAPIVersion_presult__isset() : success(false), ire(false), ace(false), ase(false) {} + _Airavata_getAPIVersion_presult__isset() : success(false), ire(false), ace(false), ase(false), ae(false) {} bool success; bool ire; bool ace; bool ase; + bool ae; } _Airavata_getAPIVersion_presult__isset; class Airavata_getAPIVersion_presult { @@ -723,6 +740,7 @@ class Airavata_getAPIVersion_presult { ::apache::airavata::api::error::InvalidRequestException ire; ::apache::airavata::api::error::AiravataClientException ace; ::apache::airavata::api::error::AiravataSystemException ase; + ::apache::airavata::api::error::AuthorizationException ae; _Airavata_getAPIVersion_presult__isset __isset; @@ -18308,8 +18326,8 @@ class AiravataClient : virtual public AiravataIf { boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { return poprot_; } - void getAPIVersion(std::string& _return); - void send_getAPIVersion(); + void getAPIVersion(std::string& _return, const ::apache::airavata::model::security::AuthzToken& authzToken); + void send_getAPIVersion(const ::apache::airavata::model::security::AuthzToken& authzToken); void recv_getAPIVersion(std::string& _return); void addGateway(std::string& _return, const ::apache::airavata::model::workspace::Gateway& gateway); void send_addGateway(const ::apache::airavata::model::workspace::Gateway& gateway); @@ -18989,13 +19007,13 @@ class AiravataMultiface : virtual public AiravataIf { ifaces_.push_back(iface); } public: - void getAPIVersion(std::string& _return) { + void getAPIVersion(std::string& _return, const ::apache::airavata::model::security::AuthzToken& authzToken) { size_t sz = ifaces_.size(); size_t i = 0; for (; i < (sz - 1); ++i) { - ifaces_[i]->getAPIVersion(_return); + ifaces_[i]->getAPIVersion(_return, authzToken); } - ifaces_[i]->getAPIVersion(_return); + ifaces_[i]->getAPIVersion(_return, authzToken); return; } http://git-wip-us.apache.org/repos/asf/airavata/blob/7ab87e53/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata_server.skeleton.cpp ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata_server.skeleton.cpp b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata_server.skeleton.cpp index d027257..ea886ac 100644 --- a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata_server.skeleton.cpp +++ b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata_server.skeleton.cpp @@ -39,7 +39,7 @@ class AiravataHandler : virtual public AiravataIf { // Your initialization goes here } - void getAPIVersion(std::string& _return) { + void getAPIVersion(std::string& _return, const ::apache::airavata::model::security::AuthzToken& authzToken) { // Your implementation goes here printf("getAPIVersion\n"); } http://git-wip-us.apache.org/repos/asf/airavata/blob/7ab87e53/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/airavataAPI_types.h ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/airavataAPI_types.h b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/airavataAPI_types.h index 54edb43..294487b 100644 --- a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/airavataAPI_types.h +++ b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/airavataAPI_types.h @@ -39,6 +39,7 @@ #include "applicationInterfaceModel_types.h" #include "gatewayResourceProfileModel_types.h" #include "workflowDataModel_types.h" +#include "securityModel_types.h" namespace apache { namespace airavata { namespace api { http://git-wip-us.apache.org/repos/asf/airavata/blob/7ab87e53/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/airavataDataModel_types.h ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/airavataDataModel_types.h b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/airavataDataModel_types.h index dfaad45..1ee8be5 100644 --- a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/airavataDataModel_types.h +++ b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/airavataDataModel_types.h @@ -33,6 +33,7 @@ #include "workspaceModel_types.h" #include "airavataErrors_types.h" #include "messagingEvents_types.h" +#include "securityModel_types.h" namespace apache { namespace airavata { namespace model { http://git-wip-us.apache.org/repos/asf/airavata/blob/7ab87e53/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php index 4a509b2..2532766 100644 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php @@ -17,7 +17,7 @@ use Thrift\Exception\TApplicationException; interface AiravataIf { - public function getAPIVersion(); + public function getAPIVersion(\Airavata\Model\Security\AuthzToken $authzToken); public function addGateway(\Airavata\Model\Workspace\Gateway $gateway); public function updateGateway($gatewayId, \Airavata\Model\Workspace\Gateway $updatedGateway); public function getGateway($gatewayId); @@ -157,15 +157,16 @@ class AiravataClient implements \Airavata\API\AiravataIf { $this->output_ = $output ? $output : $input; } - public function getAPIVersion() + public function getAPIVersion(\Airavata\Model\Security\AuthzToken $authzToken) { - $this->send_getAPIVersion(); + $this->send_getAPIVersion($authzToken); return $this->recv_getAPIVersion(); } - public function send_getAPIVersion() + public function send_getAPIVersion(\Airavata\Model\Security\AuthzToken $authzToken) { $args = new \Airavata\API\Airavata_getAPIVersion_args(); + $args->authzToken = $authzToken; $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary'); if ($bin_accel) { @@ -213,6 +214,9 @@ class AiravataClient implements \Airavata\API\AiravataIf { if ($result->ase !== null) { throw $result->ase; } + if ($result->ae !== null) { + throw $result->ae; + } throw new \Exception("getAPIVersion failed: unknown result"); } @@ -7904,12 +7908,23 @@ class AiravataClient implements \Airavata\API\AiravataIf { class Airavata_getAPIVersion_args { static $_TSPEC; + public $authzToken = null; - public function __construct() { + public function __construct($vals=null) { if (!isset(self::$_TSPEC)) { self::$_TSPEC = array( + 1 => array( + 'var' => 'authzToken', + 'type' => TType::STRUCT, + 'class' => '\Airavata\Model\Security\AuthzToken', + ), ); } + if (is_array($vals)) { + if (isset($vals['authzToken'])) { + $this->authzToken = $vals['authzToken']; + } + } } public function getName() { @@ -7931,6 +7946,14 @@ class Airavata_getAPIVersion_args { } 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; default: $xfer += $input->skip($ftype); break; @@ -7944,6 +7967,14 @@ class Airavata_getAPIVersion_args { public function write($output) { $xfer = 0; $xfer += $output->writeStructBegin('Airavata_getAPIVersion_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(); + } $xfer += $output->writeFieldStop(); $xfer += $output->writeStructEnd(); return $xfer; @@ -7958,6 +7989,7 @@ class Airavata_getAPIVersion_result { public $ire = null; public $ace = null; public $ase = null; + public $ae = null; public function __construct($vals=null) { if (!isset(self::$_TSPEC)) { @@ -7981,6 +8013,11 @@ class Airavata_getAPIVersion_result { 'type' => TType::STRUCT, 'class' => '\Airavata\API\Error\AiravataSystemException', ), + 4 => array( + 'var' => 'ae', + 'type' => TType::STRUCT, + 'class' => '\Airavata\API\Error\AuthorizationException', + ), ); } if (is_array($vals)) { @@ -7996,6 +8033,9 @@ class Airavata_getAPIVersion_result { if (isset($vals['ase'])) { $this->ase = $vals['ase']; } + if (isset($vals['ae'])) { + $this->ae = $vals['ae']; + } } } @@ -8049,6 +8089,14 @@ class Airavata_getAPIVersion_result { $xfer += $input->skip($ftype); } break; + case 4: + 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; @@ -8082,6 +8130,11 @@ class Airavata_getAPIVersion_result { $xfer += $this->ase->write($output); $xfer += $output->writeFieldEnd(); } + if ($this->ae !== null) { + $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 4); + $xfer += $this->ae->write($output); + $xfer += $output->writeFieldEnd(); + } $xfer += $output->writeFieldStop(); $xfer += $output->writeStructEnd(); return $xfer; http://git-wip-us.apache.org/repos/asf/airavata/blob/7ab87e53/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata-remote ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata-remote b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata-remote index ebd0d04..296fce8 100755 --- a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata-remote +++ b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata-remote @@ -23,7 +23,7 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help': print 'Usage: ' + sys.argv[0] + ' [-h host[:port]] [-u url] [-f[ramed]] function [arg1 [arg2...]]' print '' print 'Functions:' - print ' string getAPIVersion()' + print ' string getAPIVersion(AuthzToken authzToken)' print ' string addGateway(Gateway gateway)' print ' void updateGateway(string gatewayId, Gateway updatedGateway)' print ' Gateway getGateway(string gatewayId)' @@ -202,10 +202,10 @@ client = Airavata.Client(protocol) transport.open() if cmd == 'getAPIVersion': - if len(args) != 0: - print 'getAPIVersion requires 0 args' + if len(args) != 1: + print 'getAPIVersion requires 1 args' sys.exit(1) - pp.pprint(client.getAPIVersion()) + pp.pprint(client.getAPIVersion(eval(args[0]),)) elif cmd == 'addGateway': if len(args) != 1: http://git-wip-us.apache.org/repos/asf/airavata/blob/7ab87e53/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata.py ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata.py b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata.py index 6378dad..6a81820 100644 --- a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata.py +++ b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata.py @@ -18,9 +18,12 @@ except: class Iface: - def getAPIVersion(self): + def getAPIVersion(self, authzToken): """ Fetch Apache Airavata API version + + Parameters: + - authzToken """ pass @@ -2144,16 +2147,20 @@ class Client(Iface): self._oprot = oprot self._seqid = 0 - def getAPIVersion(self): + def getAPIVersion(self, authzToken): """ Fetch Apache Airavata API version + + Parameters: + - authzToken """ - self.send_getAPIVersion() + self.send_getAPIVersion(authzToken) return self.recv_getAPIVersion() - def send_getAPIVersion(self): + def send_getAPIVersion(self, authzToken): self._oprot.writeMessageBegin('getAPIVersion', TMessageType.CALL, self._seqid) args = getAPIVersion_args() + args.authzToken = authzToken args.write(self._oprot) self._oprot.writeMessageEnd() self._oprot.trans.flush() @@ -2176,6 +2183,8 @@ class Client(Iface): raise result.ace if result.ase is not None: raise result.ase + if result.ae is not None: + raise result.ae raise TApplicationException(TApplicationException.MISSING_RESULT, "getAPIVersion failed: unknown result"); def addGateway(self, gateway): @@ -8216,13 +8225,15 @@ class Processor(Iface, TProcessor): iprot.readMessageEnd() result = getAPIVersion_result() try: - result.success = self._handler.getAPIVersion() + result.success = self._handler.getAPIVersion(args.authzToken) except apache.airavata.api.error.ttypes.InvalidRequestException, ire: result.ire = ire except apache.airavata.api.error.ttypes.AiravataClientException, ace: result.ace = ace except apache.airavata.api.error.ttypes.AiravataSystemException, ase: result.ase = ase + except apache.airavata.api.error.ttypes.AuthorizationException, ae: + result.ae = ae oprot.writeMessageBegin("getAPIVersion", TMessageType.REPLY, seqid) result.write(oprot) oprot.writeMessageEnd() @@ -10522,10 +10533,19 @@ class Processor(Iface, TProcessor): # HELPER FUNCTIONS AND STRUCTURES class getAPIVersion_args: + """ + Attributes: + - authzToken + """ thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'authzToken', (apache.airavata.model.security.ttypes.AuthzToken, apache.airavata.model.security.ttypes.AuthzToken.thrift_spec), None, ), # 1 ) + def __init__(self, authzToken=None,): + self.authzToken = authzToken + def read(self, iprot): if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) @@ -10535,6 +10555,12 @@ class getAPIVersion_args: (fname, ftype, fid) = iprot.readFieldBegin() if ftype == TType.STOP: break + if fid == 1: + if ftype == TType.STRUCT: + self.authzToken = apache.airavata.model.security.ttypes.AuthzToken() + self.authzToken.read(iprot) + else: + iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() @@ -10545,10 +10571,16 @@ class getAPIVersion_args: oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) return oprot.writeStructBegin('getAPIVersion_args') + if self.authzToken is not None: + oprot.writeFieldBegin('authzToken', TType.STRUCT, 1) + self.authzToken.write(oprot) + oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() def validate(self): + if self.authzToken is None: + raise TProtocol.TProtocolException(message='Required field authzToken is unset!') return @@ -10570,6 +10602,7 @@ class getAPIVersion_result: - ire - ace - ase + - ae """ thrift_spec = ( @@ -10577,13 +10610,15 @@ class getAPIVersion_result: (1, TType.STRUCT, 'ire', (apache.airavata.api.error.ttypes.InvalidRequestException, apache.airavata.api.error.ttypes.InvalidRequestException.thrift_spec), None, ), # 1 (2, TType.STRUCT, 'ace', (apache.airavata.api.error.ttypes.AiravataClientException, apache.airavata.api.error.ttypes.AiravataClientException.thrift_spec), None, ), # 2 (3, TType.STRUCT, 'ase', (apache.airavata.api.error.ttypes.AiravataSystemException, apache.airavata.api.error.ttypes.AiravataSystemException.thrift_spec), None, ), # 3 + (4, TType.STRUCT, 'ae', (apache.airavata.api.error.ttypes.AuthorizationException, apache.airavata.api.error.ttypes.AuthorizationException.thrift_spec), None, ), # 4 ) - def __init__(self, success=None, ire=None, ace=None, ase=None,): + def __init__(self, success=None, ire=None, ace=None, ase=None, ae=None,): self.success = success self.ire = ire self.ace = ace self.ase = ase + self.ae = ae def read(self, iprot): if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: @@ -10617,6 +10652,12 @@ class getAPIVersion_result: self.ase.read(iprot) else: iprot.skip(ftype) + elif fid == 4: + if ftype == TType.STRUCT: + self.ae = apache.airavata.api.error.ttypes.AuthorizationException() + self.ae.read(iprot) + else: + iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() @@ -10643,6 +10684,10 @@ class getAPIVersion_result: oprot.writeFieldBegin('ase', TType.STRUCT, 3) self.ase.write(oprot) oprot.writeFieldEnd() + if self.ae is not None: + oprot.writeFieldBegin('ae', TType.STRUCT, 4) + self.ae.write(oprot) + oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() http://git-wip-us.apache.org/repos/asf/airavata/blob/7ab87e53/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/ttypes.py ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/ttypes.py b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/ttypes.py index 09140d0..75fe7b6 100644 --- a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/ttypes.py +++ b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/ttypes.py @@ -16,6 +16,7 @@ import apache.airavata.model.appcatalog.appdeployment.ttypes import apache.airavata.model.appcatalog.appinterface.ttypes import apache.airavata.model.appcatalog.gatewayprofile.ttypes import apache.airavata.model.workflow.ttypes +import apache.airavata.model.security.ttypes from thrift.transport import TTransport http://git-wip-us.apache.org/repos/asf/airavata/blob/7ab87e53/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/ttypes.py ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/ttypes.py b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/ttypes.py index 5356eb5..3b6f0fe 100644 --- a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/ttypes.py +++ b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/ttypes.py @@ -10,6 +10,7 @@ from thrift.Thrift import TType, TMessageType, TException, TApplicationException import apache.airavata.model.workspace.ttypes import apache.airavata.api.error.ttypes import apache.airavata.model.messaging.event.ttypes +import apache.airavata.model.security.ttypes from thrift.transport import TTransport
