当前位置: 首页>>代码示例>>Java>>正文


Java Bucket.setLocation方法代码示例

本文整理汇总了Java中com.google.api.services.storage.model.Bucket.setLocation方法的典型用法代码示例。如果您正苦于以下问题:Java Bucket.setLocation方法的具体用法?Java Bucket.setLocation怎么用?Java Bucket.setLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.api.services.storage.model.Bucket的用法示例。


在下文中一共展示了Bucket.setLocation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createBucket

import com.google.api.services.storage.model.Bucket; //导入方法依赖的package包/类
private static Bucket createBucket(Storage storage, String projectId, String locationId, String bucketId) {
  try {
    Bucket bucket = new Bucket()
        .setLocation(locationId)
        .setName(bucketId)
        .setVersioning(new Bucket.Versioning().setEnabled(true));

    if (!StringUtils.isEmpty(locationId)) {
      bucket.setLocation(locationId);
    }

    return storage.buckets().insert(projectId, bucket).execute();
  } catch (IOException e) {
    throw new RuntimeException("Unable to create bucket", e);
  }
}
 
开发者ID:spinnaker,项目名称:halyard,代码行数:17,代码来源:GoogleStorage.java

示例2: create

import com.google.api.services.storage.model.Bucket; //导入方法依赖的package包/类
/**
 * See {@link GoogleCloudStorage#create(String, CreateBucketOptions)} for
 * details about expected behavior.
 */
@Override
public void create(String bucketName, CreateBucketOptions options)
    throws IOException {
  LOG.debug("create({})", bucketName);
  Preconditions.checkArgument(!Strings.isNullOrEmpty(bucketName),
      "bucketName must not be null or empty");
  Preconditions.checkNotNull(options, "options must not be null");
  Preconditions.checkNotNull(storageOptions.getProjectId(), "projectId must not be null");

  Bucket bucket = new Bucket();
  bucket.setName(bucketName);
  bucket.setLocation(options.getLocation());
  bucket.setStorageClass(options.getStorageClass());
  Storage.Buckets.Insert insertBucket =
      gcs.buckets().insert(storageOptions.getProjectId(), bucket);
  // TODO(user): To match the behavior of throwing FileNotFoundException for 404, we probably
  // want to throw org.apache.commons.io.FileExistsException for 409 here.
  try {
    ResilientOperation.retry(
        ResilientOperation.getGoogleRequestCallable(insertBucket),
        backOffFactory.newBackOff(),
        rateLimitedRetryDeterminer,
        IOException.class,
        sleeper);
  } catch (InterruptedException e) {
    throw new IOException(e);  // From sleep
  }
}
 
开发者ID:GoogleCloudPlatform,项目名称:bigdata-interop,代码行数:33,代码来源:GoogleCloudStorageImpl.java

示例3: createTestBucket

import com.google.api.services.storage.model.Bucket; //导入方法依赖的package包/类
/**
 * Creates a test bucket based on the given number.
 */
private Bucket createTestBucket(int bucketNumber) {
  Bucket b = new Bucket();
  String bucketNumberStr = Integer.toString(bucketNumber);
  b.setName("bucket" + bucketNumberStr);
  b.setTimeCreated(new DateTime(new Date()));
  b.setLocation("location");
  b.setStorageClass("DRA");
  return b;
}
 
开发者ID:GoogleCloudPlatform,项目名称:bigdata-interop,代码行数:13,代码来源:GoogleCloudStorageTest.java


注:本文中的com.google.api.services.storage.model.Bucket.setLocation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。