GoogleCloudStorageTest.php 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780
  1. <?php
  2. use Google\Auth\HttpHandler\HttpHandlerFactory;
  3. use Google\Cloud\Core\Exception\BadRequestException;
  4. use Google\Cloud\Core\Exception\NotFoundException;
  5. use Google\Cloud\Storage\Bucket;
  6. use Google\Cloud\Storage\Connection\ConnectionInterface;
  7. use Google\Cloud\Storage\StorageClient;
  8. use Google\Cloud\Storage\StorageObject;
  9. use GuzzleHttp\Client;
  10. use PrivateBin\Data\GoogleCloudStorage;
  11. class GoogleCloudStorageTest extends PHPUnit_Framework_TestCase
  12. {
  13. private static $_client;
  14. private static $_bucket;
  15. public static function setUpBeforeClass()
  16. {
  17. $httpClient = new Client(array('debug'=>false));
  18. $handler = HttpHandlerFactory::build($httpClient);
  19. $name = 'pb-';
  20. $alphabet = 'abcdefghijklmnopqrstuvwxyz';
  21. for ($i = 0; $i < 29; ++$i) {
  22. $name .= $alphabet[rand(0, strlen($alphabet) - 1)];
  23. }
  24. self::$_client = new StorageClientStub(array());
  25. self::$_bucket = self::$_client->createBucket($name);
  26. }
  27. public function setUp()
  28. {
  29. ini_set('error_log', stream_get_meta_data(tmpfile())['uri']);
  30. $this->_model = GoogleCloudStorage::getInstance(array(
  31. 'bucket' => self::$_bucket->name(),
  32. 'prefix' => 'pastes',
  33. 'client' => self::$_client, ));
  34. }
  35. public function tearDown()
  36. {
  37. foreach (self::$_bucket->objects() as $object) {
  38. $object->delete();
  39. }
  40. }
  41. public static function tearDownAfterClass()
  42. {
  43. self::$_bucket->delete();
  44. }
  45. public function testFileBasedDataStoreWorks()
  46. {
  47. $this->_model->delete(Helper::getPasteId());
  48. // storing pastes
  49. $paste = Helper::getPaste(2, array('expire_date' => 1344803344));
  50. $this->assertFalse($this->_model->exists(Helper::getPasteId()), 'paste does not yet exist');
  51. $this->assertTrue($this->_model->create(Helper::getPasteId(), $paste), 'store new paste');
  52. $this->assertTrue($this->_model->exists(Helper::getPasteId()), 'paste exists after storing it');
  53. $this->assertFalse($this->_model->create(Helper::getPasteId(), $paste), 'unable to store the same paste twice');
  54. $this->assertEquals($paste, $this->_model->read(Helper::getPasteId()));
  55. // storing comments
  56. $this->assertFalse($this->_model->existsComment(Helper::getPasteId(), Helper::getPasteId(), Helper::getCommentId()), 'comment does not yet exist');
  57. $this->assertTrue($this->_model->createComment(Helper::getPasteId(), Helper::getPasteId(), Helper::getCommentId(), Helper::getComment()), 'store comment');
  58. $this->assertTrue($this->_model->existsComment(Helper::getPasteId(), Helper::getPasteId(), Helper::getCommentId()), 'comment exists after storing it');
  59. $this->assertFalse($this->_model->createComment(Helper::getPasteId(), Helper::getPasteId(), Helper::getCommentId(), Helper::getComment()), 'unable to store the same comment twice');
  60. $comment = Helper::getComment();
  61. $comment['id'] = Helper::getCommentId();
  62. $comment['parentid'] = Helper::getPasteId();
  63. $this->assertEquals(
  64. array($comment['meta']['created'] => $comment),
  65. $this->_model->readComments(Helper::getPasteId())
  66. );
  67. // deleting pastes
  68. $this->_model->delete(Helper::getPasteId());
  69. $this->assertFalse($this->_model->exists(Helper::getPasteId()), 'paste successfully deleted');
  70. $this->assertFalse($this->_model->existsComment(Helper::getPasteId(), Helper::getPasteId(), Helper::getCommentId()), 'comment was deleted with paste');
  71. $this->assertFalse($this->_model->read(Helper::getPasteId()), 'paste can no longer be found');
  72. }
  73. /**
  74. * pastes a-g are expired and should get deleted, x never expires and y-z expire in an hour
  75. */
  76. public function testPurge()
  77. {
  78. $expired = Helper::getPaste(2, array('expire_date' => 1344803344));
  79. $paste = Helper::getPaste(2, array('expire_date' => time() + 3600));
  80. $keys = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'x', 'y', 'z');
  81. $ids = array();
  82. foreach ($keys as $key) {
  83. $ids[$key] = hash('fnv164', $key);
  84. $this->assertFalse($this->_model->exists($ids[$key]), "paste $key does not yet exist");
  85. if (in_array($key, array('x', 'y', 'z'))) {
  86. $this->assertTrue($this->_model->create($ids[$key], $paste), "store $key paste");
  87. } elseif ($key === 'x') {
  88. $this->assertTrue($this->_model->create($ids[$key], Helper::getPaste()), "store $key paste");
  89. } else {
  90. $this->assertTrue($this->_model->create($ids[$key], $expired), "store $key paste");
  91. }
  92. $this->assertTrue($this->_model->exists($ids[$key]), "paste $key exists after storing it");
  93. }
  94. $this->_model->purge(10);
  95. foreach ($ids as $key => $id) {
  96. if (in_array($key, array('x', 'y', 'z'))) {
  97. $this->assertTrue($this->_model->exists($id), "paste $key exists after purge");
  98. $this->_model->delete($id);
  99. } else {
  100. $this->assertFalse($this->_model->exists($id), "paste $key was purged");
  101. }
  102. }
  103. }
  104. public function testErrorDetection()
  105. {
  106. $this->_model->delete(Helper::getPasteId());
  107. $paste = Helper::getPaste(2, array('expire' => "Invalid UTF-8 sequence: \xB1\x31"));
  108. $this->assertFalse($this->_model->exists(Helper::getPasteId()), 'paste does not yet exist');
  109. $this->assertFalse($this->_model->create(Helper::getPasteId(), $paste), 'unable to store broken paste');
  110. $this->assertFalse($this->_model->exists(Helper::getPasteId()), 'paste does still not exist');
  111. }
  112. public function testCommentErrorDetection()
  113. {
  114. $this->_model->delete(Helper::getPasteId());
  115. $comment = Helper::getComment(1, array('nickname' => "Invalid UTF-8 sequence: \xB1\x31"));
  116. $this->assertFalse($this->_model->exists(Helper::getPasteId()), 'paste does not yet exist');
  117. $this->assertTrue($this->_model->create(Helper::getPasteId(), Helper::getPaste()), 'store new paste');
  118. $this->assertTrue($this->_model->exists(Helper::getPasteId()), 'paste exists after storing it');
  119. $this->assertFalse($this->_model->existsComment(Helper::getPasteId(), Helper::getPasteId(), Helper::getCommentId()), 'comment does not yet exist');
  120. $this->assertFalse($this->_model->createComment(Helper::getPasteId(), Helper::getPasteId(), Helper::getCommentId(), $comment), 'unable to store broken comment');
  121. $this->assertFalse($this->_model->existsComment(Helper::getPasteId(), Helper::getPasteId(), Helper::getCommentId()), 'comment does still not exist');
  122. }
  123. /**
  124. * @throws Exception
  125. */
  126. public function testKeyValueStore()
  127. {
  128. $salt = bin2hex(random_bytes(256));
  129. $this->_model->setValue($salt, 'salt', '');
  130. $storedSalt = $this->_model->getValue('salt', '');
  131. $this->assertEquals($salt, $storedSalt);
  132. $this->_model->purgeValues('salt', time() + 60);
  133. $this->assertFalse($this->_model->getValue('salt', 'master'));
  134. $client = hash_hmac('sha512', '127.0.0.1', $salt);
  135. $expire = time();
  136. $this->_model->setValue($expire, 'traffic_limiter', $client);
  137. $storedExpired = $this->_model->getValue('traffic_limiter', $client);
  138. $this->assertEquals($expire, $storedExpired);
  139. $this->assertEquals($expire, $storedExpired);
  140. $this->_model->purgeValues('traffic_limiter', time() - 60);
  141. $this->assertEquals($storedExpired, $this->_model->getValue('traffic_limiter', $client));
  142. $this->_model->purgeValues('traffic_limiter', time() + 60);
  143. $this->assertFalse($this->_model->getValue('traffic_limiter', $client));
  144. $purgeAt = $expire + (15 * 60);
  145. $this->_model->setValue($purgeAt, 'purge_limiter', '');
  146. $storedPurgedAt = $this->_model->getValue('purge_limiter', '');
  147. $this->assertEquals($purgeAt, $storedPurgedAt);
  148. $this->_model->purgeValues('purge_limiter', time() + 60);
  149. $this->assertFalse($this->_model->getValue('purge_limiter', 'at'));
  150. }
  151. /**
  152. * @throws Exception
  153. */
  154. public function testKeyValuePurgeTrafficLimiter()
  155. {
  156. $salt = bin2hex(random_bytes(256));
  157. $client = hash_hmac('sha512', '127.0.0.1', $salt);
  158. $expire = time();
  159. $this->_model->setValue($expire, 'traffic_limiter', $client);
  160. $storedExpired = $this->_model->getValue('traffic_limiter', $client);
  161. $this->assertEquals($expire, $storedExpired);
  162. $this->_model->purgeValues('traffic_limiter', time() - 60);
  163. $this->assertEquals($storedExpired, $this->_model->getValue('traffic_limiter', $client));
  164. $this->_model->purgeValues('traffic_limiter', time() + 60);
  165. $this->assertFalse($this->_model->getValue('traffic_limiter', $client));
  166. }
  167. public function testKeyValuePurgeTrafficLimiterWithKey()
  168. {
  169. $salt = bin2hex(random_bytes(256));
  170. $client = hash_hmac('sha512', '127.0.0.1', $salt);
  171. $expire = time();
  172. $this->_model->setValue($expire, 'traffic_limiter', $client);
  173. $storedExpired = $this->_model->getValue('traffic_limiter', $client);
  174. $this->assertEquals($expire, $storedExpired);
  175. $this->_model->purgeValues('traffic_limiter', time() - 60);
  176. $this->assertEquals($storedExpired, $this->_model->getValue('traffic_limiter', $client));
  177. $this->_model->purgeValues('traffic_limiter', time() + 60);
  178. $this->assertFalse($this->_model->getValue('traffic_limiter', $client));
  179. }
  180. }
  181. /**
  182. * Class StorageClientStub provides a limited stub for performing the unit test
  183. */
  184. class StorageClientStub extends StorageClient
  185. {
  186. private $_config = null;
  187. private $_connection = null;
  188. private $_buckets = array();
  189. public function __construct(array $config = array())
  190. {
  191. $this->_config = $config;
  192. $this->_connection = new ConnectionInterfaceStub();
  193. }
  194. public function bucket($name, $userProject = false)
  195. {
  196. if (!key_exists($name, $this->_buckets)) {
  197. $b = new BucketStub($this->_connection, $name, array(), $this);
  198. $this->_buckets[$name] = $b;
  199. }
  200. return $this->_buckets[$name];
  201. }
  202. /**
  203. * @throws \Google\Cloud\Core\Exception\NotFoundException
  204. */
  205. public function deleteBucket($name)
  206. {
  207. if (key_exists($name, $this->_buckets)) {
  208. unset($this->_buckets[$name]);
  209. } else {
  210. throw new NotFoundException();
  211. }
  212. }
  213. public function buckets(array $options = array())
  214. {
  215. throw new BadMethodCallException('not supported by this stub');
  216. }
  217. public function registerStreamWrapper($protocol = null)
  218. {
  219. throw new BadMethodCallException('not supported by this stub');
  220. }
  221. public function unregisterStreamWrapper($protocol = null)
  222. {
  223. throw new BadMethodCallException('not supported by this stub');
  224. }
  225. public function signedUrlUploader($uri, $data, array $options = array())
  226. {
  227. throw new BadMethodCallException('not supported by this stub');
  228. }
  229. public function timestamp(\DateTimeInterface $timestamp, $nanoSeconds = null)
  230. {
  231. throw new BadMethodCallException('not supported by this stub');
  232. }
  233. public function getServiceAccount(array $options = array())
  234. {
  235. throw new BadMethodCallException('not supported by this stub');
  236. }
  237. public function hmacKeys(array $options = array())
  238. {
  239. throw new BadMethodCallException('not supported by this stub');
  240. }
  241. public function hmacKey($accessId, $projectId = null, array $metadata = array())
  242. {
  243. throw new BadMethodCallException('not supported by this stub');
  244. }
  245. public function createHmacKey($serviceAccountEmail, array $options = array())
  246. {
  247. throw new BadMethodCallException('not supported by this stub');
  248. }
  249. public function createBucket($name, array $options = array())
  250. {
  251. if (key_exists($name, $this->_buckets)) {
  252. throw new BadRequestException('already exists');
  253. }
  254. $b = new BucketStub($this->_connection, $name, array(), $this);
  255. $this->_buckets[$name] = $b;
  256. return $b;
  257. }
  258. }
  259. /**
  260. * Class BucketStub stubs a GCS bucket.
  261. */
  262. class BucketStub extends Bucket
  263. {
  264. public $_objects;
  265. private $_name;
  266. private $_info;
  267. private $_connection;
  268. private $_client;
  269. public function __construct(ConnectionInterface $connection, $name, array $info = array(), $client = null)
  270. {
  271. $this->_name = $name;
  272. $this->_info = $info;
  273. $this->_connection = $connection;
  274. $this->_objects = array();
  275. $this->_client = $client;
  276. }
  277. public function acl()
  278. {
  279. throw new BadMethodCallException('not supported by this stub');
  280. }
  281. public function defaultAcl()
  282. {
  283. throw new BadMethodCallException('not supported by this stub');
  284. }
  285. public function exists()
  286. {
  287. return true;
  288. }
  289. public function upload($data, array $options = array())
  290. {
  291. if (!is_string($data) || !key_exists('name', $options)) {
  292. throw new BadMethodCallException('not supported by this stub');
  293. }
  294. $name = $options['name'];
  295. $generation = '1';
  296. $o = new StorageObjectStub($this->_connection, $name, $this, $generation, $options);
  297. $this->_objects[$options['name']] = $o;
  298. $o->setData($data);
  299. }
  300. public function uploadAsync($data, array $options = array())
  301. {
  302. throw new BadMethodCallException('not supported by this stub');
  303. }
  304. public function getResumableUploader($data, array $options = array())
  305. {
  306. throw new BadMethodCallException('not supported by this stub');
  307. }
  308. public function getStreamableUploader($data, array $options = array())
  309. {
  310. throw new BadMethodCallException('not supported by this stub');
  311. }
  312. public function object($name, array $options = array())
  313. {
  314. if (key_exists($name, $this->_objects)) {
  315. return $this->_objects[$name];
  316. } else {
  317. return new StorageObjectStub($this->_connection, $name, $this, null, $options);
  318. }
  319. }
  320. public function objects(array $options = array())
  321. {
  322. $prefix = key_exists('prefix', $options) ? $options['prefix'] : '';
  323. return new CallbackFilterIterator(
  324. new ArrayIterator($this->_objects),
  325. function ($current, $key, $iterator) use ($prefix) {
  326. return substr($key, 0, strlen($prefix)) == $prefix;
  327. }
  328. );
  329. }
  330. public function createNotification($topic, array $options = array())
  331. {
  332. throw new BadMethodCallException('not supported by this stub');
  333. }
  334. public function notification($id)
  335. {
  336. throw new BadMethodCallException('not supported by this stub');
  337. }
  338. public function notifications(array $options = array())
  339. {
  340. throw new BadMethodCallException('not supported by this stub');
  341. }
  342. public function delete(array $options = array())
  343. {
  344. $this->_client->deleteBucket($this->_name);
  345. }
  346. public function update(array $options = array())
  347. {
  348. throw new BadMethodCallException('not supported by this stub');
  349. }
  350. public function compose(array $sourceObjects, $name, array $options = array())
  351. {
  352. throw new BadMethodCallException('not supported by this stub');
  353. }
  354. public function info(array $options = array())
  355. {
  356. throw new BadMethodCallException('not supported by this stub');
  357. }
  358. public function reload(array $options = array())
  359. {
  360. throw new BadMethodCallException('not supported by this stub');
  361. }
  362. public function name()
  363. {
  364. return $this->_name;
  365. }
  366. public static function lifecycle(array $lifecycle = array())
  367. {
  368. throw new BadMethodCallException('not supported by this stub');
  369. }
  370. public function currentLifecycle(array $options = array())
  371. {
  372. throw new BadMethodCallException('not supported by this stub');
  373. }
  374. public function isWritable($file = null)
  375. {
  376. throw new BadMethodCallException('not supported by this stub');
  377. }
  378. public function iam()
  379. {
  380. throw new BadMethodCallException('not supported by this stub');
  381. }
  382. public function lockRetentionPolicy(array $options = array())
  383. {
  384. throw new BadMethodCallException('not supported by this stub');
  385. }
  386. public function signedUrl($expires, array $options = array())
  387. {
  388. throw new BadMethodCallException('not supported by this stub');
  389. }
  390. public function generateSignedPostPolicyV4($objectName, $expires, array $options = array())
  391. {
  392. throw new BadMethodCallException('not supported by this stub');
  393. }
  394. }
  395. /**
  396. * Class StorageObjectStub stubs a GCS storage object.
  397. */
  398. class StorageObjectStub extends StorageObject
  399. {
  400. private $_name;
  401. private $_data;
  402. private $_info;
  403. private $_bucket;
  404. private $_generation;
  405. private $_exists = false;
  406. private $_connection;
  407. public function __construct(ConnectionInterface $connection, $name, $bucket, $generation = null, array $info = array(), $encryptionKey = null, $encryptionKeySHA256 = null)
  408. {
  409. $this->_name = $name;
  410. $this->_bucket = $bucket;
  411. $this->_generation = $generation;
  412. $this->_info = $info;
  413. $this->_connection = $connection;
  414. $timeCreated = new Datetime();
  415. $this->_info['metadata']['timeCreated'] = $timeCreated->format(GoogleCloudStorage::DATETIME_FORMAT);
  416. }
  417. public function acl()
  418. {
  419. throw new BadMethodCallException('not supported by this stub');
  420. }
  421. public function exists(array $options = array())
  422. {
  423. return key_exists($this->_name, $this->_bucket->_objects);
  424. }
  425. /**
  426. * @throws NotFoundException
  427. */
  428. public function delete(array $options = array())
  429. {
  430. if (key_exists($this->_name, $this->_bucket->_objects)) {
  431. unset($this->_bucket->_objects[$this->_name]);
  432. } else {
  433. throw new NotFoundException('key ' . $this->_name . ' not found.');
  434. }
  435. }
  436. /**
  437. * @throws NotFoundException
  438. */
  439. public function update(array $metadata, array $options = array())
  440. {
  441. if (!$this->_exists) {
  442. throw new NotFoundException('key ' . $this->_name . ' not found.');
  443. }
  444. $this->_info = $metadata;
  445. }
  446. public function copy($destination, array $options = array())
  447. {
  448. throw new BadMethodCallException('not supported by this stub');
  449. }
  450. public function rewrite($destination, array $options = array())
  451. {
  452. throw new BadMethodCallException('not supported by this stub');
  453. }
  454. public function rename($name, array $options = array())
  455. {
  456. throw new BadMethodCallException('not supported by this stub');
  457. }
  458. /**
  459. * @throws NotFoundException
  460. */
  461. public function downloadAsString(array $options = array())
  462. {
  463. if (!$this->_exists) {
  464. throw new NotFoundException('key ' . $this->_name . ' not found.');
  465. }
  466. return $this->_data;
  467. }
  468. public function downloadToFile($path, array $options = array())
  469. {
  470. throw new BadMethodCallException('not supported by this stub');
  471. }
  472. public function downloadAsStream(array $options = array())
  473. {
  474. throw new BadMethodCallException('not supported by this stub');
  475. }
  476. public function downloadAsStreamAsync(array $options = array())
  477. {
  478. throw new BadMethodCallException('not supported by this stub');
  479. }
  480. public function signedUrl($expires, array $options = array())
  481. {
  482. throw new BadMethodCallException('not supported by this stub');
  483. }
  484. public function signedUploadUrl($expires, array $options = array())
  485. {
  486. throw new BadMethodCallException('not supported by this stub');
  487. }
  488. public function beginSignedUploadSession(array $options = array())
  489. {
  490. throw new BadMethodCallException('not supported by this stub');
  491. }
  492. public function info(array $options = array())
  493. {
  494. return key_exists('metadata',$this->_info) ? $this->_info['metadata'] : array();
  495. }
  496. public function reload(array $options = array())
  497. {
  498. throw new BadMethodCallException('not supported by this stub');
  499. }
  500. public function name()
  501. {
  502. return $this->_name;
  503. }
  504. public function identity()
  505. {
  506. throw new BadMethodCallException('not supported by this stub');
  507. }
  508. public function gcsUri()
  509. {
  510. return sprintf(
  511. 'gs://%s/%s',
  512. $this->_bucket->name(),
  513. $this->_name
  514. );
  515. }
  516. public function setData($data)
  517. {
  518. $this->_data = $data;
  519. $this->_exists = true;
  520. }
  521. }
  522. /**
  523. * Class ConnectionInterfaceStub required for the stubs.
  524. */
  525. class ConnectionInterfaceStub implements ConnectionInterface
  526. {
  527. public function deleteAcl(array $args = array())
  528. {
  529. throw new BadMethodCallException('not supported by this stub');
  530. }
  531. public function getAcl(array $args = array())
  532. {
  533. throw new BadMethodCallException('not supported by this stub');
  534. }
  535. public function listAcl(array $args = array())
  536. {
  537. throw new BadMethodCallException('not supported by this stub');
  538. }
  539. public function insertAcl(array $args = array())
  540. {
  541. throw new BadMethodCallException('not supported by this stub');
  542. }
  543. public function patchAcl(array $args = array())
  544. {
  545. throw new BadMethodCallException('not supported by this stub');
  546. }
  547. public function deleteBucket(array $args = array())
  548. {
  549. throw new BadMethodCallException('not supported by this stub');
  550. }
  551. public function getBucket(array $args = array())
  552. {
  553. throw new BadMethodCallException('not supported by this stub');
  554. }
  555. public function listBuckets(array $args = array())
  556. {
  557. throw new BadMethodCallException('not supported by this stub');
  558. }
  559. public function insertBucket(array $args = array())
  560. {
  561. throw new BadMethodCallException('not supported by this stub');
  562. }
  563. public function getBucketIamPolicy(array $args)
  564. {
  565. throw new BadMethodCallException('not supported by this stub');
  566. }
  567. public function setBucketIamPolicy(array $args)
  568. {
  569. throw new BadMethodCallException('not supported by this stub');
  570. }
  571. public function testBucketIamPermissions(array $args)
  572. {
  573. throw new BadMethodCallException('not supported by this stub');
  574. }
  575. public function patchBucket(array $args = array())
  576. {
  577. throw new BadMethodCallException('not supported by this stub');
  578. }
  579. public function deleteObject(array $args = array())
  580. {
  581. throw new BadMethodCallException('not supported by this stub');
  582. }
  583. public function copyObject(array $args = array())
  584. {
  585. throw new BadMethodCallException('not supported by this stub');
  586. }
  587. public function rewriteObject(array $args = array())
  588. {
  589. throw new BadMethodCallException('not supported by this stub');
  590. }
  591. public function composeObject(array $args = array())
  592. {
  593. throw new BadMethodCallException('not supported by this stub');
  594. }
  595. public function getObject(array $args = array())
  596. {
  597. throw new BadMethodCallException('not supported by this stub');
  598. }
  599. public function listObjects(array $args = array())
  600. {
  601. throw new BadMethodCallException('not supported by this stub');
  602. }
  603. public function patchObject(array $args = array())
  604. {
  605. throw new BadMethodCallException('not supported by this stub');
  606. }
  607. public function downloadObject(array $args = array())
  608. {
  609. throw new BadMethodCallException('not supported by this stub');
  610. }
  611. public function insertObject(array $args = array())
  612. {
  613. throw new BadMethodCallException('not supported by this stub');
  614. }
  615. public function getNotification(array $args = array())
  616. {
  617. throw new BadMethodCallException('not supported by this stub');
  618. }
  619. public function deleteNotification(array $args = array())
  620. {
  621. throw new BadMethodCallException('not supported by this stub');
  622. }
  623. public function insertNotification(array $args = array())
  624. {
  625. throw new BadMethodCallException('not supported by this stub');
  626. }
  627. public function listNotifications(array $args = array())
  628. {
  629. throw new BadMethodCallException('not supported by this stub');
  630. }
  631. public function getServiceAccount(array $args = array())
  632. {
  633. throw new BadMethodCallException('not supported by this stub');
  634. }
  635. public function lockRetentionPolicy(array $args = array())
  636. {
  637. throw new BadMethodCallException('not supported by this stub');
  638. }
  639. public function createHmacKey(array $args = array())
  640. {
  641. throw new BadMethodCallException('not supported by this stub');
  642. }
  643. public function deleteHmacKey(array $args = array())
  644. {
  645. throw new BadMethodCallException('not supported by this stub');
  646. }
  647. public function getHmacKey(array $args = array())
  648. {
  649. throw new BadMethodCallException('not supported by this stub');
  650. }
  651. public function updateHmacKey(array $args = array())
  652. {
  653. throw new BadMethodCallException('not supported by this stub');
  654. }
  655. public function listHmacKeys(array $args = array())
  656. {
  657. throw new BadMethodCallException('not supported by this stub');
  658. }
  659. }