com.amazonaws.services.s3.model.Owner Java Examples

The following examples show how to use com.amazonaws.services.s3.model.Owner. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: S3ObjectsTableProvider.java    From aws-athena-query-federation with Apache License 2.0 6 votes vote down vote up
/**
 * Maps a DBInstance into a row in our Apache Arrow response block(s).
 *
 * @param objectSummary The S3 ObjectSummary to map.
 * @param spiller The BlockSpiller to use when we want to write a matching row to the response.
 * @note The current implementation is rather naive in how it maps fields. It leverages a static
 * list of fields that we'd like to provide and then explicitly filters and converts each field.
 */
private void toRow(S3ObjectSummary objectSummary,
        BlockSpiller spiller)
{
    spiller.writeRows((Block block, int row) -> {
        boolean matched = true;
        matched &= block.offerValue("bucket_name", row, objectSummary.getBucketName());
        matched &= block.offerValue("e_tag", row, objectSummary.getETag());
        matched &= block.offerValue("key", row, objectSummary.getKey());
        matched &= block.offerValue("bytes", row, objectSummary.getSize());
        matched &= block.offerValue("storage_class", row, objectSummary.getStorageClass());
        matched &= block.offerValue("last_modified", row, objectSummary.getLastModified());

        Owner owner = objectSummary.getOwner();
        if (owner != null) {
            matched &= block.offerValue("owner_name", row, owner.getDisplayName());
            matched &= block.offerValue("owner_id", row, owner.getId());
        }

        return matched ? 1 : 0;
    });
}
 
Example #2
Source File: S3BucketsTableProvider.java    From aws-athena-query-federation with Apache License 2.0 6 votes vote down vote up
/**
 * Maps a DBInstance into a row in our Apache Arrow response block(s).
 *
 * @param bucket The S3 Bucket to map.
 * @param spiller The BlockSpiller to use when we want to write a matching row to the response.
 * @note The current implementation is rather naive in how it maps fields. It leverages a static
 * list of fields that we'd like to provide and then explicitly filters and converts each field.
 */
private void toRow(Bucket bucket,
        BlockSpiller spiller)
{
    spiller.writeRows((Block block, int row) -> {
        boolean matched = true;
        matched &= block.offerValue("bucket_name", row, bucket.getName());
        matched &= block.offerValue("create_date", row, bucket.getCreationDate());

        Owner owner = bucket.getOwner();
        if (owner != null) {
            matched &= block.offerValue("owner_name", row, bucket.getOwner().getDisplayName());
            matched &= block.offerValue("owner_id", row, bucket.getOwner().getId());
        }

        return matched ? 1 : 0;
    });
}
 
Example #3
Source File: TestS3FileSystem.java    From dremio-oss with Apache License 2.0 6 votes vote down vote up
@Test
public void testUnknownContainerExists() {
  TestExtendedS3FileSystem fs = new TestExtendedS3FileSystem();
  AmazonS3 mockedS3Client = mock(AmazonS3.class);
  Owner owner = new Owner();
  owner.setId("2350f639447f872b12d9e2298200704aa3b70cea0e127d544748da0351f79118");
  when(mockedS3Client.doesBucketExistV2(any(String.class))).thenReturn(true);
  when(mockedS3Client.getS3AccountOwner()).thenReturn(owner);
  AccessControlList acl = getAcl(mockedS3Client);
  when(mockedS3Client.getBucketAcl(any(String.class))).thenReturn(acl);

  fs.setCustomClient(mockedS3Client);
  try {
    assertNotNull(fs.getUnknownContainer("testunknown"));
  } catch (IOException e) {
    fail(e.getMessage());
  }
}
 
Example #4
Source File: S3ObjectInfo.java    From ats-framework with Apache License 2.0 4 votes vote down vote up
/**
 * Get the owner's display name
 */
public String getOwnerName() {
    Owner owner = s3Summary.getOwner();
    return owner != null ? owner.getDisplayName() : null;
}
 
Example #5
Source File: S3ObjectInfo.java    From ats-framework with Apache License 2.0 4 votes vote down vote up
/**
 * Get the owner's Id.
 */
public String getOwnerId() {
    Owner owner = s3Summary.getOwner();
    return owner != null ? owner.getId() : null;
}
 
Example #6
Source File: DummyS3Client.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** Unsupported Operation. */
@Override public Owner getS3AccountOwner() throws SdkClientException {
    throw new UnsupportedOperationException("Operation not supported");
}
 
Example #7
Source File: DummyS3Client.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** Unsupported Operation. */
@Override public Owner getS3AccountOwner(GetS3AccountOwnerRequest getS3AccountOwnerReq) throws SdkClientException {
    throw new UnsupportedOperationException("Operation not supported");
}
 
Example #8
Source File: AmazonS3Mock.java    From Scribengin with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public Owner getS3AccountOwner() throws AmazonClientException, AmazonServiceException {
  // TODO Auto-generated method stub
  return null;
}