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

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

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

Bucket.setName介绍

暂无

代码示例

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

new com.google.api.services.storage.model.Bucket();
bucketPb.setId(generatedId);
bucketPb.setName(name);
bucketPb.setEtag(etag);
if (createTime != null) {

代码示例来源:origin: apache/ignite

Bucket newBucket = new Bucket();
newBucket.setName(bucketName);

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

Bucket bucket = new Bucket().setName(bucketName).setVersioning(versioning);

代码示例来源: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: pliablematter/simple-cloud-storage

/**
 * Creates a bucket
 * 
 * @param bucketName
 *            Name of bucket to create
 * @throws Exception
 */
public static void createBucket(String bucketName) throws Exception {
  Storage storage = getStorage();
  Bucket bucket = new Bucket();
  bucket.setName(bucketName);
  storage.buckets().insert(
      getProperties().getProperty(PROJECT_ID_PROPERTY), bucket).execute();
}

代码示例来源: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: GoogleCloudPlatform/pubsub

/**
 * Creates the storage bucket used by the load test.
 */
private void createStorageBucket() throws IOException {
 try {
  storage.buckets().insert(projectName, new Bucket()
    .setName(projectName + "-cloud-pubsub-loadtest")).execute();
 } catch (GoogleJsonResponseException e) {
  if (e.getStatusCode() != ALREADY_EXISTS) {
   throw 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

new com.google.api.services.storage.model.Bucket();
bucketPb.setId(generatedId);
bucketPb.setName(name);
bucketPb.setEtag(etag);
if (createTime != null) {

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

new com.google.api.services.storage.model.Bucket();
bucketPb.setId(generatedId);
bucketPb.setName(name);
bucketPb.setEtag(etag);
if (createTime != null) {

相关文章