com.amazonaws.services.s3.model.Bucket.getCreationDate()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(149)

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

Bucket.getCreationDate介绍

[英]Gets the bucket's creation date. Returns null if the creation date is not known.
[中]获取存储桶的创建日期。如果创建日期未知,则返回null

代码示例

代码示例来源:origin: aws/aws-sdk-java

/**
 * @see java.lang.Object#toString()
 */
public String toString() {
  return "S3Bucket [name=" + getName()
      + ", creationDate=" + getCreationDate()
      + ", owner=" + getOwner() + "]";
}

代码示例来源:origin: aws-amplify/aws-sdk-android

/**
 * @see java.lang.Object#toString()
 */
@Override
public String toString() {
  return "S3Bucket [name=" + getName()
      + ", creationDate=" + getCreationDate()
      + ", owner=" + getOwner() + "]";
}

代码示例来源:origin: com.amazonaws/aws-android-sdk-s3

/**
 * @see java.lang.Object#toString()
 */
@Override
public String toString() {
  return "S3Bucket [name=" + getName()
      + ", creationDate=" + getCreationDate()
      + ", owner=" + getOwner() + "]";
}

代码示例来源:origin: Nextdoor/bender

/**
 * @see java.lang.Object#toString()
 */
public String toString() {
  return "S3Bucket [name=" + getName()
      + ", creationDate=" + getCreationDate()
      + ", owner=" + getOwner() + "]";
}

代码示例来源:origin: intuit/Tank

private void createBucket(String bucketName) {
  AccessControlList configuration = null;
  try {
    configuration = s3Client.getBucketAcl(bucketName);
  } catch (Exception e) {
    LOG.info("Bucket " + bucketName + " does not exist.");
  }
  if (configuration == null) {
    Bucket bucket = s3Client.createBucket(bucketName);
    LOG.info("Created bucket " + bucket.getName() + " at " + bucket.getCreationDate());
  }
}

代码示例来源:origin: org.visallo/visallo-ingest-cloud-s3

private ClientApiBuckets getBuckets(AmazonS3 s3) {
    ClientApiBuckets bucketsResponse = new ClientApiBuckets();
    try {
      bucketsResponse.items = s3.listBuckets()
          .stream()
          .map(bucket -> {
            ClientApiBuckets.ClientApiBucket b = new ClientApiBuckets.ClientApiBucket();
            b.date = bucket.getCreationDate();
            b.name = bucket.getName();
            b.type = "bucket";
            return b;
          })
          .sorted((o1, o2) -> o1.name.compareToIgnoreCase(o2.name))
          .collect(Collectors.toList());
    } catch (AmazonServiceException e) {
      bucketsResponse.errorMessage = "An error occurred while retrieving buckets from Amazon S3: " + e.getErrorMessage();
    }
    return bucketsResponse;
  }
}

代码示例来源:origin: com.upplication/s3fs

@SuppressWarnings("unchecked")
@Override
public <V extends FileStoreAttributeView> V getFileStoreAttributeView(Class<V> type) {
  if (type != S3FileStoreAttributeView.class)
    throw new IllegalArgumentException("FileStoreAttributeView of type '" + type.getName() + "' is not supported.");
  Bucket buck = getBucket();
  Owner owner = buck.getOwner();
  return (V) new S3FileStoreAttributeView(buck.getCreationDate(), buck.getName(), owner.getId(), owner.getDisplayName());
}

代码示例来源:origin: org.duracloud/s3storageprovider

/**
 * {@inheritDoc}
 */
public void createSpace(String spaceId) {
  log.debug("createSpace(" + spaceId + ")");
  throwIfSpaceExists(spaceId);
  Bucket bucket = createBucket(spaceId);
  Date created = bucket.getCreationDate();
  if (created == null) {
    created = new Date();
  }
  // Empty ACL set for new space (no permissions set)
  Map<String, AclType> spaceACLs = new HashMap<>();
  // Add space properties
  Map<String, String> spaceProperties = new HashMap<>();
  spaceProperties.put(PROPERTIES_SPACE_CREATED, formattedDate(created));
  try {
    setNewSpaceProperties(spaceId, spaceProperties, spaceACLs);
  } catch (StorageException e) {
    removeSpace(spaceId);
    String err = "Unable to create space due to: " + e.getMessage();
    throw new StorageException(err, e, RETRY);
  }
}

代码示例来源:origin: org.duracloud/s3storageprovider

private String getBucketCreationDate(String bucketName) {
  Date created = null;
  try {
    List<Bucket> buckets = s3Client.listBuckets();
    for (Bucket bucket : buckets) {
      if (bucket.getName().equals(bucketName)) {
        created = bucket.getCreationDate();
      }
    }
  } catch (AmazonClientException e) {
    String err = "Could not retrieve S3 bucket listing due to error: " +
           e.getMessage();
    throw new StorageException(err, e, RETRY);
  }
  String formattedDate = null;
  if (created != null) {
    formattedDate = formattedDate(created);
  } else {
    formattedDate = "unknown";
  }
  return formattedDate;
}

代码示例来源:origin: org.kuali.common/kuali-aws

public static Bucket copyOf(com.amazonaws.services.s3.model.Bucket bucket) {
  String name = bucket.getName();
  Owner owner = Owner.copyOf(bucket.getOwner());
  long timestamp = bucket.getCreationDate().getTime();
  return builder().withName(name).withOwner(owner).withCreated(timestamp).build();
}

代码示例来源:origin: stratosphere/stratosphere

if (bop.getBucket().equals(bucket.getName())) {
  final long creationDate = dateToLong(bucket.getCreationDate());

代码示例来源:origin: eu.stratosphere/stratosphere-runtime

if (bop.getBucket().equals(bucket.getName())) {
  final long creationDate = dateToLong(bucket.getCreationDate());

代码示例来源:origin: eu.stratosphere/stratosphere-runtime

while (it.hasNext()) {
  final Bucket bucket = it.next();
  final long creationDate = dateToLong(bucket.getCreationDate());

代码示例来源:origin: stratosphere/stratosphere

while (it.hasNext()) {
  final Bucket bucket = it.next();
  final long creationDate = dateToLong(bucket.getCreationDate());

相关文章