Search in sources :

Example 6 with HmacKey

use of com.google.cloud.storage.HmacKey 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

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