本文整理了Java中com.google.cloud.storage.Blob.getKmsKeyName()
方法的一些代码示例,展示了Blob.getKmsKeyName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Blob.getKmsKeyName()
方法的具体详情如下:
包路径:com.google.cloud.storage.Blob
类名称:Blob
方法名:getKmsKeyName
暂无
代码示例来源:origin: googleapis/google-cloud-java
System.out.println("Generation: " + blob.getGeneration());
System.out.println("Id: " + blob.getBlobId());
System.out.println("KmsKeyName: " + blob.getKmsKeyName());
System.out.println("Md5Hash: " + blob.getMd5());
System.out.println("MediaLink: " + blob.getMediaLink());
代码示例来源:origin: googleapis/google-cloud-java
@Test
public void testCreateBlobWithKmsKeyName() {
String blobName = "test-create-with-kms-key-name-blob";
BlobInfo blob = BlobInfo.newBuilder(BUCKET, blobName).build();
Blob remoteBlob =
storage.create(
blob, BLOB_BYTE_CONTENT, Storage.BlobTargetOption.kmsKeyName(kmsKeyOneResourcePath));
assertNotNull(remoteBlob);
assertEquals(blob.getBucket(), remoteBlob.getBucket());
assertEquals(blob.getName(), remoteBlob.getName());
assertNotNull(remoteBlob.getKmsKeyName());
assertTrue(remoteBlob.getKmsKeyName().startsWith(kmsKeyOneResourcePath));
byte[] readBytes = storage.readAllBytes(BUCKET, blobName);
assertArrayEquals(BLOB_BYTE_CONTENT, readBytes);
}
代码示例来源:origin: googleapis/google-cloud-java
assertEquals(BUCKET, remoteBlob.getBucket());
assertTrue(blobSet.contains(remoteBlob.getName()));
assertTrue(remoteBlob.getKmsKeyName().startsWith(kmsKeyOneResourcePath));
assertNull(remoteBlob.getContentType());
代码示例来源:origin: googleapis/google-cloud-java
@Test
public void testGetBlobKmsKeyNameField() {
String blobName = "test-get-selected-kms-key-name-field-blob";
BlobInfo blob = BlobInfo.newBuilder(BUCKET, blobName).setContentType(CONTENT_TYPE).build();
assertNotNull(storage.create(blob, Storage.BlobTargetOption.kmsKeyName(kmsKeyOneResourcePath)));
Blob remoteBlob =
storage.get(blob.getBlobId(), Storage.BlobGetOption.fields(BlobField.KMS_KEY_NAME));
assertEquals(blob.getBlobId(), remoteBlob.getBlobId());
assertTrue(remoteBlob.getKmsKeyName().startsWith(kmsKeyOneResourcePath));
assertNull(remoteBlob.getContentType());
}
代码示例来源:origin: googleapis/google-cloud-java
@Test
public void testCreateBlobWithDefaultKmsKeyName()
throws ExecutionException, InterruptedException {
String bucketName = RemoteStorageHelper.generateBucketName();
Bucket bucket =
storage.create(
BucketInfo.newBuilder(bucketName)
.setDefaultKmsKeyName(kmsKeyOneResourcePath)
.setLocation(KMS_KEY_RING_LOCATION)
.build());
assertEquals(bucket.getDefaultKmsKeyName(), kmsKeyOneResourcePath);
try {
String blobName = "test-create-with-default-kms-key-name-blob";
BlobInfo blob = BlobInfo.newBuilder(bucket, blobName).build();
Blob remoteBlob = storage.create(blob, BLOB_BYTE_CONTENT);
assertNotNull(remoteBlob);
assertEquals(blob.getBucket(), remoteBlob.getBucket());
assertEquals(blob.getName(), remoteBlob.getName());
assertNotNull(remoteBlob.getKmsKeyName());
assertTrue(remoteBlob.getKmsKeyName().startsWith(kmsKeyOneResourcePath));
byte[] readBytes = storage.readAllBytes(bucketName, blobName);
assertArrayEquals(BLOB_BYTE_CONTENT, readBytes);
} finally {
RemoteStorageHelper.forceDelete(storage, bucketName, 5, TimeUnit.SECONDS);
}
}
代码示例来源:origin: googleapis/google-cloud-java
assertEquals(targetBlobName, copyWriter.getResult().getName());
assertEquals(CONTENT_TYPE, copyWriter.getResult().getContentType());
assertNotNull(copyWriter.getResult().getKmsKeyName());
assertTrue(copyWriter.getResult().getKmsKeyName().startsWith(kmsKeyOneResourcePath));
assertArrayEquals(BLOB_BYTE_CONTENT, copyWriter.getResult().getContent());
assertEquals(metadata, copyWriter.getResult().getMetadata());
代码示例来源:origin: googleapis/google-cloud-java
assertEquals(CREATE_TIME, blob.getCreateTime());
assertEquals(CUSTOMER_ENCRYPTION, blob.getCustomerEncryption());
assertEquals(KMS_KEY_NAME, blob.getKmsKeyName());
assertEquals(EVENT_BASED_HOLD, blob.getEventBasedHold());
assertEquals(TEMPORARY_HOLD, blob.getTemporaryHold());
assertNull(blob.getCreateTime());
assertNull(blob.getCustomerEncryption());
assertNull(blob.getKmsKeyName());
assertNull(blob.getEventBasedHold());
assertNull(blob.getTemporaryHold());
内容来源于网络,如有侵权,请联系作者删除!