Search in sources :

Example 26 with StorageClient

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

the class SyncCreateNotificationProjectnameNotification method syncCreateNotificationProjectnameNotification.

public static void syncCreateNotificationProjectnameNotification() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        ProjectName parent = ProjectName.of("[PROJECT]");
        Notification notification = Notification.newBuilder().build();
        Notification response = storageClient.createNotification(parent, notification);
    }
}
Also used : ProjectName(com.google.storage.v2.ProjectName) StorageClient(com.google.storage.v2.StorageClient) Notification(com.google.storage.v2.Notification)

Example 27 with StorageClient

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

the class SyncDeleteBucketBucketname method syncDeleteBucketBucketname.

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

Example 28 with StorageClient

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

the class SyncGetHmacKeyStringProjectname method syncGetHmacKeyStringProjectname.

public static void syncGetHmacKeyStringProjectname() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        String accessId = "accessId-2146437729";
        ProjectName project = ProjectName.of("[PROJECT]");
        HmacKeyMetadata response = storageClient.getHmacKey(accessId, project);
    }
}
Also used : HmacKeyMetadata(com.google.storage.v2.HmacKeyMetadata) ProjectName(com.google.storage.v2.ProjectName) StorageClient(com.google.storage.v2.StorageClient)

Example 29 with StorageClient

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

the class SyncGetHmacKeyStringString method syncGetHmacKeyStringString.

public static void syncGetHmacKeyStringString() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        String accessId = "accessId-2146437729";
        String project = ProjectName.of("[PROJECT]").toString();
        HmacKeyMetadata response = storageClient.getHmacKey(accessId, project);
    }
}
Also used : HmacKeyMetadata(com.google.storage.v2.HmacKeyMetadata) StorageClient(com.google.storage.v2.StorageClient)

Example 30 with StorageClient

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

the class AsyncGetIamPolicy method asyncGetIamPolicy.

public static void asyncGetIamPolicy() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder().setResource(CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString()).setOptions(GetPolicyOptions.newBuilder().build()).build();
        ApiFuture<Policy> future = storageClient.getIamPolicyCallable().futureCall(request);
        // Do something.
        Policy response = future.get();
    }
}
Also used : Policy(com.google.iam.v1.Policy) StorageClient(com.google.storage.v2.StorageClient) GetIamPolicyRequest(com.google.iam.v1.GetIamPolicyRequest)

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