File tree Expand file tree Collapse file tree 4 files changed +86
-0
lines changed
private/Files/ObjectStore
public/Files/ObjectStore/Events Expand file tree Collapse file tree 4 files changed +86
-0
lines changed Original file line number Diff line number Diff line change 396396 'OCP \\Files \\Notify \\IChange ' => $ baseDir . '/lib/public/Files/Notify/IChange.php ' ,
397397 'OCP \\Files \\Notify \\INotifyHandler ' => $ baseDir . '/lib/public/Files/Notify/INotifyHandler.php ' ,
398398 'OCP \\Files \\Notify \\IRenameChange ' => $ baseDir . '/lib/public/Files/Notify/IRenameChange.php ' ,
399+ 'OCP \\Files \\ObjectStore \\Events \\BucketCreatedEvent ' => $ baseDir . '/lib/public/Files/ObjectStore/Events/BucketCreatedEvent.php ' ,
399400 'OCP \\Files \\ObjectStore \\IObjectStore ' => $ baseDir . '/lib/public/Files/ObjectStore/IObjectStore.php ' ,
400401 'OCP \\Files \\ObjectStore \\IObjectStoreMultiPartUpload ' => $ baseDir . '/lib/public/Files/ObjectStore/IObjectStoreMultiPartUpload.php ' ,
401402 'OCP \\Files \\ReservedWordException ' => $ baseDir . '/lib/public/Files/ReservedWordException.php ' ,
Original file line number Diff line number Diff line change @@ -429,6 +429,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
429429 'OCP \\Files \\Notify \\IChange ' => __DIR__ . '/../../.. ' . '/lib/public/Files/Notify/IChange.php ' ,
430430 'OCP \\Files \\Notify \\INotifyHandler ' => __DIR__ . '/../../.. ' . '/lib/public/Files/Notify/INotifyHandler.php ' ,
431431 'OCP \\Files \\Notify \\IRenameChange ' => __DIR__ . '/../../.. ' . '/lib/public/Files/Notify/IRenameChange.php ' ,
432+ 'OCP \\Files \\ObjectStore \\Events \\BucketCreatedEvent ' => __DIR__ . '/../../.. ' . '/lib/public/Files/ObjectStore/Events/BucketCreatedEvent.php ' ,
432433 'OCP \\Files \\ObjectStore \\IObjectStore ' => __DIR__ . '/../../.. ' . '/lib/public/Files/ObjectStore/IObjectStore.php ' ,
433434 'OCP \\Files \\ObjectStore \\IObjectStoreMultiPartUpload ' => __DIR__ . '/../../.. ' . '/lib/public/Files/ObjectStore/IObjectStoreMultiPartUpload.php ' ,
434435 'OCP \\Files \\ReservedWordException ' => __DIR__ . '/../../.. ' . '/lib/public/Files/ReservedWordException.php ' ,
Original file line number Diff line number Diff line change 4040use Aws \S3 \S3Client ;
4141use GuzzleHttp \Promise ;
4242use GuzzleHttp \Promise \RejectedPromise ;
43+ use OCP \EventDispatcher \IEventDispatcher ;
44+ use OCP \Files \ObjectStore \Events \BucketCreatedEvent ;
4345use OCP \Files \StorageNotAvailableException ;
4446use OCP \ICertificateManager ;
4547use OCP \Server ;
@@ -164,6 +166,13 @@ public function getConnection() {
164166 throw new StorageNotAvailableException ("The bucket will not be created because the name is not dns compatible, please correct it: " . $ this ->bucket );
165167 }
166168 $ this ->connection ->createBucket (['Bucket ' => $ this ->bucket ]);
169+ Server::get (IEventDispatcher::class)
170+ ->dispatchTyped (new BucketCreatedEvent (
171+ $ this ->bucket ,
172+ $ options ['endpoint ' ],
173+ $ options ['region ' ],
174+ $ options ['version ' ]
175+ ));
167176 $ this ->testTimeout ();
168177 } catch (S3Exception $ e ) {
169178 $ logger ->debug ('Invalid remote storage. ' , [
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ /**
6+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
7+ * SPDX-License-Identifier: AGPL-3.0-only
8+ */
9+ namespace OCP \Files \ObjectStore \Events ;
10+
11+ use OCP \EventDispatcher \Event ;
12+
13+ /**
14+ * @since 29.0.16
15+ */
16+ class BucketCreatedEvent extends Event {
17+ private string $ bucket ;
18+ private string $ endpoint ;
19+ private string $ region ;
20+ private string $ version ;
21+
22+ /**
23+ * @param string $bucket
24+ * @param string $endpoint
25+ * @param string $region
26+ * @param string $version
27+ *
28+ * @since 29.0.16
29+ */
30+ public function __construct (
31+ string $ bucket ,
32+ string $ endpoint ,
33+ string $ region ,
34+ string $ version = 'latest ' ,
35+ ) {
36+ parent ::__construct ();
37+
38+ $ this ->bucket = $ bucket ;
39+ $ this ->endpoint = $ endpoint ;
40+ $ this ->region = $ region ;
41+ $ this ->version = $ version ;
42+ }
43+
44+ /**
45+ * @return string
46+ * @since 29.0.16
47+ */
48+ public function getBucket (): string {
49+ return $ this ->bucket ;
50+ }
51+
52+ /**
53+ * @return string
54+ * @since 29.0.16
55+ */
56+ public function getEndpoint (): string {
57+ return $ this ->endpoint ;
58+ }
59+
60+ /**
61+ * @return string
62+ * @since 29.0.16
63+ */
64+ public function getRegion (): string {
65+ return $ this ->region ;
66+ }
67+
68+ /**
69+ * @return string
70+ * @since 29.0.16
71+ */
72+ public function getVersion (): string {
73+ return $ this ->version ;
74+ }
75+ }
You can’t perform that action at this time.
0 commit comments