Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/composer/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@
'OCP\\Files\\Notify\\IChange' => $baseDir . '/lib/public/Files/Notify/IChange.php',
'OCP\\Files\\Notify\\INotifyHandler' => $baseDir . '/lib/public/Files/Notify/INotifyHandler.php',
'OCP\\Files\\Notify\\IRenameChange' => $baseDir . '/lib/public/Files/Notify/IRenameChange.php',
'OCP\\Files\\ObjectStore\\Events\\BucketCreatedEvent' => $baseDir . '/lib/public/Files/ObjectStore/Events/BucketCreatedEvent.php',
'OCP\\Files\\ObjectStore\\IObjectStore' => $baseDir . '/lib/public/Files/ObjectStore/IObjectStore.php',
'OCP\\Files\\ObjectStore\\IObjectStoreMultiPartUpload' => $baseDir . '/lib/public/Files/ObjectStore/IObjectStoreMultiPartUpload.php',
'OCP\\Files\\ReservedWordException' => $baseDir . '/lib/public/Files/ReservedWordException.php',
Expand Down
1 change: 1 addition & 0 deletions lib/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
'OCP\\Files\\Notify\\IChange' => __DIR__ . '/../../..' . '/lib/public/Files/Notify/IChange.php',
'OCP\\Files\\Notify\\INotifyHandler' => __DIR__ . '/../../..' . '/lib/public/Files/Notify/INotifyHandler.php',
'OCP\\Files\\Notify\\IRenameChange' => __DIR__ . '/../../..' . '/lib/public/Files/Notify/IRenameChange.php',
'OCP\\Files\\ObjectStore\\Events\\BucketCreatedEvent' => __DIR__ . '/../../..' . '/lib/public/Files/ObjectStore/Events/BucketCreatedEvent.php',
'OCP\\Files\\ObjectStore\\IObjectStore' => __DIR__ . '/../../..' . '/lib/public/Files/ObjectStore/IObjectStore.php',
'OCP\\Files\\ObjectStore\\IObjectStoreMultiPartUpload' => __DIR__ . '/../../..' . '/lib/public/Files/ObjectStore/IObjectStoreMultiPartUpload.php',
'OCP\\Files\\ReservedWordException' => __DIR__ . '/../../..' . '/lib/public/Files/ReservedWordException.php',
Expand Down
9 changes: 9 additions & 0 deletions lib/private/Files/ObjectStore/S3ConnectionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
use Aws\S3\S3Client;
use GuzzleHttp\Promise;
use GuzzleHttp\Promise\RejectedPromise;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\ObjectStore\Events\BucketCreatedEvent;
use OCP\Files\StorageNotAvailableException;
use OCP\ICertificateManager;
use OCP\Server;
Expand Down Expand Up @@ -164,6 +166,13 @@ public function getConnection() {
throw new StorageNotAvailableException("The bucket will not be created because the name is not dns compatible, please correct it: " . $this->bucket);
}
$this->connection->createBucket(['Bucket' => $this->bucket]);
Server::get(IEventDispatcher::class)
->dispatchTyped(new BucketCreatedEvent(
$this->bucket,
$options['endpoint'],
$options['region'],
$options['version']
));
$this->testTimeout();
} catch (S3Exception $e) {
$logger->debug('Invalid remote storage.', [
Expand Down
75 changes: 75 additions & 0 deletions lib/public/Files/ObjectStore/Events/BucketCreatedEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?php

declare(strict_types=1);

/**
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace OCP\Files\ObjectStore\Events;

use OCP\EventDispatcher\Event;

/**
* @since 29.0.16
*/
class BucketCreatedEvent extends Event {
private string $bucket;
private string $endpoint;
private string $region;
private string $version;

/**
* @param string $bucket
* @param string $endpoint
* @param string $region
* @param string $version
*
* @since 29.0.16
*/
public function __construct(
string $bucket,
string $endpoint,
string $region,
string $version = 'latest',
) {
parent::__construct();

$this->bucket = $bucket;
$this->endpoint = $endpoint;
$this->region = $region;
$this->version = $version;
}

/**
* @return string
* @since 29.0.16
*/
public function getBucket(): string {
return $this->bucket;
}

/**
* @return string
* @since 29.0.16
*/
public function getEndpoint(): string {
return $this->endpoint;
}

/**
* @return string
* @since 29.0.16
*/
public function getRegion(): string {
return $this->region;
}

/**
* @return string
* @since 29.0.16
*/
public function getVersion(): string {
return $this->version;
}
}
Loading