Search in sources :

Example 1 with CreateHmacKeyRequest

use of com.google.storage.v2.CreateHmacKeyRequest in project gapic-generator-java by googleapis.

the class SyncCreateHmacKey method syncCreateHmacKey.

public static void syncCreateHmacKey() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        CreateHmacKeyRequest request = CreateHmacKeyRequest.newBuilder().setProject(ProjectName.of("[PROJECT]").toString()).setServiceAccountEmail("serviceAccountEmail1825953988").setCommonRequestParams(CommonRequestParams.newBuilder().build()).build();
        CreateHmacKeyResponse response = storageClient.createHmacKey(request);
    }
}
Also used : CreateHmacKeyResponse(com.google.storage.v2.CreateHmacKeyResponse) CreateHmacKeyRequest(com.google.storage.v2.CreateHmacKeyRequest) StorageClient(com.google.storage.v2.StorageClient)

Example 2 with CreateHmacKeyRequest

use of com.google.storage.v2.CreateHmacKeyRequest in project gapic-generator-java by googleapis.

the class AsyncCreateHmacKey method asyncCreateHmacKey.

public static void asyncCreateHmacKey() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        CreateHmacKeyRequest request = CreateHmacKeyRequest.newBuilder().setProject(ProjectName.of("[PROJECT]").toString()).setServiceAccountEmail("serviceAccountEmail1825953988").setCommonRequestParams(CommonRequestParams.newBuilder().build()).build();
        ApiFuture<CreateHmacKeyResponse> future = storageClient.createHmacKeyCallable().futureCall(request);
        // Do something.
        CreateHmacKeyResponse response = future.get();
    }
}
Also used : CreateHmacKeyResponse(com.google.storage.v2.CreateHmacKeyResponse) CreateHmacKeyRequest(com.google.storage.v2.CreateHmacKeyRequest) StorageClient(com.google.storage.v2.StorageClient)

Aggregations

CreateHmacKeyRequest (com.google.storage.v2.CreateHmacKeyRequest)2 CreateHmacKeyResponse (com.google.storage.v2.CreateHmacKeyResponse)2 StorageClient (com.google.storage.v2.StorageClient)2