Search in sources :

Example 21 with Instance

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

the class SyncUpgradeInstanceInstancenameString method syncUpgradeInstanceInstancenameString.

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

Example 22 with Instance

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

the class AsyncCreateInstanceLRO method asyncCreateInstanceLRO.

public static void asyncCreateInstanceLRO() throws Exception {
    // It may require modifications to work in your environment.
    try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
        CreateInstanceRequest request = CreateInstanceRequest.newBuilder().setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()).setInstanceId("instanceId902024336").setInstance(Instance.newBuilder().build()).build();
        OperationFuture<Instance, Any> future = cloudRedisClient.createInstanceOperationCallable().futureCall(request);
        // Do something.
        Instance response = future.get();
    }
}
Also used : CloudRedisClient(com.google.cloud.redis.v1beta1.CloudRedisClient) Instance(com.google.cloud.redis.v1beta1.Instance) CreateInstanceRequest(com.google.cloud.redis.v1beta1.CreateInstanceRequest) Any(com.google.protobuf.Any)

Example 23 with Instance

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

the class SyncCreateInstance method syncCreateInstance.

public static void syncCreateInstance() throws Exception {
    // It may require modifications to work in your environment.
    try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
        CreateInstanceRequest request = CreateInstanceRequest.newBuilder().setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()).setInstanceId("instanceId902024336").setInstance(Instance.newBuilder().build()).build();
        Instance response = cloudRedisClient.createInstanceAsync(request).get();
    }
}
Also used : CloudRedisClient(com.google.cloud.redis.v1beta1.CloudRedisClient) Instance(com.google.cloud.redis.v1beta1.Instance) CreateInstanceRequest(com.google.cloud.redis.v1beta1.CreateInstanceRequest)

Example 24 with Instance

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

the class SyncRescheduleMaintenanceInstancenameReschedulemaintenancerequestrescheduletypeTimestamp method syncRescheduleMaintenanceInstancenameReschedulemaintenancerequestrescheduletypeTimestamp.

public static void syncRescheduleMaintenanceInstancenameReschedulemaintenancerequestrescheduletypeTimestamp() throws Exception {
    // It may require modifications to work in your environment.
    try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
        InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
        RescheduleMaintenanceRequest.RescheduleType rescheduleType = RescheduleMaintenanceRequest.RescheduleType.forNumber(0);
        Timestamp scheduleTime = Timestamp.newBuilder().build();
        Instance response = cloudRedisClient.rescheduleMaintenanceAsync(name, rescheduleType, scheduleTime).get();
    }
}
Also used : InstanceName(com.google.cloud.redis.v1beta1.InstanceName) CloudRedisClient(com.google.cloud.redis.v1beta1.CloudRedisClient) Instance(com.google.cloud.redis.v1beta1.Instance) RescheduleMaintenanceRequest(com.google.cloud.redis.v1beta1.RescheduleMaintenanceRequest) Timestamp(com.google.protobuf.Timestamp)

Example 25 with Instance

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

the class ITSmokeInstancesTest method testInsertInstance.

@Test
public void testInsertInstance() throws ExecutionException, InterruptedException {
    Instance resultInstance = insertInstance();
    assertInstanceDetails(resultInstance);
}
Also used : Instance(com.google.cloud.compute.v1.Instance) Test(org.junit.Test)

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