Search in sources :

Example 81 with StorageClient

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

the class SyncGetNotificationBucketname method syncGetNotificationBucketname.

public static void syncGetNotificationBucketname() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        BucketName name = BucketName.of("[PROJECT]", "[BUCKET]");
        Notification response = storageClient.getNotification(name);
    }
}
Also used : BucketName(com.google.storage.v2.BucketName) StorageClient(com.google.storage.v2.StorageClient) Notification(com.google.storage.v2.Notification)

Example 82 with StorageClient

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

the class SyncGetNotificationString method syncGetNotificationString.

public static void syncGetNotificationString() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        String name = BucketName.of("[PROJECT]", "[BUCKET]").toString();
        Notification response = storageClient.getNotification(name);
    }
}
Also used : StorageClient(com.google.storage.v2.StorageClient) Notification(com.google.storage.v2.Notification)

Example 83 with StorageClient

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

the class AsyncListHmacKeys method asyncListHmacKeys.

public static void asyncListHmacKeys() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        ListHmacKeysRequest request = ListHmacKeysRequest.newBuilder().setProject(ProjectName.of("[PROJECT]").toString()).setPageSize(883849137).setPageToken("pageToken873572522").setServiceAccountEmail("serviceAccountEmail1825953988").setShowDeletedKeys(true).setCommonRequestParams(CommonRequestParams.newBuilder().build()).build();
        ApiFuture<HmacKeyMetadata> future = storageClient.listHmacKeysPagedCallable().futureCall(request);
        // Do something.
        for (HmacKeyMetadata element : future.get().iterateAll()) {
        // doThingsWith(element);
        }
    }
}
Also used : HmacKeyMetadata(com.google.storage.v2.HmacKeyMetadata) ListHmacKeysRequest(com.google.storage.v2.ListHmacKeysRequest) StorageClient(com.google.storage.v2.StorageClient)

Example 84 with StorageClient

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

the class AsyncListNotifications method asyncListNotifications.

public static void asyncListNotifications() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        ListNotificationsRequest request = ListNotificationsRequest.newBuilder().setParent(ProjectName.of("[PROJECT]").toString()).setPageSize(883849137).setPageToken("pageToken873572522").build();
        ApiFuture<Notification> future = storageClient.listNotificationsPagedCallable().futureCall(request);
        // Do something.
        for (Notification element : future.get().iterateAll()) {
        // doThingsWith(element);
        }
    }
}
Also used : StorageClient(com.google.storage.v2.StorageClient) ListNotificationsRequest(com.google.storage.v2.ListNotificationsRequest) Notification(com.google.storage.v2.Notification)

Example 85 with StorageClient

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

the class AsyncListNotificationsPaged method asyncListNotificationsPaged.

public static void asyncListNotificationsPaged() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        ListNotificationsRequest request = ListNotificationsRequest.newBuilder().setParent(ProjectName.of("[PROJECT]").toString()).setPageSize(883849137).setPageToken("pageToken873572522").build();
        while (true) {
            ListNotificationsResponse response = storageClient.listNotificationsCallable().call(request);
            for (Notification element : response.getResponsesList()) {
            // doThingsWith(element);
            }
            String nextPageToken = response.getNextPageToken();
            if (!Strings.isNullOrEmpty(nextPageToken)) {
                request = request.toBuilder().setPageToken(nextPageToken).build();
            } else {
                break;
            }
        }
    }
}
Also used : StorageClient(com.google.storage.v2.StorageClient) ListNotificationsRequest(com.google.storage.v2.ListNotificationsRequest) Notification(com.google.storage.v2.Notification) ListNotificationsResponse(com.google.storage.v2.ListNotificationsResponse)

Aggregations

StorageClient (com.google.storage.v2.StorageClient)93 Bucket (com.google.storage.v2.Bucket)17 Object (com.google.storage.v2.Object)11 Notification (com.google.storage.v2.Notification)10 HmacKeyMetadata (com.google.storage.v2.HmacKeyMetadata)9 Policy (com.google.iam.v1.Policy)8 ProjectName (com.google.storage.v2.ProjectName)6 ArrayList (java.util.ArrayList)6 TestIamPermissionsResponse (com.google.iam.v1.TestIamPermissionsResponse)4 Empty (com.google.protobuf.Empty)4 BucketName (com.google.storage.v2.BucketName)4 CreateHmacKeyResponse (com.google.storage.v2.CreateHmacKeyResponse)4 ServiceAccount (com.google.storage.v2.ServiceAccount)4 ResourceName (com.google.api.resourcenames.ResourceName)3 FieldMask (com.google.protobuf.FieldMask)3 QueryWriteStatusResponse (com.google.storage.v2.QueryWriteStatusResponse)3 GetIamPolicyRequest (com.google.iam.v1.GetIamPolicyRequest)2 SetIamPolicyRequest (com.google.iam.v1.SetIamPolicyRequest)2 TestIamPermissionsRequest (com.google.iam.v1.TestIamPermissionsRequest)2 ComposeObjectRequest (com.google.storage.v2.ComposeObjectRequest)2