Search in sources :

Example 56 with StorageClient

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

the class AsyncSetIamPolicy method asyncSetIamPolicy.

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

Example 57 with StorageClient

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

the class SyncSetIamPolicyResourcenamePolicy method syncSetIamPolicyResourcenamePolicy.

public static void syncSetIamPolicyResourcenamePolicy() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        ResourceName resource = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
        Policy policy = Policy.newBuilder().build();
        Policy response = storageClient.setIamPolicy(resource, policy);
    }
}
Also used : Policy(com.google.iam.v1.Policy) ResourceName(com.google.api.resourcenames.ResourceName) StorageClient(com.google.storage.v2.StorageClient)

Example 58 with StorageClient

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

the class SyncStartResumableWrite method syncStartResumableWrite.

public static void syncStartResumableWrite() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        StartResumableWriteRequest request = StartResumableWriteRequest.newBuilder().setWriteObjectSpec(WriteObjectSpec.newBuilder().build()).setCommonObjectRequestParams(CommonObjectRequestParams.newBuilder().build()).setCommonRequestParams(CommonRequestParams.newBuilder().build()).build();
        StartResumableWriteResponse response = storageClient.startResumableWrite(request);
    }
}
Also used : StartResumableWriteResponse(com.google.storage.v2.StartResumableWriteResponse) StorageClient(com.google.storage.v2.StorageClient) StartResumableWriteRequest(com.google.storage.v2.StartResumableWriteRequest)

Example 59 with StorageClient

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

the class SyncTestIamPermissionsResourcenameListstring method syncTestIamPermissionsResourcenameListstring.

public static void syncTestIamPermissionsResourcenameListstring() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        ResourceName resource = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
        List<String> permissions = new ArrayList<>();
        TestIamPermissionsResponse response = storageClient.testIamPermissions(resource, permissions);
    }
}
Also used : TestIamPermissionsResponse(com.google.iam.v1.TestIamPermissionsResponse) ResourceName(com.google.api.resourcenames.ResourceName) ArrayList(java.util.ArrayList) StorageClient(com.google.storage.v2.StorageClient)

Example 60 with StorageClient

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

the class SyncTestIamPermissionsStringListstring method syncTestIamPermissionsStringListstring.

public static void syncTestIamPermissionsStringListstring() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        String resource = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString();
        List<String> permissions = new ArrayList<>();
        TestIamPermissionsResponse response = storageClient.testIamPermissions(resource, permissions);
    }
}
Also used : TestIamPermissionsResponse(com.google.iam.v1.TestIamPermissionsResponse) ArrayList(java.util.ArrayList) 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