Search in sources :

Example 11 with HmacKeyMetadata

use of com.google.cloud.storage.HmacKey.HmacKeyMetadata in project google-cloud-java by GoogleCloudPlatform.

the class ITStorageHmacKeySnippets method testActivateHmacKey.

@Test
public void testActivateHmacKey() {
    HmacKey hmacKey = storage.createHmacKey(ServiceAccount.of(HMAC_KEY_TEST_SERVICE_ACCOUNT));
    HmacKeyMetadata metadata = storage.updateHmacKeyState(hmacKey.getMetadata(), HmacKeyState.INACTIVE);
    HmacKeyMetadata newMetadata = storageSnippets.activateHmacKey(metadata.getAccessId(), PROJECT_ID);
    assertEquals(HmacKeyState.ACTIVE, newMetadata.getState());
}
Also used : HmacKeyMetadata(com.google.cloud.storage.HmacKey.HmacKeyMetadata) HmacKey(com.google.cloud.storage.HmacKey) Test(org.junit.Test)

Aggregations

HmacKeyMetadata (com.google.cloud.storage.HmacKey.HmacKeyMetadata)11 Storage (com.google.cloud.storage.Storage)6 HmacKey (com.google.cloud.storage.HmacKey)5 Test (org.junit.Test)5 Date (java.util.Date)4 ServiceAccount (com.google.cloud.storage.ServiceAccount)1