本文整理了Java中com.google.api.services.storage.model.Bucket.setLocation()
方法的一些代码示例,展示了Bucket.setLocation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bucket.setLocation()
方法的具体详情如下:
包路径:com.google.api.services.storage.model.Bucket
类名称:Bucket
方法名:setLocation
暂无
代码示例来源:origin: googleapis/google-cloud-java
bucketPb.setLocation(location);
代码示例来源:origin: spinnaker/kayenta
log.warn("Using location {} for bucket {}.", bucket, projectName);
bucket.setLocation(bucketLocation);
代码示例来源:origin: google/google-api-java-client-samples
public static void main(String[] args) throws Exception {
HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();
JsonFactory jsonFactory = JacksonFactory.getDefaultInstance();
Credential credential = CredentialsProvider.authorize(httpTransport, jsonFactory);
Storage storage = new Storage.Builder(httpTransport, jsonFactory, credential)
.setApplicationName("Google-BucketsInsertExample/1.0").build();
createInProject(storage, PROJECT_NAME, new Bucket().setName(BUCKET_NAME)
.setLocation(BUCKET_LOCATION));
}
代码示例来源:origin: google/google-api-java-client-samples
new Bucket().setName(settings.getBucket()).setLocation("US"));
代码示例来源:origin: spinnaker/halyard
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);
}
}
代码示例来源:origin: com.netflix.spinnaker.halyard/halyard-backup
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);
}
}
代码示例来源:origin: com.google.cloud.bigdataoss/gcsio
/**
* See {@link GoogleCloudStorage#create(String, CreateBucketOptions)} for details about expected
* behavior.
*/
@Override
public void create(String bucketName, CreateBucketOptions options) throws IOException {
logger.atFine().log("create(%s)", bucketName);
Preconditions.checkArgument(
!Strings.isNullOrEmpty(bucketName), "bucketName must not be null or empty");
checkNotNull(options, "options must not be null");
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 =
configureRequest(gcs.buckets().insert(storageOptions.getProjectId(), bucket), bucketName);
// 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
}
}
代码示例来源:origin: org.apache.beam/beam-sdks-java-extensions-google-cloud-platform-core
Bucket bucket = new Bucket().setName(bucketName).setLocation(region);
代码示例来源:origin: com.google.cloud/google-cloud-storage
bucketPb.setLocation(location);
代码示例来源:origin: com.google.gcloud/gcloud-java-storage
bucketPb.setLocation(location);
内容来源于网络,如有侵权,请联系作者删除!