Search in sources :

Example 46 with StorageClient

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

the class SyncCreateSetEndpoint method syncCreateSetEndpoint.

public static void syncCreateSetEndpoint() throws Exception {
    // This snippet has been automatically generated for illustrative purposes only.
    // It may require modifications to work in your environment.
    StorageSettings storageSettings = StorageSettings.newBuilder().setEndpoint(myEndpoint).build();
    StorageClient storageClient = StorageClient.create(storageSettings);
}
Also used : StorageSettings(com.google.storage.v2.StorageSettings) StorageClient(com.google.storage.v2.StorageClient)

Example 47 with StorageClient

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

the class AsyncCreateBucket method asyncCreateBucket.

public static void asyncCreateBucket() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        CreateBucketRequest request = CreateBucketRequest.newBuilder().setParent(ProjectName.of("[PROJECT]").toString()).setBucket(Bucket.newBuilder().build()).setBucketId("bucketId-1603305307").setPredefinedAcl(PredefinedBucketAcl.forNumber(0)).setPredefinedDefaultObjectAcl(PredefinedObjectAcl.forNumber(0)).build();
        ApiFuture<Bucket> future = storageClient.createBucketCallable().futureCall(request);
        // Do something.
        Bucket response = future.get();
    }
}
Also used : Bucket(com.google.storage.v2.Bucket) CreateBucketRequest(com.google.storage.v2.CreateBucketRequest) StorageClient(com.google.storage.v2.StorageClient)

Example 48 with StorageClient

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

the class SyncCreateBucket method syncCreateBucket.

public static void syncCreateBucket() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        CreateBucketRequest request = CreateBucketRequest.newBuilder().setParent(ProjectName.of("[PROJECT]").toString()).setBucket(Bucket.newBuilder().build()).setBucketId("bucketId-1603305307").setPredefinedAcl(PredefinedBucketAcl.forNumber(0)).setPredefinedDefaultObjectAcl(PredefinedObjectAcl.forNumber(0)).build();
        Bucket response = storageClient.createBucket(request);
    }
}
Also used : Bucket(com.google.storage.v2.Bucket) CreateBucketRequest(com.google.storage.v2.CreateBucketRequest) StorageClient(com.google.storage.v2.StorageClient)

Example 49 with StorageClient

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

the class SyncCreateBucketProjectnameBucketString method syncCreateBucketProjectnameBucketString.

public static void syncCreateBucketProjectnameBucketString() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        ProjectName parent = ProjectName.of("[PROJECT]");
        Bucket bucket = Bucket.newBuilder().build();
        String bucketId = "bucketId-1603305307";
        Bucket response = storageClient.createBucket(parent, bucket, bucketId);
    }
}
Also used : ProjectName(com.google.storage.v2.ProjectName) Bucket(com.google.storage.v2.Bucket) StorageClient(com.google.storage.v2.StorageClient)

Example 50 with StorageClient

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

the class SyncCreateBucketStringBucketString method syncCreateBucketStringBucketString.

public static void syncCreateBucketStringBucketString() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        String parent = ProjectName.of("[PROJECT]").toString();
        Bucket bucket = Bucket.newBuilder().build();
        String bucketId = "bucketId-1603305307";
        Bucket response = storageClient.createBucket(parent, bucket, bucketId);
    }
}
Also used : Bucket(com.google.storage.v2.Bucket) 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