Search in sources :

Example 36 with StorageClient

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

the class SyncGetHmacKey method syncGetHmacKey.

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

Example 37 with StorageClient

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

the class SyncDeleteBucketString method syncDeleteBucketString.

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

Example 38 with StorageClient

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

the class SyncDeleteHmacKeyStringString method syncDeleteHmacKeyStringString.

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

Example 39 with StorageClient

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

the class AsyncDeleteObject method asyncDeleteObject.

public static void asyncDeleteObject() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        DeleteObjectRequest request = DeleteObjectRequest.newBuilder().setBucket("bucket-1378203158").setObject("object-1023368385").setUploadId("uploadId1563990780").setGeneration(305703192).setIfGenerationMatch(-1086241088).setIfGenerationNotMatch(1475720404).setIfMetagenerationMatch(1043427781).setIfMetagenerationNotMatch(1025430873).setCommonObjectRequestParams(CommonObjectRequestParams.newBuilder().build()).setCommonRequestParams(CommonRequestParams.newBuilder().build()).build();
        ApiFuture<Empty> future = storageClient.deleteObjectCallable().futureCall(request);
        // Do something.
        future.get();
    }
}
Also used : DeleteObjectRequest(com.google.storage.v2.DeleteObjectRequest) Empty(com.google.protobuf.Empty) StorageClient(com.google.storage.v2.StorageClient)

Example 40 with StorageClient

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

the class SyncComposeObject method syncComposeObject.

public static void syncComposeObject() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        ComposeObjectRequest request = ComposeObjectRequest.newBuilder().setDestination(Object.newBuilder().build()).addAllSourceObjects(new ArrayList<ComposeObjectRequest.SourceObject>()).setDestinationPredefinedAcl(PredefinedObjectAcl.forNumber(0)).setIfGenerationMatch(-1086241088).setIfMetagenerationMatch(1043427781).setKmsKey(CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString()).setCommonObjectRequestParams(CommonObjectRequestParams.newBuilder().build()).setCommonRequestParams(CommonRequestParams.newBuilder().build()).build();
        Object response = storageClient.composeObject(request);
    }
}
Also used : ComposeObjectRequest(com.google.storage.v2.ComposeObjectRequest) ArrayList(java.util.ArrayList) StorageClient(com.google.storage.v2.StorageClient) Object(com.google.storage.v2.Object)

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