Search in sources :

Example 1 with BucketName

use of sirius.biz.storage.s3.BucketName in project gapic-generator-java by googleapis.

the class SyncDeleteBucketBucketname method syncDeleteBucketBucketname.

public static void syncDeleteBucketBucketname() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        BucketName name = BucketName.of("[PROJECT]", "[BUCKET]");
        storageClient.deleteBucket(name);
    }
}
Also used : BucketName(com.google.storage.v2.BucketName) StorageClient(com.google.storage.v2.StorageClient)

Example 2 with BucketName

use of sirius.biz.storage.s3.BucketName in project sirius-biz by scireum.

the class JupiterSync method syncUplinkRepository.

private void syncUplinkRepository(ProcessContext processContext, JupiterConnector connection, List<RepositoryFile> repositoryFiles, Set<String> filesToDelete) {
    if (Strings.isEmpty(uplinkStore) || Strings.isEmpty(getEffectiveUplinkBucket())) {
        processContext.debug(ProcessLog.info().withFormattedMessage("Skipping uplink checks for %s as no repository or bucket is configured.", connection.getName()));
        return;
    }
    processContext.debug(ProcessLog.info().withFormattedMessage("Checking uplink repository (%s in %s) for %s...", getEffectiveUplinkBucket(), uplinkStore, connection.getName()));
    try {
        ObjectStore store = objectStores.getStore(uplinkStore);
        BucketName uplinkBucketName = store.getBucketName(getEffectiveUplinkBucket());
        store.listObjects(uplinkBucketName, null, object -> {
            if (uplinkIgnoredPaths.stream().noneMatch(ignoredPath -> object.getKey().startsWith(ignoredPath))) {
                handleUplinkFile(processContext, connection, repositoryFiles, filesToDelete, store, uplinkBucketName, object);
            }
            return true;
        });
    } catch (Exception e) {
        processContext.handle(Exceptions.handle().error(e).withSystemErrorMessage("Failed to check the uplink repository %s for %s: %s (%s)", uplinkStore, connection.getName()).handle());
    }
}
Also used : ObjectStore(sirius.biz.storage.s3.ObjectStore) BucketName(sirius.biz.storage.s3.BucketName) HandledException(sirius.kernel.health.HandledException)

Example 3 with BucketName

use of sirius.biz.storage.s3.BucketName in project gapic-generator-java by googleapis.

the class SyncLockBucketRetentionPolicyBucketname method syncLockBucketRetentionPolicyBucketname.

public static void syncLockBucketRetentionPolicyBucketname() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        BucketName bucket = BucketName.of("[PROJECT]", "[BUCKET]");
        Bucket response = storageClient.lockBucketRetentionPolicy(bucket);
    }
}
Also used : BucketName(com.google.storage.v2.BucketName) Bucket(com.google.storage.v2.Bucket) StorageClient(com.google.storage.v2.StorageClient)

Example 4 with BucketName

use of sirius.biz.storage.s3.BucketName in project gapic-generator-java by googleapis.

the class SyncGetBucketBucketname method syncGetBucketBucketname.

public static void syncGetBucketBucketname() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        BucketName name = BucketName.of("[PROJECT]", "[BUCKET]");
        Bucket response = storageClient.getBucket(name);
    }
}
Also used : BucketName(com.google.storage.v2.BucketName) Bucket(com.google.storage.v2.Bucket) StorageClient(com.google.storage.v2.StorageClient)

Example 5 with BucketName

use of sirius.biz.storage.s3.BucketName in project gapic-generator-java by googleapis.

the class SyncGetNotificationBucketname method syncGetNotificationBucketname.

public static void syncGetNotificationBucketname() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        BucketName name = BucketName.of("[PROJECT]", "[BUCKET]");
        Notification response = storageClient.getNotification(name);
    }
}
Also used : BucketName(com.google.storage.v2.BucketName) StorageClient(com.google.storage.v2.StorageClient) Notification(com.google.storage.v2.Notification)

Aggregations

BucketName (com.google.storage.v2.BucketName)4 StorageClient (com.google.storage.v2.StorageClient)4 Bucket (com.google.storage.v2.Bucket)2 Notification (com.google.storage.v2.Notification)1 BucketName (sirius.biz.storage.s3.BucketName)1 ObjectStore (sirius.biz.storage.s3.ObjectStore)1 HandledException (sirius.kernel.health.HandledException)1