List<GcpAddress> instances(String project, String zone, Label label, String accessToken) {
        String response = RestClient
                .create(urlFor(project, zone, label))
                .withHeader("Authorization", String.format("OAuth %s", accessToken))
                .get()
                .getBody();

        List<GcpAddress> result = new ArrayList<>();
        for (JsonValue item : toJsonArray(Json.parse(response).asObject().get("items"))) {
            if ("RUNNING".equals(item.asObject().get("status").asString())) {
                String privateAddress = null;
                String publicAddress = null;
                for (JsonValue networkInterface : toJsonArray(item.asObject().get("networkInterfaces"))) {
                    privateAddress = networkInterface.asObject().getString("networkIP", null);
                    for (JsonValue accessConfig : toJsonArray(networkInterface.asObject().get("accessConfigs"))) {
                        publicAddress = accessConfig.asObject().getString("natIP", null);
                    }
                }
                if (privateAddress != null) {
                    result.add(new GcpAddress(privateAddress, publicAddress));
                }
            }
        }

        return result;
    }
@Test
    public void instances() {
        // given
        stubFor(get(urlEqualTo(
                String.format("/compute/v1/projects/%s/zones/%s/instances?filter=labels.%s+eq+%s", PROJECT, ZONE, LABEL_KEY,
                        LABEL_VALUE)))
                .withHeader("Authorization", equalTo(String.format("OAuth %s", ACCESS_TOKEN)))
                .willReturn(aResponse().withStatus(HttpURLConnection.HTTP_OK).withBody(instancesResponse())));
        Label label = new Label(String.format("%s=%s", LABEL_KEY, LABEL_VALUE));

        // when
        List<GcpAddress> result = gcpComputeApi.instances(PROJECT, ZONE, label, ACCESS_TOKEN);

        // then
        GcpAddress address1 = new GcpAddress(INSTANCE_1_PRIVATE_IP, INSTANCE_1_PUBLIC_IP);
        GcpAddress address2 = new GcpAddress(INSTANCE_2_PRIVATE_IP, INSTANCE_2_PUBLIC_IP);
        assertEquals(asList(address1, address2), result);
    }