com.google.api.services.storage.model.Bucket.getVersioning()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(130)

本文整理了Java中com.google.api.services.storage.model.Bucket.getVersioning()方法的一些代码示例,展示了Bucket.getVersioning()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bucket.getVersioning()方法的具体详情如下:
包路径:com.google.api.services.storage.model.Bucket
类名称:Bucket
方法名:getVersioning

Bucket.getVersioning介绍

暂无

代码示例

代码示例来源:origin: googleapis/google-cloud-java

builder.setOwner(Entity.fromPb(bucketPb.getOwner().getEntity()));
if (bucketPb.getVersioning() != null) {
 builder.setVersioningEnabled(bucketPb.getVersioning().getEnabled());

代码示例来源:origin: spinnaker/halyard

private static void ensureBucketExistsAndVersioned(Storage storage, String projectId, String locationId, String bucketId) {
 Bucket bucket;
 try {
  bucket = storage.buckets().get(bucketId).execute();
 } catch (GoogleJsonResponseException e) {
  if (e.getStatusCode() == 404) {
   bucket = createBucket(storage, projectId, locationId, bucketId);
  } else {
   throw new RuntimeException("Can't retrieve bucket", e);
  }
 } catch (IOException e) {
  throw new RuntimeException("Can't retrieve bucket", e);
 }
 if (!bucket.getVersioning().getEnabled()) {
  throw new RuntimeException("Bucket " + bucketId + " is not versioned. Aborting.");
 }
}

代码示例来源:origin: com.netflix.spinnaker.halyard/halyard-backup

private static void ensureBucketExistsAndVersioned(Storage storage, String projectId, String locationId, String bucketId) {
 Bucket bucket;
 try {
  bucket = storage.buckets().get(bucketId).execute();
 } catch (GoogleJsonResponseException e) {
  if (e.getStatusCode() == 404) {
   bucket = createBucket(storage, projectId, locationId, bucketId);
  } else {
   throw new RuntimeException("Can't retrieve bucket", e);
  }
 } catch (IOException e) {
  throw new RuntimeException("Can't retrieve bucket", e);
 }
 if (!bucket.getVersioning().getEnabled()) {
  throw new RuntimeException("Bucket " + bucketId + " is not versioned. Aborting.");
 }
}

代码示例来源:origin: com.google.gcloud/gcloud-java-storage

builder.owner(Entity.fromPb(bucketPb.getOwner().getEntity()));
if (bucketPb.getVersioning() != null) {
 builder.versioningEnabled(bucketPb.getVersioning().getEnabled());

代码示例来源:origin: com.google.cloud/google-cloud-storage

builder.setOwner(Entity.fromPb(bucketPb.getOwner().getEntity()));
if (bucketPb.getVersioning() != null) {
 builder.setVersioningEnabled(bucketPb.getVersioning().getEnabled());

相关文章