Search in sources :

Example 61 with StorageClient

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

the class AsyncUpdateBucket method asyncUpdateBucket.

public static void asyncUpdateBucket() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        UpdateBucketRequest request = UpdateBucketRequest.newBuilder().setBucket(Bucket.newBuilder().build()).setIfMetagenerationMatch(1043427781).setIfMetagenerationNotMatch(1025430873).setPredefinedAcl(PredefinedBucketAcl.forNumber(0)).setPredefinedDefaultObjectAcl(PredefinedObjectAcl.forNumber(0)).setUpdateMask(FieldMask.newBuilder().build()).setCommonRequestParams(CommonRequestParams.newBuilder().build()).build();
        ApiFuture<Bucket> future = storageClient.updateBucketCallable().futureCall(request);
        // Do something.
        Bucket response = future.get();
    }
}
Also used : UpdateBucketRequest(com.google.storage.v2.UpdateBucketRequest) Bucket(com.google.storage.v2.Bucket) StorageClient(com.google.storage.v2.StorageClient)

Example 62 with StorageClient

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

the class SyncUpdateBucket method syncUpdateBucket.

public static void syncUpdateBucket() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        UpdateBucketRequest request = UpdateBucketRequest.newBuilder().setBucket(Bucket.newBuilder().build()).setIfMetagenerationMatch(1043427781).setIfMetagenerationNotMatch(1025430873).setPredefinedAcl(PredefinedBucketAcl.forNumber(0)).setPredefinedDefaultObjectAcl(PredefinedObjectAcl.forNumber(0)).setUpdateMask(FieldMask.newBuilder().build()).setCommonRequestParams(CommonRequestParams.newBuilder().build()).build();
        Bucket response = storageClient.updateBucket(request);
    }
}
Also used : UpdateBucketRequest(com.google.storage.v2.UpdateBucketRequest) Bucket(com.google.storage.v2.Bucket) StorageClient(com.google.storage.v2.StorageClient)

Example 63 with StorageClient

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

the class AsyncDeleteHmacKey method asyncDeleteHmacKey.

public static void asyncDeleteHmacKey() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        DeleteHmacKeyRequest request = DeleteHmacKeyRequest.newBuilder().setAccessId("accessId-2146437729").setProject(ProjectName.of("[PROJECT]").toString()).setCommonRequestParams(CommonRequestParams.newBuilder().build()).build();
        ApiFuture<Empty> future = storageClient.deleteHmacKeyCallable().futureCall(request);
        // Do something.
        future.get();
    }
}
Also used : DeleteHmacKeyRequest(com.google.storage.v2.DeleteHmacKeyRequest) Empty(com.google.protobuf.Empty) StorageClient(com.google.storage.v2.StorageClient)

Example 64 with StorageClient

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

the class SyncDeleteHmacKey method syncDeleteHmacKey.

public static void syncDeleteHmacKey() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        DeleteHmacKeyRequest request = DeleteHmacKeyRequest.newBuilder().setAccessId("accessId-2146437729").setProject(ProjectName.of("[PROJECT]").toString()).setCommonRequestParams(CommonRequestParams.newBuilder().build()).build();
        storageClient.deleteHmacKey(request);
    }
}
Also used : DeleteHmacKeyRequest(com.google.storage.v2.DeleteHmacKeyRequest) StorageClient(com.google.storage.v2.StorageClient)

Example 65 with StorageClient

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

the class SyncDeleteHmacKeyStringProjectname method syncDeleteHmacKeyStringProjectname.

public static void syncDeleteHmacKeyStringProjectname() 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]");
        storageClient.deleteHmacKey(accessId, project);
    }
}
Also used : ProjectName(com.google.storage.v2.ProjectName) StorageClient(com.google.storage.v2.StorageClient)

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