Search in sources :

Example 16 with Instance

use of com.google.cloud.compute.v1.Instance in project gapic-generator-java by googleapis.

the class AsyncImportInstanceLRO method asyncImportInstanceLRO.

public static void asyncImportInstanceLRO() throws Exception {
    // It may require modifications to work in your environment.
    try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
        ImportInstanceRequest request = ImportInstanceRequest.newBuilder().setName("name3373707").setInputConfig(InputConfig.newBuilder().build()).build();
        OperationFuture<Instance, Any> future = cloudRedisClient.importInstanceOperationCallable().futureCall(request);
        // Do something.
        Instance response = future.get();
    }
}
Also used : CloudRedisClient(com.google.cloud.redis.v1beta1.CloudRedisClient) Instance(com.google.cloud.redis.v1beta1.Instance) ImportInstanceRequest(com.google.cloud.redis.v1beta1.ImportInstanceRequest) Any(com.google.protobuf.Any)

Example 17 with Instance

use of com.google.cloud.compute.v1.Instance in project gapic-generator-java by googleapis.

the class SyncImportInstance method syncImportInstance.

public static void syncImportInstance() throws Exception {
    // It may require modifications to work in your environment.
    try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
        ImportInstanceRequest request = ImportInstanceRequest.newBuilder().setName("name3373707").setInputConfig(InputConfig.newBuilder().build()).build();
        Instance response = cloudRedisClient.importInstanceAsync(request).get();
    }
}
Also used : CloudRedisClient(com.google.cloud.redis.v1beta1.CloudRedisClient) Instance(com.google.cloud.redis.v1beta1.Instance) ImportInstanceRequest(com.google.cloud.redis.v1beta1.ImportInstanceRequest)

Example 18 with Instance

use of com.google.cloud.compute.v1.Instance in project gapic-generator-java by googleapis.

the class AsyncListInstancesPaged method asyncListInstancesPaged.

public static void asyncListInstancesPaged() throws Exception {
    // It may require modifications to work in your environment.
    try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
        ListInstancesRequest request = ListInstancesRequest.newBuilder().setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()).setPageSize(883849137).setPageToken("pageToken873572522").build();
        while (true) {
            ListInstancesResponse response = cloudRedisClient.listInstancesCallable().call(request);
            for (Instance element : response.getResponsesList()) {
            // doThingsWith(element);
            }
            String nextPageToken = response.getNextPageToken();
            if (!Strings.isNullOrEmpty(nextPageToken)) {
                request = request.toBuilder().setPageToken(nextPageToken).build();
            } else {
                break;
            }
        }
    }
}
Also used : ListInstancesResponse(com.google.cloud.redis.v1beta1.ListInstancesResponse) CloudRedisClient(com.google.cloud.redis.v1beta1.CloudRedisClient) Instance(com.google.cloud.redis.v1beta1.Instance) ListInstancesRequest(com.google.cloud.redis.v1beta1.ListInstancesRequest)

Example 19 with Instance

use of com.google.cloud.compute.v1.Instance in project gapic-generator-java by googleapis.

the class AsyncUpgradeInstanceLRO method asyncUpgradeInstanceLRO.

public static void asyncUpgradeInstanceLRO() throws Exception {
    // It may require modifications to work in your environment.
    try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
        UpgradeInstanceRequest request = UpgradeInstanceRequest.newBuilder().setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()).setRedisVersion("redisVersion-1972584739").build();
        OperationFuture<Instance, Any> future = cloudRedisClient.upgradeInstanceOperationCallable().futureCall(request);
        // Do something.
        Instance response = future.get();
    }
}
Also used : CloudRedisClient(com.google.cloud.redis.v1beta1.CloudRedisClient) Instance(com.google.cloud.redis.v1beta1.Instance) Any(com.google.protobuf.Any) UpgradeInstanceRequest(com.google.cloud.redis.v1beta1.UpgradeInstanceRequest)

Example 20 with Instance

use of com.google.cloud.compute.v1.Instance in project gapic-generator-java by googleapis.

the class SyncUpgradeInstance method syncUpgradeInstance.

public static void syncUpgradeInstance() throws Exception {
    // It may require modifications to work in your environment.
    try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
        UpgradeInstanceRequest request = UpgradeInstanceRequest.newBuilder().setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()).setRedisVersion("redisVersion-1972584739").build();
        Instance response = cloudRedisClient.upgradeInstanceAsync(request).get();
    }
}
Also used : CloudRedisClient(com.google.cloud.redis.v1beta1.CloudRedisClient) Instance(com.google.cloud.redis.v1beta1.Instance) UpgradeInstanceRequest(com.google.cloud.redis.v1beta1.UpgradeInstanceRequest)

Aggregations

Test (org.junit.Test)41 Instance (com.google.cloud.redis.v1beta1.Instance)34 CloudRedisClient (com.google.cloud.redis.v1beta1.CloudRedisClient)30 InstancesClient (com.google.cloud.compute.v1.InstancesClient)29 Operation (com.google.cloud.compute.v1.Operation)29 Instance (com.google.cloud.compute.v1.Instance)25 ByteString (com.google.protobuf.ByteString)17 AttachedDisk (com.google.cloud.compute.v1.AttachedDisk)16 AbstractMessage (com.google.protobuf.AbstractMessage)13 InsertInstanceRequest (com.google.cloud.compute.v1.InsertInstanceRequest)11 Instance (com.google.spanner.admin.instance.v1.Instance)11 Instance (com.google.bigtable.admin.v2.Instance)10 InstanceTemplatesClient (com.google.cloud.compute.v1.InstanceTemplatesClient)9 Instance (com.google.cloud.notebooks.v1beta1.Instance)9 ArrayList (java.util.ArrayList)8 InvalidArgumentException (com.google.api.gax.rpc.InvalidArgumentException)7 InstanceTemplate (com.google.cloud.compute.v1.InstanceTemplate)7 NetworkInterface (com.google.cloud.compute.v1.NetworkInterface)7 Any (com.google.protobuf.Any)7 FieldMask (com.google.protobuf.FieldMask)7