Modified: hive/branches/spark/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Type.java URL: http://svn.apache.org/viewvc/hive/branches/spark/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Type.java?rev=1613740&r1=1613739&r2=1613740&view=diff ============================================================================== --- hive/branches/spark/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Type.java (original) +++ hive/branches/spark/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Type.java Sat Jul 26 23:45:46 2014 @@ -618,7 +618,7 @@ public class Type implements org.apache. struct.fields = new ArrayList<FieldSchema>(_list0.size); for (int _i1 = 0; _i1 < _list0.size; ++_i1) { - FieldSchema _elem2; // required + FieldSchema _elem2; // optional _elem2 = new FieldSchema(); _elem2.read(iprot); struct.fields.add(_elem2); @@ -749,7 +749,7 @@ public class Type implements org.apache. struct.fields = new ArrayList<FieldSchema>(_list5.size); for (int _i6 = 0; _i6 < _list5.size; ++_i6) { - FieldSchema _elem7; // required + FieldSchema _elem7; // optional _elem7 = new FieldSchema(); _elem7.read(iprot); struct.fields.add(_elem7);
Modified: hive/branches/spark/metastore/src/gen/thrift/gen-php/metastore/ThriftHiveMetastore.php URL: http://svn.apache.org/viewvc/hive/branches/spark/metastore/src/gen/thrift/gen-php/metastore/ThriftHiveMetastore.php?rev=1613740&r1=1613739&r2=1613740&view=diff ============================================================================== --- hive/branches/spark/metastore/src/gen/thrift/gen-php/metastore/ThriftHiveMetastore.php (original) +++ hive/branches/spark/metastore/src/gen/thrift/gen-php/metastore/ThriftHiveMetastore.php Sat Jul 26 23:45:46 2014 @@ -100,12 +100,14 @@ interface ThriftHiveMetastoreIf extends public function grant_role($role_name, $principal_name, $principal_type, $grantor, $grantorType, $grant_option); public function revoke_role($role_name, $principal_name, $principal_type); public function list_roles($principal_name, $principal_type); + public function grant_revoke_role(\metastore\GrantRevokeRoleRequest $request); public function get_principals_in_role(\metastore\GetPrincipalsInRoleRequest $request); public function get_role_grants_for_principal(\metastore\GetRoleGrantsForPrincipalRequest $request); public function get_privilege_set(\metastore\HiveObjectRef $hiveObject, $user_name, $group_names); public function list_privileges($principal_name, $principal_type, \metastore\HiveObjectRef $hiveObject); public function grant_privileges(\metastore\PrivilegeBag $privileges); public function revoke_privileges(\metastore\PrivilegeBag $privileges); + public function grant_revoke_privileges(\metastore\GrantRevokePrivilegeRequest $request); public function set_ugi($user_name, $group_names); public function get_delegation_token($token_owner, $renewer_kerberos_principal_name); public function renew_delegation_token($token_str_form); @@ -5076,6 +5078,60 @@ class ThriftHiveMetastoreClient extends throw new \Exception("list_roles failed: unknown result"); } + public function grant_revoke_role(\metastore\GrantRevokeRoleRequest $request) + { + $this->send_grant_revoke_role($request); + return $this->recv_grant_revoke_role(); + } + + public function send_grant_revoke_role(\metastore\GrantRevokeRoleRequest $request) + { + $args = new \metastore\ThriftHiveMetastore_grant_revoke_role_args(); + $args->request = $request; + $bin_accel = ($this->output_ instanceof TProtocol::$TBINARYPROTOCOLACCELERATED) && function_exists('thrift_protocol_write_binary'); + if ($bin_accel) + { + thrift_protocol_write_binary($this->output_, 'grant_revoke_role', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); + } + else + { + $this->output_->writeMessageBegin('grant_revoke_role', TMessageType::CALL, $this->seqid_); + $args->write($this->output_); + $this->output_->writeMessageEnd(); + $this->output_->getTransport()->flush(); + } + } + + public function recv_grant_revoke_role() + { + $bin_accel = ($this->input_ instanceof TProtocol::$TBINARYPROTOCOLACCELERATED) && function_exists('thrift_protocol_read_binary'); + if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\metastore\ThriftHiveMetastore_grant_revoke_role_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 \metastore\ThriftHiveMetastore_grant_revoke_role_result(); + $result->read($this->input_); + $this->input_->readMessageEnd(); + } + if ($result->success !== null) { + return $result->success; + } + if ($result->o1 !== null) { + throw $result->o1; + } + throw new \Exception("grant_revoke_role failed: unknown result"); + } + public function get_principals_in_role(\metastore\GetPrincipalsInRoleRequest $request) { $this->send_get_principals_in_role($request); @@ -5404,6 +5460,60 @@ class ThriftHiveMetastoreClient extends throw new \Exception("revoke_privileges failed: unknown result"); } + public function grant_revoke_privileges(\metastore\GrantRevokePrivilegeRequest $request) + { + $this->send_grant_revoke_privileges($request); + return $this->recv_grant_revoke_privileges(); + } + + public function send_grant_revoke_privileges(\metastore\GrantRevokePrivilegeRequest $request) + { + $args = new \metastore\ThriftHiveMetastore_grant_revoke_privileges_args(); + $args->request = $request; + $bin_accel = ($this->output_ instanceof TProtocol::$TBINARYPROTOCOLACCELERATED) && function_exists('thrift_protocol_write_binary'); + if ($bin_accel) + { + thrift_protocol_write_binary($this->output_, 'grant_revoke_privileges', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); + } + else + { + $this->output_->writeMessageBegin('grant_revoke_privileges', TMessageType::CALL, $this->seqid_); + $args->write($this->output_); + $this->output_->writeMessageEnd(); + $this->output_->getTransport()->flush(); + } + } + + public function recv_grant_revoke_privileges() + { + $bin_accel = ($this->input_ instanceof TProtocol::$TBINARYPROTOCOLACCELERATED) && function_exists('thrift_protocol_read_binary'); + if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\metastore\ThriftHiveMetastore_grant_revoke_privileges_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 \metastore\ThriftHiveMetastore_grant_revoke_privileges_result(); + $result->read($this->input_); + $this->input_->readMessageEnd(); + } + if ($result->success !== null) { + return $result->success; + } + if ($result->o1 !== null) { + throw $result->o1; + } + throw new \Exception("grant_revoke_privileges failed: unknown result"); + } + public function set_ugi($user_name, $group_names) { $this->send_set_ugi($user_name, $group_names); @@ -26511,6 +26621,182 @@ class ThriftHiveMetastore_list_roles_res } +class ThriftHiveMetastore_grant_revoke_role_args { + static $_TSPEC; + + public $request = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'request', + 'type' => TType::STRUCT, + 'class' => '\metastore\GrantRevokeRoleRequest', + ), + ); + } + if (is_array($vals)) { + if (isset($vals['request'])) { + $this->request = $vals['request']; + } + } + } + + public function getName() { + return 'ThriftHiveMetastore_grant_revoke_role_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->request = new \metastore\GrantRevokeRoleRequest(); + $xfer += $this->request->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('ThriftHiveMetastore_grant_revoke_role_args'); + if ($this->request !== null) { + if (!is_object($this->request)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('request', TType::STRUCT, 1); + $xfer += $this->request->write($output); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class ThriftHiveMetastore_grant_revoke_role_result { + static $_TSPEC; + + public $success = null; + public $o1 = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 0 => array( + 'var' => 'success', + 'type' => TType::STRUCT, + 'class' => '\metastore\GrantRevokeRoleResponse', + ), + 1 => array( + 'var' => 'o1', + 'type' => TType::STRUCT, + 'class' => '\metastore\MetaException', + ), + ); + } + if (is_array($vals)) { + if (isset($vals['success'])) { + $this->success = $vals['success']; + } + if (isset($vals['o1'])) { + $this->o1 = $vals['o1']; + } + } + } + + public function getName() { + return 'ThriftHiveMetastore_grant_revoke_role_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 \metastore\GrantRevokeRoleResponse(); + $xfer += $this->success->read($input); + } else { + $xfer += $input->skip($ftype); + } + break; + case 1: + if ($ftype == TType::STRUCT) { + $this->o1 = new \metastore\MetaException(); + $xfer += $this->o1->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('ThriftHiveMetastore_grant_revoke_role_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->o1 !== null) { + $xfer += $output->writeFieldBegin('o1', TType::STRUCT, 1); + $xfer += $this->o1->write($output); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + class ThriftHiveMetastore_get_principals_in_role_args { static $_TSPEC; @@ -27686,6 +27972,182 @@ class ThriftHiveMetastore_revoke_privile } +class ThriftHiveMetastore_grant_revoke_privileges_args { + static $_TSPEC; + + public $request = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'request', + 'type' => TType::STRUCT, + 'class' => '\metastore\GrantRevokePrivilegeRequest', + ), + ); + } + if (is_array($vals)) { + if (isset($vals['request'])) { + $this->request = $vals['request']; + } + } + } + + public function getName() { + return 'ThriftHiveMetastore_grant_revoke_privileges_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->request = new \metastore\GrantRevokePrivilegeRequest(); + $xfer += $this->request->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('ThriftHiveMetastore_grant_revoke_privileges_args'); + if ($this->request !== null) { + if (!is_object($this->request)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('request', TType::STRUCT, 1); + $xfer += $this->request->write($output); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class ThriftHiveMetastore_grant_revoke_privileges_result { + static $_TSPEC; + + public $success = null; + public $o1 = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 0 => array( + 'var' => 'success', + 'type' => TType::STRUCT, + 'class' => '\metastore\GrantRevokePrivilegeResponse', + ), + 1 => array( + 'var' => 'o1', + 'type' => TType::STRUCT, + 'class' => '\metastore\MetaException', + ), + ); + } + if (is_array($vals)) { + if (isset($vals['success'])) { + $this->success = $vals['success']; + } + if (isset($vals['o1'])) { + $this->o1 = $vals['o1']; + } + } + } + + public function getName() { + return 'ThriftHiveMetastore_grant_revoke_privileges_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 \metastore\GrantRevokePrivilegeResponse(); + $xfer += $this->success->read($input); + } else { + $xfer += $input->skip($ftype); + } + break; + case 1: + if ($ftype == TType::STRUCT) { + $this->o1 = new \metastore\MetaException(); + $xfer += $this->o1->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('ThriftHiveMetastore_grant_revoke_privileges_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->o1 !== null) { + $xfer += $output->writeFieldBegin('o1', TType::STRUCT, 1); + $xfer += $this->o1->write($output); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + class ThriftHiveMetastore_set_ugi_args { static $_TSPEC; Modified: hive/branches/spark/metastore/src/gen/thrift/gen-php/metastore/Types.php URL: http://svn.apache.org/viewvc/hive/branches/spark/metastore/src/gen/thrift/gen-php/metastore/Types.php?rev=1613740&r1=1613739&r2=1613740&view=diff ============================================================================== --- hive/branches/spark/metastore/src/gen/thrift/gen-php/metastore/Types.php (original) +++ hive/branches/spark/metastore/src/gen/thrift/gen-php/metastore/Types.php Sat Jul 26 23:45:46 2014 @@ -104,6 +104,15 @@ final class CompactionType { ); } +final class GrantRevokeType { + const GRANT = 1; + const REVOKE = 2; + static public $__names = array( + 1 => 'GRANT', + 2 => 'REVOKE', + ); +} + final class FunctionType { const JAVA = 1; static public $__names = array( @@ -1347,6 +1356,195 @@ class PrincipalPrivilegeSet { } +class GrantRevokePrivilegeRequest { + static $_TSPEC; + + public $requestType = null; + public $privileges = null; + public $revokeGrantOption = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'requestType', + 'type' => TType::I32, + ), + 2 => array( + 'var' => 'privileges', + 'type' => TType::STRUCT, + 'class' => '\metastore\PrivilegeBag', + ), + 3 => array( + 'var' => 'revokeGrantOption', + 'type' => TType::BOOL, + ), + ); + } + if (is_array($vals)) { + if (isset($vals['requestType'])) { + $this->requestType = $vals['requestType']; + } + if (isset($vals['privileges'])) { + $this->privileges = $vals['privileges']; + } + if (isset($vals['revokeGrantOption'])) { + $this->revokeGrantOption = $vals['revokeGrantOption']; + } + } + } + + public function getName() { + return 'GrantRevokePrivilegeRequest'; + } + + 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::I32) { + $xfer += $input->readI32($this->requestType); + } else { + $xfer += $input->skip($ftype); + } + break; + case 2: + if ($ftype == TType::STRUCT) { + $this->privileges = new \metastore\PrivilegeBag(); + $xfer += $this->privileges->read($input); + } else { + $xfer += $input->skip($ftype); + } + break; + case 3: + if ($ftype == TType::BOOL) { + $xfer += $input->readBool($this->revokeGrantOption); + } 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('GrantRevokePrivilegeRequest'); + if ($this->requestType !== null) { + $xfer += $output->writeFieldBegin('requestType', TType::I32, 1); + $xfer += $output->writeI32($this->requestType); + $xfer += $output->writeFieldEnd(); + } + if ($this->privileges !== null) { + if (!is_object($this->privileges)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('privileges', TType::STRUCT, 2); + $xfer += $this->privileges->write($output); + $xfer += $output->writeFieldEnd(); + } + if ($this->revokeGrantOption !== null) { + $xfer += $output->writeFieldBegin('revokeGrantOption', TType::BOOL, 3); + $xfer += $output->writeBool($this->revokeGrantOption); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class GrantRevokePrivilegeResponse { + static $_TSPEC; + + public $success = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'success', + 'type' => TType::BOOL, + ), + ); + } + if (is_array($vals)) { + if (isset($vals['success'])) { + $this->success = $vals['success']; + } + } + } + + public function getName() { + return 'GrantRevokePrivilegeResponse'; + } + + 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::BOOL) { + $xfer += $input->readBool($this->success); + } 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('GrantRevokePrivilegeResponse'); + if ($this->success !== null) { + $xfer += $output->writeFieldBegin('success', TType::BOOL, 1); + $xfer += $output->writeBool($this->success); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + class Role { static $_TSPEC; @@ -2015,6 +2213,270 @@ class GetPrincipalsInRoleResponse { } +class GrantRevokeRoleRequest { + static $_TSPEC; + + public $requestType = null; + public $roleName = null; + public $principalName = null; + public $principalType = null; + public $grantor = null; + public $grantorType = null; + public $grantOption = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'requestType', + 'type' => TType::I32, + ), + 2 => array( + 'var' => 'roleName', + 'type' => TType::STRING, + ), + 3 => array( + 'var' => 'principalName', + 'type' => TType::STRING, + ), + 4 => array( + 'var' => 'principalType', + 'type' => TType::I32, + ), + 5 => array( + 'var' => 'grantor', + 'type' => TType::STRING, + ), + 6 => array( + 'var' => 'grantorType', + 'type' => TType::I32, + ), + 7 => array( + 'var' => 'grantOption', + 'type' => TType::BOOL, + ), + ); + } + if (is_array($vals)) { + if (isset($vals['requestType'])) { + $this->requestType = $vals['requestType']; + } + if (isset($vals['roleName'])) { + $this->roleName = $vals['roleName']; + } + if (isset($vals['principalName'])) { + $this->principalName = $vals['principalName']; + } + if (isset($vals['principalType'])) { + $this->principalType = $vals['principalType']; + } + if (isset($vals['grantor'])) { + $this->grantor = $vals['grantor']; + } + if (isset($vals['grantorType'])) { + $this->grantorType = $vals['grantorType']; + } + if (isset($vals['grantOption'])) { + $this->grantOption = $vals['grantOption']; + } + } + } + + public function getName() { + return 'GrantRevokeRoleRequest'; + } + + 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::I32) { + $xfer += $input->readI32($this->requestType); + } else { + $xfer += $input->skip($ftype); + } + break; + case 2: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->roleName); + } else { + $xfer += $input->skip($ftype); + } + break; + case 3: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->principalName); + } else { + $xfer += $input->skip($ftype); + } + break; + case 4: + if ($ftype == TType::I32) { + $xfer += $input->readI32($this->principalType); + } else { + $xfer += $input->skip($ftype); + } + break; + case 5: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->grantor); + } else { + $xfer += $input->skip($ftype); + } + break; + case 6: + if ($ftype == TType::I32) { + $xfer += $input->readI32($this->grantorType); + } else { + $xfer += $input->skip($ftype); + } + break; + case 7: + if ($ftype == TType::BOOL) { + $xfer += $input->readBool($this->grantOption); + } 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('GrantRevokeRoleRequest'); + if ($this->requestType !== null) { + $xfer += $output->writeFieldBegin('requestType', TType::I32, 1); + $xfer += $output->writeI32($this->requestType); + $xfer += $output->writeFieldEnd(); + } + if ($this->roleName !== null) { + $xfer += $output->writeFieldBegin('roleName', TType::STRING, 2); + $xfer += $output->writeString($this->roleName); + $xfer += $output->writeFieldEnd(); + } + if ($this->principalName !== null) { + $xfer += $output->writeFieldBegin('principalName', TType::STRING, 3); + $xfer += $output->writeString($this->principalName); + $xfer += $output->writeFieldEnd(); + } + if ($this->principalType !== null) { + $xfer += $output->writeFieldBegin('principalType', TType::I32, 4); + $xfer += $output->writeI32($this->principalType); + $xfer += $output->writeFieldEnd(); + } + if ($this->grantor !== null) { + $xfer += $output->writeFieldBegin('grantor', TType::STRING, 5); + $xfer += $output->writeString($this->grantor); + $xfer += $output->writeFieldEnd(); + } + if ($this->grantorType !== null) { + $xfer += $output->writeFieldBegin('grantorType', TType::I32, 6); + $xfer += $output->writeI32($this->grantorType); + $xfer += $output->writeFieldEnd(); + } + if ($this->grantOption !== null) { + $xfer += $output->writeFieldBegin('grantOption', TType::BOOL, 7); + $xfer += $output->writeBool($this->grantOption); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class GrantRevokeRoleResponse { + static $_TSPEC; + + public $success = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'success', + 'type' => TType::BOOL, + ), + ); + } + if (is_array($vals)) { + if (isset($vals['success'])) { + $this->success = $vals['success']; + } + } + } + + public function getName() { + return 'GrantRevokeRoleResponse'; + } + + 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::BOOL) { + $xfer += $input->readBool($this->success); + } 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('GrantRevokeRoleResponse'); + if ($this->success !== null) { + $xfer += $output->writeFieldBegin('success', TType::BOOL, 1); + $xfer += $output->writeBool($this->success); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + class Database { static $_TSPEC; @@ -3162,6 +3624,7 @@ class Table { public $viewExpandedText = null; public $tableType = null; public $privileges = null; + public $temporary = false; public function __construct($vals=null) { if (!isset(self::$_TSPEC)) { @@ -3233,6 +3696,10 @@ class Table { 'type' => TType::STRUCT, 'class' => '\metastore\PrincipalPrivilegeSet', ), + 14 => array( + 'var' => 'temporary', + 'type' => TType::BOOL, + ), ); } if (is_array($vals)) { @@ -3275,6 +3742,9 @@ class Table { if (isset($vals['privileges'])) { $this->privileges = $vals['privileges']; } + if (isset($vals['temporary'])) { + $this->temporary = $vals['temporary']; + } } } @@ -3414,6 +3884,13 @@ class Table { $xfer += $input->skip($ftype); } break; + case 14: + if ($ftype == TType::BOOL) { + $xfer += $input->readBool($this->temporary); + } else { + $xfer += $input->skip($ftype); + } + break; default: $xfer += $input->skip($ftype); break; @@ -3523,6 +4000,11 @@ class Table { $xfer += $this->privileges->write($output); $xfer += $output->writeFieldEnd(); } + if ($this->temporary !== null) { + $xfer += $output->writeFieldBegin('temporary', TType::BOOL, 14); + $xfer += $output->writeBool($this->temporary); + $xfer += $output->writeFieldEnd(); + } $xfer += $output->writeFieldStop(); $xfer += $output->writeStructEnd(); return $xfer; Modified: hive/branches/spark/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore-remote URL: http://svn.apache.org/viewvc/hive/branches/spark/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore-remote?rev=1613740&r1=1613739&r2=1613740&view=diff ============================================================================== --- hive/branches/spark/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore-remote (original) +++ hive/branches/spark/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore-remote Sat Jul 26 23:45:46 2014 @@ -107,12 +107,14 @@ if len(sys.argv) <= 1 or sys.argv[1] == print ' bool grant_role(string role_name, string principal_name, PrincipalType principal_type, string grantor, PrincipalType grantorType, bool grant_option)' print ' bool revoke_role(string role_name, string principal_name, PrincipalType principal_type)' print ' list_roles(string principal_name, PrincipalType principal_type)' + print ' GrantRevokeRoleResponse grant_revoke_role(GrantRevokeRoleRequest request)' print ' GetPrincipalsInRoleResponse get_principals_in_role(GetPrincipalsInRoleRequest request)' print ' GetRoleGrantsForPrincipalResponse get_role_grants_for_principal(GetRoleGrantsForPrincipalRequest request)' print ' PrincipalPrivilegeSet get_privilege_set(HiveObjectRef hiveObject, string user_name, group_names)' print ' list_privileges(string principal_name, PrincipalType principal_type, HiveObjectRef hiveObject)' print ' bool grant_privileges(PrivilegeBag privileges)' print ' bool revoke_privileges(PrivilegeBag privileges)' + print ' GrantRevokePrivilegeResponse grant_revoke_privileges(GrantRevokePrivilegeRequest request)' print ' set_ugi(string user_name, group_names)' print ' string get_delegation_token(string token_owner, string renewer_kerberos_principal_name)' print ' i64 renew_delegation_token(string token_str_form)' @@ -685,6 +687,12 @@ elif cmd == 'list_roles': sys.exit(1) pp.pprint(client.list_roles(args[0],eval(args[1]),)) +elif cmd == 'grant_revoke_role': + if len(args) != 1: + print 'grant_revoke_role requires 1 args' + sys.exit(1) + pp.pprint(client.grant_revoke_role(eval(args[0]),)) + elif cmd == 'get_principals_in_role': if len(args) != 1: print 'get_principals_in_role requires 1 args' @@ -721,6 +729,12 @@ elif cmd == 'revoke_privileges': sys.exit(1) pp.pprint(client.revoke_privileges(eval(args[0]),)) +elif cmd == 'grant_revoke_privileges': + if len(args) != 1: + print 'grant_revoke_privileges requires 1 args' + sys.exit(1) + pp.pprint(client.grant_revoke_privileges(eval(args[0]),)) + elif cmd == 'set_ugi': if len(args) != 2: print 'set_ugi requires 2 args' Modified: hive/branches/spark/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py URL: http://svn.apache.org/viewvc/hive/branches/spark/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py?rev=1613740&r1=1613739&r2=1613740&view=diff ============================================================================== --- hive/branches/spark/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py (original) +++ hive/branches/spark/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py Sat Jul 26 23:45:46 2014 @@ -738,6 +738,13 @@ class Iface(fb303.FacebookService.Iface) """ pass + def grant_revoke_role(self, request): + """ + Parameters: + - request + """ + pass + def get_principals_in_role(self, request): """ Parameters: @@ -784,6 +791,13 @@ class Iface(fb303.FacebookService.Iface) """ pass + def grant_revoke_privileges(self, request): + """ + Parameters: + - request + """ + pass + def set_ugi(self, user_name, group_names): """ Parameters: @@ -4039,6 +4053,38 @@ class Client(fb303.FacebookService.Clien raise result.o1 raise TApplicationException(TApplicationException.MISSING_RESULT, "list_roles failed: unknown result"); + def grant_revoke_role(self, request): + """ + Parameters: + - request + """ + self.send_grant_revoke_role(request) + return self.recv_grant_revoke_role() + + def send_grant_revoke_role(self, request): + self._oprot.writeMessageBegin('grant_revoke_role', TMessageType.CALL, self._seqid) + args = grant_revoke_role_args() + args.request = request + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_grant_revoke_role(self, ): + (fname, mtype, rseqid) = self._iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(self._iprot) + self._iprot.readMessageEnd() + raise x + result = grant_revoke_role_result() + result.read(self._iprot) + self._iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.o1 is not None: + raise result.o1 + raise TApplicationException(TApplicationException.MISSING_RESULT, "grant_revoke_role failed: unknown result"); + def get_principals_in_role(self, request): """ Parameters: @@ -4239,6 +4285,38 @@ class Client(fb303.FacebookService.Clien raise result.o1 raise TApplicationException(TApplicationException.MISSING_RESULT, "revoke_privileges failed: unknown result"); + def grant_revoke_privileges(self, request): + """ + Parameters: + - request + """ + self.send_grant_revoke_privileges(request) + return self.recv_grant_revoke_privileges() + + def send_grant_revoke_privileges(self, request): + self._oprot.writeMessageBegin('grant_revoke_privileges', TMessageType.CALL, self._seqid) + args = grant_revoke_privileges_args() + args.request = request + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_grant_revoke_privileges(self, ): + (fname, mtype, rseqid) = self._iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(self._iprot) + self._iprot.readMessageEnd() + raise x + result = grant_revoke_privileges_result() + result.read(self._iprot) + self._iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.o1 is not None: + raise result.o1 + raise TApplicationException(TApplicationException.MISSING_RESULT, "grant_revoke_privileges failed: unknown result"); + def set_ugi(self, user_name, group_names): """ Parameters: @@ -4853,12 +4931,14 @@ class Processor(fb303.FacebookService.Pr self._processMap["grant_role"] = Processor.process_grant_role self._processMap["revoke_role"] = Processor.process_revoke_role self._processMap["list_roles"] = Processor.process_list_roles + self._processMap["grant_revoke_role"] = Processor.process_grant_revoke_role self._processMap["get_principals_in_role"] = Processor.process_get_principals_in_role self._processMap["get_role_grants_for_principal"] = Processor.process_get_role_grants_for_principal self._processMap["get_privilege_set"] = Processor.process_get_privilege_set self._processMap["list_privileges"] = Processor.process_list_privileges self._processMap["grant_privileges"] = Processor.process_grant_privileges self._processMap["revoke_privileges"] = Processor.process_revoke_privileges + self._processMap["grant_revoke_privileges"] = Processor.process_grant_revoke_privileges self._processMap["set_ugi"] = Processor.process_set_ugi self._processMap["get_delegation_token"] = Processor.process_get_delegation_token self._processMap["renew_delegation_token"] = Processor.process_renew_delegation_token @@ -6288,6 +6368,20 @@ class Processor(fb303.FacebookService.Pr oprot.writeMessageEnd() oprot.trans.flush() + def process_grant_revoke_role(self, seqid, iprot, oprot): + args = grant_revoke_role_args() + args.read(iprot) + iprot.readMessageEnd() + result = grant_revoke_role_result() + try: + result.success = self._handler.grant_revoke_role(args.request) + except MetaException as o1: + result.o1 = o1 + oprot.writeMessageBegin("grant_revoke_role", TMessageType.REPLY, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + def process_get_principals_in_role(self, seqid, iprot, oprot): args = get_principals_in_role_args() args.read(iprot) @@ -6372,6 +6466,20 @@ class Processor(fb303.FacebookService.Pr oprot.writeMessageEnd() oprot.trans.flush() + def process_grant_revoke_privileges(self, seqid, iprot, oprot): + args = grant_revoke_privileges_args() + args.read(iprot) + iprot.readMessageEnd() + result = grant_revoke_privileges_result() + try: + result.success = self._handler.grant_revoke_privileges(args.request) + except MetaException as o1: + result.o1 = o1 + oprot.writeMessageBegin("grant_revoke_privileges", TMessageType.REPLY, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + def process_set_ugi(self, seqid, iprot, oprot): args = set_ugi_args() args.read(iprot) @@ -20963,6 +21071,140 @@ class list_roles_result: def __ne__(self, other): return not (self == other) +class grant_revoke_role_args: + """ + Attributes: + - request + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'request', (GrantRevokeRoleRequest, GrantRevokeRoleRequest.thrift_spec), None, ), # 1 + ) + + def __init__(self, request=None,): + self.request = request + + 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)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.request = GrantRevokeRoleRequest() + self.request.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('grant_revoke_role_args') + if self.request is not None: + oprot.writeFieldBegin('request', TType.STRUCT, 1) + self.request.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class grant_revoke_role_result: + """ + Attributes: + - success + - o1 + """ + + thrift_spec = ( + (0, TType.STRUCT, 'success', (GrantRevokeRoleResponse, GrantRevokeRoleResponse.thrift_spec), None, ), # 0 + (1, TType.STRUCT, 'o1', (MetaException, MetaException.thrift_spec), None, ), # 1 + ) + + def __init__(self, success=None, o1=None,): + self.success = success + self.o1 = o1 + + 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)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = GrantRevokeRoleResponse() + self.success.read(iprot) + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.o1 = MetaException() + self.o1.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('grant_revoke_role_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + if self.o1 is not None: + oprot.writeFieldBegin('o1', TType.STRUCT, 1) + self.o1.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + class get_principals_in_role_args: """ Attributes: @@ -21829,6 +22071,140 @@ class revoke_privileges_result: def __ne__(self, other): return not (self == other) +class grant_revoke_privileges_args: + """ + Attributes: + - request + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'request', (GrantRevokePrivilegeRequest, GrantRevokePrivilegeRequest.thrift_spec), None, ), # 1 + ) + + def __init__(self, request=None,): + self.request = request + + 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)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.request = GrantRevokePrivilegeRequest() + self.request.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('grant_revoke_privileges_args') + if self.request is not None: + oprot.writeFieldBegin('request', TType.STRUCT, 1) + self.request.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class grant_revoke_privileges_result: + """ + Attributes: + - success + - o1 + """ + + thrift_spec = ( + (0, TType.STRUCT, 'success', (GrantRevokePrivilegeResponse, GrantRevokePrivilegeResponse.thrift_spec), None, ), # 0 + (1, TType.STRUCT, 'o1', (MetaException, MetaException.thrift_spec), None, ), # 1 + ) + + def __init__(self, success=None, o1=None,): + self.success = success + self.o1 = o1 + + 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)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = GrantRevokePrivilegeResponse() + self.success.read(iprot) + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.o1 = MetaException() + self.o1.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('grant_revoke_privileges_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + if self.o1 is not None: + oprot.writeFieldBegin('o1', TType.STRUCT, 1) + self.o1.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + class set_ugi_args: """ Attributes: Modified: hive/branches/spark/metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py URL: http://svn.apache.org/viewvc/hive/branches/spark/metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py?rev=1613740&r1=1613739&r2=1613740&view=diff ============================================================================== --- hive/branches/spark/metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py (original) +++ hive/branches/spark/metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py Sat Jul 26 23:45:46 2014 @@ -154,6 +154,20 @@ class CompactionType: "MAJOR": 2, } +class GrantRevokeType: + GRANT = 1 + REVOKE = 2 + + _VALUES_TO_NAMES = { + 1: "GRANT", + 2: "REVOKE", + } + + _NAMES_TO_VALUES = { + "GRANT": 1, + "REVOKE": 2, + } + class FunctionType: JAVA = 1 @@ -976,6 +990,151 @@ class PrincipalPrivilegeSet: def __ne__(self, other): return not (self == other) +class GrantRevokePrivilegeRequest: + """ + Attributes: + - requestType + - privileges + - revokeGrantOption + """ + + thrift_spec = ( + None, # 0 + (1, TType.I32, 'requestType', None, None, ), # 1 + (2, TType.STRUCT, 'privileges', (PrivilegeBag, PrivilegeBag.thrift_spec), None, ), # 2 + (3, TType.BOOL, 'revokeGrantOption', None, None, ), # 3 + ) + + def __init__(self, requestType=None, privileges=None, revokeGrantOption=None,): + self.requestType = requestType + self.privileges = privileges + self.revokeGrantOption = revokeGrantOption + + 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)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I32: + self.requestType = iprot.readI32(); + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.privileges = PrivilegeBag() + self.privileges.read(iprot) + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.BOOL: + self.revokeGrantOption = iprot.readBool(); + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('GrantRevokePrivilegeRequest') + if self.requestType is not None: + oprot.writeFieldBegin('requestType', TType.I32, 1) + oprot.writeI32(self.requestType) + oprot.writeFieldEnd() + if self.privileges is not None: + oprot.writeFieldBegin('privileges', TType.STRUCT, 2) + self.privileges.write(oprot) + oprot.writeFieldEnd() + if self.revokeGrantOption is not None: + oprot.writeFieldBegin('revokeGrantOption', TType.BOOL, 3) + oprot.writeBool(self.revokeGrantOption) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class GrantRevokePrivilegeResponse: + """ + Attributes: + - success + """ + + thrift_spec = ( + None, # 0 + (1, TType.BOOL, 'success', None, None, ), # 1 + ) + + def __init__(self, success=None,): + self.success = success + + 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)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.BOOL: + self.success = iprot.readBool(); + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('GrantRevokePrivilegeResponse') + if self.success is not None: + oprot.writeFieldBegin('success', TType.BOOL, 1) + oprot.writeBool(self.success) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + class Role: """ Attributes: @@ -1472,6 +1631,198 @@ class GetPrincipalsInRoleResponse: def __ne__(self, other): return not (self == other) +class GrantRevokeRoleRequest: + """ + Attributes: + - requestType + - roleName + - principalName + - principalType + - grantor + - grantorType + - grantOption + """ + + thrift_spec = ( + None, # 0 + (1, TType.I32, 'requestType', None, None, ), # 1 + (2, TType.STRING, 'roleName', None, None, ), # 2 + (3, TType.STRING, 'principalName', None, None, ), # 3 + (4, TType.I32, 'principalType', None, None, ), # 4 + (5, TType.STRING, 'grantor', None, None, ), # 5 + (6, TType.I32, 'grantorType', None, None, ), # 6 + (7, TType.BOOL, 'grantOption', None, None, ), # 7 + ) + + def __init__(self, requestType=None, roleName=None, principalName=None, principalType=None, grantor=None, grantorType=None, grantOption=None,): + self.requestType = requestType + self.roleName = roleName + self.principalName = principalName + self.principalType = principalType + self.grantor = grantor + self.grantorType = grantorType + self.grantOption = grantOption + + 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)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I32: + self.requestType = iprot.readI32(); + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.roleName = iprot.readString(); + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRING: + self.principalName = iprot.readString(); + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.I32: + self.principalType = iprot.readI32(); + else: + iprot.skip(ftype) + elif fid == 5: + if ftype == TType.STRING: + self.grantor = iprot.readString(); + else: + iprot.skip(ftype) + elif fid == 6: + if ftype == TType.I32: + self.grantorType = iprot.readI32(); + else: + iprot.skip(ftype) + elif fid == 7: + if ftype == TType.BOOL: + self.grantOption = iprot.readBool(); + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('GrantRevokeRoleRequest') + if self.requestType is not None: + oprot.writeFieldBegin('requestType', TType.I32, 1) + oprot.writeI32(self.requestType) + oprot.writeFieldEnd() + if self.roleName is not None: + oprot.writeFieldBegin('roleName', TType.STRING, 2) + oprot.writeString(self.roleName) + oprot.writeFieldEnd() + if self.principalName is not None: + oprot.writeFieldBegin('principalName', TType.STRING, 3) + oprot.writeString(self.principalName) + oprot.writeFieldEnd() + if self.principalType is not None: + oprot.writeFieldBegin('principalType', TType.I32, 4) + oprot.writeI32(self.principalType) + oprot.writeFieldEnd() + if self.grantor is not None: + oprot.writeFieldBegin('grantor', TType.STRING, 5) + oprot.writeString(self.grantor) + oprot.writeFieldEnd() + if self.grantorType is not None: + oprot.writeFieldBegin('grantorType', TType.I32, 6) + oprot.writeI32(self.grantorType) + oprot.writeFieldEnd() + if self.grantOption is not None: + oprot.writeFieldBegin('grantOption', TType.BOOL, 7) + oprot.writeBool(self.grantOption) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class GrantRevokeRoleResponse: + """ + Attributes: + - success + """ + + thrift_spec = ( + None, # 0 + (1, TType.BOOL, 'success', None, None, ), # 1 + ) + + def __init__(self, success=None,): + self.success = success + + 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)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.BOOL: + self.success = iprot.readBool(); + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('GrantRevokeRoleResponse') + if self.success is not None: + oprot.writeFieldBegin('success', TType.BOOL, 1) + oprot.writeBool(self.success) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + class Database: """ Attributes: @@ -2153,6 +2504,7 @@ class Table: - viewExpandedText - tableType - privileges + - temporary """ thrift_spec = ( @@ -2170,9 +2522,10 @@ class Table: (11, TType.STRING, 'viewExpandedText', None, None, ), # 11 (12, TType.STRING, 'tableType', None, None, ), # 12 (13, TType.STRUCT, 'privileges', (PrincipalPrivilegeSet, PrincipalPrivilegeSet.thrift_spec), None, ), # 13 + (14, TType.BOOL, 'temporary', None, False, ), # 14 ) - def __init__(self, tableName=None, dbName=None, owner=None, createTime=None, lastAccessTime=None, retention=None, sd=None, partitionKeys=None, parameters=None, viewOriginalText=None, viewExpandedText=None, tableType=None, privileges=None,): + def __init__(self, tableName=None, dbName=None, owner=None, createTime=None, lastAccessTime=None, retention=None, sd=None, partitionKeys=None, parameters=None, viewOriginalText=None, viewExpandedText=None, tableType=None, privileges=None, temporary=thrift_spec[14][4],): self.tableName = tableName self.dbName = dbName self.owner = owner @@ -2186,6 +2539,7 @@ class Table: self.viewExpandedText = viewExpandedText self.tableType = tableType self.privileges = privileges + self.temporary = temporary 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: @@ -2275,6 +2629,11 @@ class Table: self.privileges.read(iprot) else: iprot.skip(ftype) + elif fid == 14: + if ftype == TType.BOOL: + self.temporary = iprot.readBool(); + else: + iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() @@ -2344,6 +2703,10 @@ class Table: oprot.writeFieldBegin('privileges', TType.STRUCT, 13) self.privileges.write(oprot) oprot.writeFieldEnd() + if self.temporary is not None: + oprot.writeFieldBegin('temporary', TType.BOOL, 14) + oprot.writeBool(self.temporary) + oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() Modified: hive/branches/spark/metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb URL: http://svn.apache.org/viewvc/hive/branches/spark/metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb?rev=1613740&r1=1613739&r2=1613740&view=diff ============================================================================== --- hive/branches/spark/metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb (original) +++ hive/branches/spark/metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb Sat Jul 26 23:45:46 2014 @@ -72,6 +72,13 @@ module CompactionType VALID_VALUES = Set.new([MINOR, MAJOR]).freeze end +module GrantRevokeType + GRANT = 1 + REVOKE = 2 + VALUE_MAP = {1 => "GRANT", 2 => "REVOKE"} + VALID_VALUES = Set.new([GRANT, REVOKE]).freeze +end + module FunctionType JAVA = 1 VALUE_MAP = {1 => "JAVA"} @@ -261,6 +268,45 @@ class PrincipalPrivilegeSet ::Thrift::Struct.generate_accessors self end +class GrantRevokePrivilegeRequest + include ::Thrift::Struct, ::Thrift::Struct_Union + REQUESTTYPE = 1 + PRIVILEGES = 2 + REVOKEGRANTOPTION = 3 + + FIELDS = { + REQUESTTYPE => {:type => ::Thrift::Types::I32, :name => 'requestType', :enum_class => ::GrantRevokeType}, + PRIVILEGES => {:type => ::Thrift::Types::STRUCT, :name => 'privileges', :class => ::PrivilegeBag}, + REVOKEGRANTOPTION => {:type => ::Thrift::Types::BOOL, :name => 'revokeGrantOption', :optional => true} + } + + def struct_fields; FIELDS; end + + def validate + unless @requestType.nil? || ::GrantRevokeType::VALID_VALUES.include?(@requestType) + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field requestType!') + end + end + + ::Thrift::Struct.generate_accessors self +end + +class GrantRevokePrivilegeResponse + include ::Thrift::Struct, ::Thrift::Struct_Union + SUCCESS = 1 + + FIELDS = { + SUCCESS => {:type => ::Thrift::Types::BOOL, :name => 'success', :optional => true} + } + + def struct_fields; FIELDS; end + + def validate + end + + ::Thrift::Struct.generate_accessors self +end + class Role include ::Thrift::Struct, ::Thrift::Struct_Union ROLENAME = 1 @@ -389,6 +435,59 @@ class GetPrincipalsInRoleResponse ::Thrift::Struct.generate_accessors self end +class GrantRevokeRoleRequest + include ::Thrift::Struct, ::Thrift::Struct_Union + REQUESTTYPE = 1 + ROLENAME = 2 + PRINCIPALNAME = 3 + PRINCIPALTYPE = 4 + GRANTOR = 5 + GRANTORTYPE = 6 + GRANTOPTION = 7 + + FIELDS = { + REQUESTTYPE => {:type => ::Thrift::Types::I32, :name => 'requestType', :enum_class => ::GrantRevokeType}, + ROLENAME => {:type => ::Thrift::Types::STRING, :name => 'roleName'}, + PRINCIPALNAME => {:type => ::Thrift::Types::STRING, :name => 'principalName'}, + PRINCIPALTYPE => {:type => ::Thrift::Types::I32, :name => 'principalType', :enum_class => ::PrincipalType}, + GRANTOR => {:type => ::Thrift::Types::STRING, :name => 'grantor', :optional => true}, + GRANTORTYPE => {:type => ::Thrift::Types::I32, :name => 'grantorType', :optional => true, :enum_class => ::PrincipalType}, + GRANTOPTION => {:type => ::Thrift::Types::BOOL, :name => 'grantOption', :optional => true} + } + + def struct_fields; FIELDS; end + + def validate + unless @requestType.nil? || ::GrantRevokeType::VALID_VALUES.include?(@requestType) + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field requestType!') + end + unless @principalType.nil? || ::PrincipalType::VALID_VALUES.include?(@principalType) + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field principalType!') + end + unless @grantorType.nil? || ::PrincipalType::VALID_VALUES.include?(@grantorType) + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field grantorType!') + end + end + + ::Thrift::Struct.generate_accessors self +end + +class GrantRevokeRoleResponse + include ::Thrift::Struct, ::Thrift::Struct_Union + SUCCESS = 1 + + FIELDS = { + SUCCESS => {:type => ::Thrift::Types::BOOL, :name => 'success', :optional => true} + } + + def struct_fields; FIELDS; end + + def validate + end + + ::Thrift::Struct.generate_accessors self +end + class Database include ::Thrift::Struct, ::Thrift::Struct_Union NAME = 1 @@ -531,6 +630,7 @@ class Table VIEWEXPANDEDTEXT = 11 TABLETYPE = 12 PRIVILEGES = 13 + TEMPORARY = 14 FIELDS = { TABLENAME => {:type => ::Thrift::Types::STRING, :name => 'tableName'}, @@ -545,7 +645,8 @@ class Table VIEWORIGINALTEXT => {:type => ::Thrift::Types::STRING, :name => 'viewOriginalText'}, VIEWEXPANDEDTEXT => {:type => ::Thrift::Types::STRING, :name => 'viewExpandedText'}, TABLETYPE => {:type => ::Thrift::Types::STRING, :name => 'tableType'}, - PRIVILEGES => {:type => ::Thrift::Types::STRUCT, :name => 'privileges', :class => ::PrincipalPrivilegeSet, :optional => true} + PRIVILEGES => {:type => ::Thrift::Types::STRUCT, :name => 'privileges', :class => ::PrincipalPrivilegeSet, :optional => true}, + TEMPORARY => {:type => ::Thrift::Types::BOOL, :name => 'temporary', :default => false, :optional => true} } def struct_fields; FIELDS; end Modified: hive/branches/spark/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb URL: http://svn.apache.org/viewvc/hive/branches/spark/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb?rev=1613740&r1=1613739&r2=1613740&view=diff ============================================================================== --- hive/branches/spark/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb (original) +++ hive/branches/spark/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb Sat Jul 26 23:45:46 2014 @@ -1448,6 +1448,22 @@ module ThriftHiveMetastore raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'list_roles failed: unknown result') end + def grant_revoke_role(request) + send_grant_revoke_role(request) + return recv_grant_revoke_role() + end + + def send_grant_revoke_role(request) + send_message('grant_revoke_role', Grant_revoke_role_args, :request => request) + end + + def recv_grant_revoke_role() + result = receive_message(Grant_revoke_role_result) + return result.success unless result.success.nil? + raise result.o1 unless result.o1.nil? + raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'grant_revoke_role failed: unknown result') + end + def get_principals_in_role(request) send_get_principals_in_role(request) return recv_get_principals_in_role() @@ -1544,6 +1560,22 @@ module ThriftHiveMetastore raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'revoke_privileges failed: unknown result') end + def grant_revoke_privileges(request) + send_grant_revoke_privileges(request) + return recv_grant_revoke_privileges() + end + + def send_grant_revoke_privileges(request) + send_message('grant_revoke_privileges', Grant_revoke_privileges_args, :request => request) + end + + def recv_grant_revoke_privileges() + result = receive_message(Grant_revoke_privileges_result) + return result.success unless result.success.nil? + raise result.o1 unless result.o1.nil? + raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'grant_revoke_privileges failed: unknown result') + end + def set_ugi(user_name, group_names) send_set_ugi(user_name, group_names) return recv_set_ugi() @@ -2959,6 +2991,17 @@ module ThriftHiveMetastore write_result(result, oprot, 'list_roles', seqid) end + def process_grant_revoke_role(seqid, iprot, oprot) + args = read_args(iprot, Grant_revoke_role_args) + result = Grant_revoke_role_result.new() + begin + result.success = @handler.grant_revoke_role(args.request) + rescue ::MetaException => o1 + result.o1 = o1 + end + write_result(result, oprot, 'grant_revoke_role', seqid) + end + def process_get_principals_in_role(seqid, iprot, oprot) args = read_args(iprot, Get_principals_in_role_args) result = Get_principals_in_role_result.new() @@ -3025,6 +3068,17 @@ module ThriftHiveMetastore write_result(result, oprot, 'revoke_privileges', seqid) end + def process_grant_revoke_privileges(seqid, iprot, oprot) + args = read_args(iprot, Grant_revoke_privileges_args) + result = Grant_revoke_privileges_result.new() + begin + result.success = @handler.grant_revoke_privileges(args.request) + rescue ::MetaException => o1 + result.o1 = o1 + end + write_result(result, oprot, 'grant_revoke_privileges', seqid) + end + def process_set_ugi(seqid, iprot, oprot) args = read_args(iprot, Set_ugi_args) result = Set_ugi_result.new() @@ -6530,6 +6584,40 @@ module ThriftHiveMetastore ::Thrift::Struct.generate_accessors self end + class Grant_revoke_role_args + include ::Thrift::Struct, ::Thrift::Struct_Union + REQUEST = 1 + + FIELDS = { + REQUEST => {:type => ::Thrift::Types::STRUCT, :name => 'request', :class => ::GrantRevokeRoleRequest} + } + + def struct_fields; FIELDS; end + + def validate + end + + ::Thrift::Struct.generate_accessors self + end + + class Grant_revoke_role_result + include ::Thrift::Struct, ::Thrift::Struct_Union + SUCCESS = 0 + O1 = 1 + + FIELDS = { + SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ::GrantRevokeRoleResponse}, + O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => ::MetaException} + } + + def struct_fields; FIELDS; end + + def validate + end + + ::Thrift::Struct.generate_accessors self + end + class Get_principals_in_role_args include ::Thrift::Struct, ::Thrift::Struct_Union REQUEST = 1 @@ -6745,6 +6833,40 @@ module ThriftHiveMetastore ::Thrift::Struct.generate_accessors self end + class Grant_revoke_privileges_args + include ::Thrift::Struct, ::Thrift::Struct_Union + REQUEST = 1 + + FIELDS = { + REQUEST => {:type => ::Thrift::Types::STRUCT, :name => 'request', :class => ::GrantRevokePrivilegeRequest} + } + + def struct_fields; FIELDS; end + + def validate + end + + ::Thrift::Struct.generate_accessors self + end + + class Grant_revoke_privileges_result + include ::Thrift::Struct, ::Thrift::Struct_Union + SUCCESS = 0 + O1 = 1 + + FIELDS = { + SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ::GrantRevokePrivilegeResponse}, + O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => ::MetaException} + } + + def struct_fields; FIELDS; end + + def validate + end + + ::Thrift::Struct.generate_accessors self + end + class Set_ugi_args include ::Thrift::Struct, ::Thrift::Struct_Union USER_NAME = 1 Modified: hive/branches/spark/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java URL: http://svn.apache.org/viewvc/hive/branches/spark/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java?rev=1613740&r1=1613739&r2=1613740&view=diff ============================================================================== --- hive/branches/spark/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java (original) +++ hive/branches/spark/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java Sat Jul 26 23:45:46 2014 @@ -85,6 +85,11 @@ import org.apache.hadoop.hive.metastore. import org.apache.hadoop.hive.metastore.api.GetPrincipalsInRoleResponse; import org.apache.hadoop.hive.metastore.api.GetRoleGrantsForPrincipalRequest; import org.apache.hadoop.hive.metastore.api.GetRoleGrantsForPrincipalResponse; +import org.apache.hadoop.hive.metastore.api.GrantRevokePrivilegeRequest; +import org.apache.hadoop.hive.metastore.api.GrantRevokePrivilegeResponse; +import org.apache.hadoop.hive.metastore.api.GrantRevokeRoleRequest; +import org.apache.hadoop.hive.metastore.api.GrantRevokeRoleResponse; +import org.apache.hadoop.hive.metastore.api.GrantRevokeType; import org.apache.hadoop.hive.metastore.api.HeartbeatRequest; import org.apache.hadoop.hive.metastore.api.HeartbeatTxnRangeRequest; import org.apache.hadoop.hive.metastore.api.HeartbeatTxnRangeResponse; @@ -732,7 +737,7 @@ public class HiveMetaStore extends Thrif firePreEvent(new PreCreateDatabaseEvent(db, this)); if (!wh.isDir(dbPath)) { - if (!wh.mkdirs(dbPath, false)) { + if (!wh.mkdirs(dbPath, true)) { throw new MetaException("Unable to create database path " + dbPath + ", failed to create database " + db.getName()); } @@ -4073,6 +4078,11 @@ public class HiveMetaStore extends Thrif @Override public boolean revoke_role(final String roleName, final String userName, final PrincipalType principalType) throws MetaException, TException { + return revoke_role(roleName, userName, principalType, false); + } + + private boolean revoke_role(final String roleName, final String userName, + final PrincipalType principalType, boolean grantOption) throws MetaException, TException { incrementCounter("remove_role_member"); firePreEvent(new PreAuthorizationCallEvent(this)); if (PUBLIC.equals(roleName)) { @@ -4082,7 +4092,7 @@ public class HiveMetaStore extends Thrif try { RawStore ms = getMS(); Role mRole = ms.getRole(roleName); - ret = ms.revokeRole(mRole, userName, principalType); + ret = ms.revokeRole(mRole, userName, principalType, grantOption); } catch (MetaException e) { throw e; } catch (Exception e) { @@ -4091,14 +4101,73 @@ public class HiveMetaStore extends Thrif return ret; } + public GrantRevokeRoleResponse grant_revoke_role(GrantRevokeRoleRequest request) + throws MetaException, org.apache.thrift.TException { + GrantRevokeRoleResponse response = new GrantRevokeRoleResponse(); + boolean grantOption = false; + if (request.isSetGrantOption()) { + grantOption = request.isGrantOption(); + } + switch (request.getRequestType()) { + case GRANT: { + boolean result = grant_role(request.getRoleName(), + request.getPrincipalName(), request.getPrincipalType(), + request.getGrantor(), request.getGrantorType(), grantOption); + response.setSuccess(result); + break; + } + case REVOKE: { + boolean result = revoke_role(request.getRoleName(), request.getPrincipalName(), + request.getPrincipalType(), grantOption); + response.setSuccess(result); + break; + } + default: + throw new MetaException("Unknown request type " + request.getRequestType()); + } + + return response; + } + + @Override + public GrantRevokePrivilegeResponse grant_revoke_privileges(GrantRevokePrivilegeRequest request) + throws MetaException, org.apache.thrift.TException { + GrantRevokePrivilegeResponse response = new GrantRevokePrivilegeResponse(); + switch (request.getRequestType()) { + case GRANT: { + boolean result = grant_privileges(request.getPrivileges()); + response.setSuccess(result); + break; + } + case REVOKE: { + boolean revokeGrantOption = false; + if (request.isSetRevokeGrantOption()) { + revokeGrantOption = request.isRevokeGrantOption(); + } + boolean result = revoke_privileges(request.getPrivileges(), revokeGrantOption); + response.setSuccess(result); + break; + } + default: + throw new MetaException("Unknown request type " + request.getRequestType()); + } + + return response; + } + @Override public boolean revoke_privileges(final PrivilegeBag privileges) throws MetaException, TException { + return revoke_privileges(privileges, false); + } + + public boolean revoke_privileges(final PrivilegeBag privileges, boolean grantOption) + throws MetaException, TException { incrementCounter("revoke_privileges"); firePreEvent(new PreAuthorizationCallEvent(this)); Boolean ret = null; try { - ret = getMS().revokePrivileges(privileges); + ret = getMS().revokePrivileges(privileges, grantOption); } catch (MetaException e) { throw e; } catch (Exception e) { @@ -5030,6 +5099,7 @@ public class HiveMetaStore extends Thrif * @param args */ public static void main(String[] args) throws Throwable { + HiveConf.setLoadMetastoreConfig(true); HiveMetastoreCli cli = new HiveMetastoreCli(); cli.parse(args); final boolean isCliVerbose = cli.isVerbose();
