static Instance fromProto( com.google.spanner.admin.instance.v1.Instance proto, InstanceAdminClient instanceClient, DatabaseAdminClient dbClient) { InstanceId id = InstanceId.of(proto.getName()); Builder builder = new Builder(instanceClient, dbClient, id) .setInstanceConfigId(InstanceConfigId.of(proto.getConfig())) .setDisplayName(proto.getDisplayName()) .setNodeCount(proto.getNodeCount()); State state; switch (proto.getState()) { case STATE_UNSPECIFIED: state = State.UNSPECIFIED; break; case CREATING: state = State.CREATING; break; case READY: state = State.READY; break; default: throw new IllegalArgumentException("Unknown state:" + proto.getState()); } builder.setState(state); builder.putAllLabels(proto.getLabelsMap()); return builder.build(); } }
static Instance fromProto( com.google.spanner.admin.instance.v1.Instance proto, InstanceAdminClient instanceClient, DatabaseAdminClient dbClient) { InstanceId id = InstanceId.of(proto.getName()); Builder builder = new Builder(instanceClient, dbClient, id) .setInstanceConfigId(InstanceConfigId.of(proto.getConfig())) .setDisplayName(proto.getDisplayName()) .setNodeCount(proto.getNodeCount()); State state; switch (proto.getState()) { case STATE_UNSPECIFIED: state = State.UNSPECIFIED; break; case CREATING: state = State.CREATING; break; case READY: state = State.READY; break; default: throw new IllegalArgumentException("Unknown state:" + proto.getState()); } builder.setState(state); builder.putAllLabels(proto.getLabelsMap()); return builder.build(); } }