use of com.google.cloud.spanner.Instance in project google-cloud-java by GoogleCloudPlatform.
the class InstanceAdminClientSnippets method getInstance.
/**
* Example to get an instance.
*/
public Instance getInstance(final String my_instance_id) {
// [START instance_admin_client_get_instance]
final String instanceId = my_instance_id;
Instance ins = instanceAdminClient.getInstance(instanceId);
// [END instance_admin_client_get_instance]
return ins;
}
use of com.google.cloud.spanner.Instance in project spanner-jdbc by olavloite.
the class CloudSpannerIT method createInstance.
private void createInstance() {
InstanceAdminClient instanceAdminClient = spanner.getInstanceAdminClient();
InstanceConfig config = instanceAdminClient.getInstanceConfig("regional-europe-west1");
Instance instance = instanceAdminClient.newInstanceBuilder(InstanceId.of(getProject(), instanceId)).setDisplayName("Test Instance").setInstanceConfigId(config.getId()).setNodeCount(1).build();
Operation<Instance, CreateInstanceMetadata> createInstance = instanceAdminClient.createInstance(instance);
createInstance = createInstance.waitFor();
}
Aggregations