use of com.google.storage.v2.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);
}
}
use of com.google.storage.v2.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());
}
}
use of com.google.storage.v2.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);
}
}
use of com.google.storage.v2.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);
}
}
use of com.google.storage.v2.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);
}
}
Aggregations