You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ad...@apache.org on 2014/10/31 02:57:26 UTC
[1/6] Added options and binders for LB apis.
Repository: jclouds-labs-google
Updated Branches:
refs/heads/master b8670b16e -> bbf953be0
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskTypeApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskTypeApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskTypeApiExpectTest.java
index 32abd30..f3a38d2 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskTypeApiExpectTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskTypeApiExpectTest.java
@@ -68,7 +68,7 @@ public class DiskTypeApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
.payload(payloadFromResource("/disktype.json")).build();
DiskTypeApi diskTypeApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, get, operationResponse).getDiskTypeApiForProject("myproject");
+ TOKEN_RESPONSE, get, operationResponse).getDiskTypeApi("myproject");
assertEquals(diskTypeApi.getInZone("us-central1-a", "pd-standard"),
new ParseDiskTypeTest().expected());
@@ -86,7 +86,7 @@ public class DiskTypeApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
DiskTypeApi diskTypeApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, get, operationResponse).getDiskTypeApiForProject("myproject");
+ TOKEN_RESPONSE, get, operationResponse).getDiskTypeApi("myproject");
assertNull(diskTypeApi.getInZone("us-central1-a", "pd-standard"));
}
@@ -94,7 +94,7 @@ public class DiskTypeApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
public void testListDiskTypeNoOptionsResponseIs2xx() throws Exception {
DiskTypeApi diskTypeApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, LIST_DISK_TYPES_REQUEST, LIST_DISK_TYPES_RESPONSE).getDiskTypeApiForProject
+ TOKEN_RESPONSE, LIST_DISK_TYPES_REQUEST, LIST_DISK_TYPES_RESPONSE).getDiskTypeApi
("myproject");
assertEquals(diskTypeApi.listFirstPageInZone("us-central1-a").toString(),
@@ -106,7 +106,7 @@ public class DiskTypeApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
DiskTypeApi diskTypeApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, LIST_DISK_TYPES_REQUEST, operationResponse).getDiskTypeApiForProject("myproject");
+ TOKEN_RESPONSE, LIST_DISK_TYPES_REQUEST, operationResponse).getDiskTypeApi("myproject");
assertTrue(diskTypeApi.listInZone("us-central1-a").concat().isEmpty());
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskTypeApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskTypeApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskTypeApiLiveTest.java
index 9958311..0168549 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskTypeApiLiveTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskTypeApiLiveTest.java
@@ -40,7 +40,7 @@ public class DiskTypeApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
private DiskType diskType;
private DiskTypeApi api() {
- return api.getDiskTypeApiForProject(userProject.get());
+ return api.getDiskTypeApi(userProject.get());
}
@Test(groups = "live")
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiExpectTest.java
index f3f1c71..a8b948a 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiExpectTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiExpectTest.java
@@ -17,6 +17,8 @@
package org.jclouds.googlecomputeengine.features;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiExpectTest;
+import org.jclouds.googlecomputeengine.options.ForwardingRuleCreationOptions;
+import org.jclouds.googlecomputeengine.options.ListOptions;
import org.jclouds.googlecomputeengine.parse.ParseRegionOperationTest;
import org.jclouds.googlecomputeengine.parse.ParseForwardingRuleListTest;
import org.jclouds.googlecomputeengine.parse.ParseForwardingRuleTest;
@@ -39,129 +41,154 @@ public class ForwardingRuleApiExpectTest extends BaseGoogleComputeEngineApiExpec
public void testGetForwardingRuleResponseIs2xx() throws Exception {
HttpRequest get = HttpRequest
- .builder()
- .method("GET")
- .endpoint("https://www.googleapis" +
- ".com/compute/v1/projects/myproject/regions/us-central1/forwardingRules/test-forwarding-rule")
- .addHeader("Accept", "application/json")
- .addHeader("Authorization", "Bearer " + TOKEN).build();
+ .builder()
+ .method("GET")
+ .endpoint("https://www.googleapis" +
+ ".com/compute/v1/projects/myproject/regions/us-central1/forwardingRules/test-forwarding-rule")
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN).build();
HttpResponse operationResponse = HttpResponse.builder().statusCode(200)
- .payload(payloadFromResource("/forwardingrule_get.json")).build();
+ .payload(payloadFromResource("/forwardingrule_get.json")).build();
ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, get, operationResponse).getForwardingRuleApi("myproject", "us-central1");
+ TOKEN_RESPONSE, get, operationResponse).getForwardingRuleApi("myproject", "us-central1");
assertEquals(api.get("test-forwarding-rule"),
- new ParseForwardingRuleTest().expected());
+ new ParseForwardingRuleTest().expected());
}
public void testGetForwardingRuleResponseIs4xx() throws Exception {
HttpRequest get = HttpRequest
- .builder()
- .method("GET")
- .endpoint("https://www.googleapis" +
- ".com/compute/v1/projects/myproject/regions/us-central1/forwardingRules/test-forwarding-rule")
- .addHeader("Accept", "application/json")
- .addHeader("Authorization", "Bearer " + TOKEN).build();
+ .builder()
+ .method("GET")
+ .endpoint("https://www.googleapis" +
+ ".com/compute/v1/projects/myproject/regions/us-central1/forwardingRules/test-forwarding-rule")
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN).build();
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, get, operationResponse).getForwardingRuleApi("myproject", "us-central1");
+ TOKEN_RESPONSE, get, operationResponse).getForwardingRuleApi("myproject", "us-central1");
assertNull(api.get("test-forwarding-rule"));
}
public void testInsertForwardingRuleResponseIs2xx() {
HttpRequest insert = HttpRequest
- .builder()
- .method("POST")
- .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/forwardingRules")
- .addHeader("Accept", "application/json")
- .addHeader("Authorization", "Bearer " + TOKEN)
- .payload(payloadFromResourceWithContentType("/forwardingrule_insert.json", MediaType.APPLICATION_JSON))
- .build();
+ .builder()
+ .method("POST")
+ .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/forwardingRules")
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN)
+ .payload(payloadFromResourceWithContentType("/forwardingrule_insert.json", MediaType.APPLICATION_JSON))
+ .build();
HttpResponse insertForwardingRuleResponse = HttpResponse.builder().statusCode(200)
- .payload(payloadFromResource("/region_operation.json")).build();
+ .payload(payloadFromResource("/region_operation.json")).build();
ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, insert,
- insertForwardingRuleResponse).getForwardingRuleApi("myproject", "us-central1");
- assertEquals(api.create("test-forwarding-rule",
- URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/europe-west1/" +
- "targetPools/test-target-pool")), new ParseRegionOperationTest().expected());
+ TOKEN_RESPONSE, insert,
+ insertForwardingRuleResponse).getForwardingRuleApi("myproject", "us-central1");
+
+ ForwardingRuleCreationOptions forwardingRuleCreationOptions = new ForwardingRuleCreationOptions()
+ .target(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/"
+ + "europe-west1/targetPools/test-target-pool"));
+ assertEquals(api.create("test-forwarding-rule", forwardingRuleCreationOptions),
+ new ParseRegionOperationTest().expected());
}
public void testDeleteForwardingRuleResponseIs2xx() {
HttpRequest delete = HttpRequest
- .builder()
- .method("DELETE")
- .endpoint("https://www.googleapis" +
- ".com/compute/v1/projects/myproject/regions/us-central1/forwardingRules/test-forwarding-rule")
- .addHeader("Accept", "application/json")
- .addHeader("Authorization", "Bearer " + TOKEN).build();
+ .builder()
+ .method("DELETE")
+ .endpoint("https://www.googleapis" +
+ ".com/compute/v1/projects/myproject/regions/us-central1/forwardingRules/test-forwarding-rule")
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN).build();
HttpResponse deleteResponse = HttpResponse.builder().statusCode(200)
- .payload(payloadFromResource("/region_operation.json")).build();
+ .payload(payloadFromResource("/region_operation.json")).build();
ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, delete, deleteResponse).getForwardingRuleApi("myproject", "us-central1");
+ TOKEN_RESPONSE, delete, deleteResponse).getForwardingRuleApi("myproject", "us-central1");
assertEquals(api.delete("test-forwarding-rule"),
- new ParseRegionOperationTest().expected());
+ new ParseRegionOperationTest().expected());
}
public void testDeleteForwardingRuleResponseIs4xx() {
HttpRequest delete = HttpRequest
- .builder()
- .method("DELETE")
- .endpoint("https://www.googleapis" +
- ".com/compute/v1/projects/myproject/regions/us-central1/forwardingRules/test-targetPool")
- .addHeader("Accept", "application/json")
- .addHeader("Authorization", "Bearer " + TOKEN).build();
+ .builder()
+ .method("DELETE")
+ .endpoint("https://www.googleapis" +
+ ".com/compute/v1/projects/myproject/regions/us-central1/forwardingRules/test-targetPool")
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN).build();
HttpResponse deleteResponse = HttpResponse.builder().statusCode(404).build();
ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, delete, deleteResponse).getForwardingRuleApi("myproject", "us-central1");
+ TOKEN_RESPONSE, delete, deleteResponse).getForwardingRuleApi("myproject", "us-central1");
assertNull(api.delete("test-targetPool"));
}
public void testListForwardingRulesResponseIs2xx() {
HttpRequest list = HttpRequest
- .builder()
- .method("GET")
- .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/forwardingRules")
- .addHeader("Accept", "application/json")
- .addHeader("Authorization", "Bearer " + TOKEN).build();
+ .builder()
+ .method("GET")
+ .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/forwardingRules")
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN).build();
HttpResponse operationResponse = HttpResponse.builder().statusCode(200)
- .payload(payloadFromResource("/forwardingrule_list.json")).build();
+ .payload(payloadFromResource("/forwardingrule_list.json")).build();
ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, list, operationResponse).getForwardingRuleApi("myproject", "us-central1");
+ TOKEN_RESPONSE, list, operationResponse).getForwardingRuleApi("myproject", "us-central1");
- assertEquals(api.list().toString(),
- new ParseForwardingRuleListTest().expected().toString());
+ ListOptions options = new ListOptions();
+ assertEquals(api.list(options).toString(),
+ new ParseForwardingRuleListTest().expected().toString());
}
public void testListForwardingRulesResponseIs4xx() {
HttpRequest list = HttpRequest
- .builder()
- .method("GET")
- .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/forwardingRules")
- .addHeader("Accept", "application/json")
- .addHeader("Authorization", "Bearer " + TOKEN).build();
+ .builder()
+ .method("GET")
+ .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/forwardingRules")
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN).build();
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, list, operationResponse).getForwardingRuleApi("myproject", "us-central1");
+ TOKEN_RESPONSE, list, operationResponse).getForwardingRuleApi("myproject", "us-central1");
assertTrue(api.list().concat().isEmpty());
}
+ public void testSetTargetForwardingRuleResponseIs2xx(){
+ String ruleName = "testForwardingRule";
+ HttpRequest setTarget = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/forwardingRules/" + ruleName + "/setTarget")
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN)
+ .payload(payloadFromResourceWithContentType("/forwardingrule_set_target.json", MediaType.APPLICATION_JSON))
+ .build();
+
+ HttpResponse setTargetResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/region_operation.json")).build();
+
+ ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
+ TOKEN_RESPONSE, setTarget, setTargetResponse).getForwardingRuleApi("myproject", "us-central1");
+
+ String newTarget = "https://www.googleapis.com/compute/v1/projects/myproject/regions/europe-west1/targetPools/test-target-pool";
+ assertEquals(api.setTarget(ruleName, newTarget), new ParseRegionOperationTest().expected());
+ }
+
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiLiveTest.java
index 833d455..2412b33 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiLiveTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiLiveTest.java
@@ -20,7 +20,9 @@ import org.jclouds.collect.IterableWithMarker;
import org.jclouds.googlecomputeengine.domain.ForwardingRule;
import org.jclouds.googlecomputeengine.domain.TargetPool;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiLiveTest;
+import org.jclouds.googlecomputeengine.options.ForwardingRuleCreationOptions;
import org.jclouds.googlecomputeengine.options.ListOptions;
+import org.jclouds.googlecomputeengine.options.TargetPoolCreationOptions;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -49,7 +51,8 @@ public class ForwardingRuleApiLiveTest extends BaseGoogleComputeEngineApiLiveTes
@BeforeClass
public void init() {
- assertRegionOperationDoneSucessfully(targetPoolApi().create(TARGETPOOL_NAME), TIME_WAIT);
+ TargetPoolCreationOptions targetPoolCreationOptions = new TargetPoolCreationOptions();
+ assertRegionOperationDoneSucessfully(targetPoolApi().create(TARGETPOOL_NAME, targetPoolCreationOptions), TIME_WAIT);
targetPool = targetPoolApi().get(TARGETPOOL_NAME);
}
@@ -60,7 +63,9 @@ public class ForwardingRuleApiLiveTest extends BaseGoogleComputeEngineApiLiveTes
@Test(groups = "live")
public void testInsertForwardingRule() {
- assertRegionOperationDoneSucessfully(api().create(FORWARDING_RULE_NAME, targetPool.getSelfLink()), TIME_WAIT);
+ ForwardingRuleCreationOptions forwardingRuleCreationOptions = new ForwardingRuleCreationOptions()
+ .target(targetPool.getSelfLink());
+ assertRegionOperationDoneSucessfully(api().create(FORWARDING_RULE_NAME, forwardingRuleCreationOptions), TIME_WAIT);
}
@Test(groups = "live", dependsOnMethods = "testInsertForwardingRule")
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiExpectTest.java
index 906c685..9069619 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiExpectTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiExpectTest.java
@@ -25,11 +25,14 @@ import static org.testng.AssertJUnit.assertNull;
import javax.ws.rs.core.MediaType;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiExpectTest;
+import org.jclouds.googlecomputeengine.options.HttpHealthCheckCreationOptions;
+import org.jclouds.googlecomputeengine.options.ListOptions;
import org.jclouds.googlecomputeengine.parse.ParseHttpHealthCheckListTest;
import org.jclouds.googlecomputeengine.parse.ParseHttpHealthCheckTest;
import org.jclouds.googlecomputeengine.parse.ParseRegionOperationTest;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
+import org.jclouds.rest.ResourceNotFoundException;
import org.testng.annotations.Test;
@Test(groups = "unit")
@@ -85,9 +88,11 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpe
HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
TOKEN_RESPONSE, insert,
insertHttpHealthCheckResponse).getHttpHealthCheckApi("myproject");
- assertEquals(api.insert("http-health-check", 0, 0), new ParseRegionOperationTest().expected());
+ HttpHealthCheckCreationOptions options = new HttpHealthCheckCreationOptions().timeoutSec(0).unhealthyThreshold(0);
+ assertEquals(api.insert("http-health-check", options), new ParseRegionOperationTest().expected());
}
+ @Test(expectedExceptions = ResourceNotFoundException.class)
public void testInsertHttpHealthCheckResponseIs4xx() {
HttpRequest create = HttpRequest
.builder()
@@ -103,7 +108,9 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpe
HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
TOKEN_RESPONSE, create, insertHttpHealthCheckResponse).getHttpHealthCheckApi("myproject");
- assertNull(api.insert("http-health-check", 0, 0));
+ HttpHealthCheckCreationOptions options = new HttpHealthCheckCreationOptions().timeoutSec(0).unhealthyThreshold(0);
+
+ api.insert("http-health-check", options);
}
public void testDeleteHttpHealthCheckResponseIs2xx() {
@@ -154,7 +161,8 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpe
HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
TOKEN_RESPONSE, list, operationResponse).getHttpHealthCheckApi("myproject");
- assertEquals(api.list().toString(),
+ ListOptions options = new ListOptions();
+ assertEquals(api.list(options).toString(),
new ParseHttpHealthCheckListTest().expected().toString());
}
@@ -173,5 +181,90 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpe
assertTrue(api.list().concat().isEmpty());
}
+
+ public void testPatchHttpHealthChecksResponseIs2xx() {
+ String healthCheckName = "http-health-check";
+ HttpRequest patch = HttpRequest
+ .builder()
+ .method("PATCH")
+ .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/global/httpHealthChecks/" + healthCheckName)
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN)
+ .payload(payloadFromResourceWithContentType("/httphealthcheck_insert.json", MediaType.APPLICATION_JSON))
+ .build();
+
+ HttpResponse insertHttpHealthCheckResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/global_operation.json")).build();
+
+ HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
+ TOKEN_RESPONSE, patch,
+ insertHttpHealthCheckResponse).getHttpHealthCheckApi("myproject");
+ HttpHealthCheckCreationOptions options = new HttpHealthCheckCreationOptions().timeoutSec(0).unhealthyThreshold(0);
+ assertEquals(api.patch(healthCheckName, options), new ParseRegionOperationTest().expected());
+ }
+
+ @Test(expectedExceptions = ResourceNotFoundException.class)
+ public void testPatchHttpHealthChecksResponseIs4xx(){
+ String healthCheckName = "http-health-check";
+ HttpRequest patch = HttpRequest
+ .builder()
+ .method("PATCH")
+ .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/global/httpHealthChecks/" + healthCheckName)
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN)
+ .payload(payloadFromResourceWithContentType("/httphealthcheck_insert.json", MediaType.APPLICATION_JSON))
+ .build();
+
+ HttpResponse insertHttpHealthCheckResponse = HttpResponse.builder().statusCode(404).build();
+
+ HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
+ TOKEN_RESPONSE, patch,
+ insertHttpHealthCheckResponse).getHttpHealthCheckApi("myproject");
+ HttpHealthCheckCreationOptions options = new HttpHealthCheckCreationOptions().timeoutSec(0).unhealthyThreshold(0);
+
+ api.patch(healthCheckName, options);
+ }
+
+ public void testUpdateHttpHealthChecksResponseIs2xx() {
+ String healthCheckName = "http-health-check";
+ HttpRequest patch = HttpRequest
+ .builder()
+ .method("PUT")
+ .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/global/httpHealthChecks/" + healthCheckName)
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN)
+ .payload(payloadFromResourceWithContentType("/httphealthcheck_insert.json", MediaType.APPLICATION_JSON))
+ .build();
+
+ HttpResponse insertHttpHealthCheckResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/global_operation.json")).build();
+
+ HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
+ TOKEN_RESPONSE, patch,
+ insertHttpHealthCheckResponse).getHttpHealthCheckApi("myproject");
+ HttpHealthCheckCreationOptions options = new HttpHealthCheckCreationOptions().timeoutSec(0).unhealthyThreshold(0);
+ assertEquals(api.update(healthCheckName, options), new ParseRegionOperationTest().expected());
+ }
+
+ @Test(expectedExceptions = ResourceNotFoundException.class)
+ public void testUpdateHttpHealthChecksResponseIs4xx() {
+ String healthCheckName = "http-health-check";
+ HttpRequest patch = HttpRequest
+ .builder()
+ .method("PUT")
+ .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/global/httpHealthChecks/" + healthCheckName)
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN)
+ .payload(payloadFromResourceWithContentType("/httphealthcheck_insert.json", MediaType.APPLICATION_JSON))
+ .build();
+
+ HttpResponse insertHttpHealthCheckResponse = HttpResponse.builder().statusCode(404).build();
+
+ HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
+ TOKEN_RESPONSE, patch,
+ insertHttpHealthCheckResponse).getHttpHealthCheckApi("myproject");
+ HttpHealthCheckCreationOptions options = new HttpHealthCheckCreationOptions().timeoutSec(0).unhealthyThreshold(0);
+ api.update(healthCheckName, options);
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiLiveTest.java
index 9adcd4d..1491cab 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiLiveTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiLiveTest.java
@@ -46,14 +46,14 @@ public class HttpHealthCheckApiLiveTest extends BaseGoogleComputeEngineApiLiveTe
assertEquals(httpHealthCheck.getName(), HTTP_HEALTH_CHECK_NAME);
}
- @Test(groups = "live", dependsOnMethods = "testGetHttpHealthCheck")
+ @Test(groups = "live", dependsOnMethods = "testInsertHttpHealthCheck")
public void testListHttpHealthCheck() {
IterableWithMarker<HttpHealthCheck> httpHealthCheck = api().list(new ListOptions.Builder()
.filter("name eq " + HTTP_HEALTH_CHECK_NAME));
assertEquals(httpHealthCheck.toList().size(), 1);
}
- @Test(groups = "live", dependsOnMethods = "testListHttpHealthCheck")
+ @Test(groups = "live", dependsOnMethods = {"testListHttpHealthCheck", "testGetHttpHealthCheck"})
public void testDeleteHttpHealthCheck() {
assertGlobalOperationDoneSucessfully(api().delete(HTTP_HEALTH_CHECK_NAME), TIME_WAIT);
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiExpectTest.java
index e8545f2..9bd0044 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiExpectTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiExpectTest.java
@@ -16,14 +16,22 @@
*/
package org.jclouds.googlecomputeengine.features;
+import java.net.URI;
+import java.util.Set;
+
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiExpectTest;
+import org.jclouds.googlecomputeengine.options.ListOptions;
+import org.jclouds.googlecomputeengine.options.TargetPoolCreationOptions;
import org.jclouds.googlecomputeengine.parse.ParseRegionOperationTest;
import org.jclouds.googlecomputeengine.parse.ParseTargetPoolListTest;
import org.jclouds.googlecomputeengine.parse.ParseTargetPoolTest;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
+import org.jclouds.rest.ResourceNotFoundException;
import org.testng.annotations.Test;
+import com.google.common.collect.ImmutableSet;
+
import javax.ws.rs.core.MediaType;
import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE;
@@ -35,6 +43,12 @@ import static org.testng.AssertJUnit.assertNull;
@Test(groups = "unit")
public class TargetPoolApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
+ private static final Set<URI> INSTANCES = ImmutableSet.of(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/zones/europe-west1-a/instances/test"));
+
+ private static final Set<URI> HEALTH_CHECKS = ImmutableSet.of(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/httpHealthChecks/health-check-1"));
+
+ private static final URI TARGET_POOL = URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools/tpool");
+
public void testGetTargetPoolResponseIs2xx() throws Exception {
HttpRequest get = HttpRequest
.builder()
@@ -85,7 +99,8 @@ public class TargetPoolApiExpectTest extends BaseGoogleComputeEngineApiExpectTes
TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
TOKEN_RESPONSE, insert,
insertTargetPoolResponse).getTargetPoolApi("myproject", "us-central1");
- assertEquals(api.create("test"), new ParseRegionOperationTest().expected());
+ TargetPoolCreationOptions targetPoolCreationOptions = new TargetPoolCreationOptions();
+ assertEquals(api.create("test", targetPoolCreationOptions), new ParseRegionOperationTest().expected());
}
public void testDeleteTargetPoolResponseIs2xx() {
@@ -136,7 +151,8 @@ public class TargetPoolApiExpectTest extends BaseGoogleComputeEngineApiExpectTes
TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
TOKEN_RESPONSE, list, operationResponse).getTargetPoolApi("myproject", "us-central1");
- assertEquals(api.list().toString(),
+ ListOptions options = new ListOptions();
+ assertEquals(api.list(options).toString(),
new ParseTargetPoolListTest().expected().toString());
}
@@ -157,42 +173,167 @@ public class TargetPoolApiExpectTest extends BaseGoogleComputeEngineApiExpectTes
}
public void testAddInstanceResponseIs2xx() throws Exception {
- HttpRequest addInstance = HttpRequest
- .builder()
- .method("POST")
- .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools/test/addInstance")
- .addHeader("Accept", "application/json")
- .addHeader("Authorization", "Bearer " + TOKEN)
- .payload(payloadFromResourceWithContentType("/targetpool_addinstance.json", MediaType.APPLICATION_JSON))
- .build();
-
+ HttpRequest addInstance = makeGenericRequest("POST", "addInstance", "/targetpool_addinstance.json");
HttpResponse operationResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResource("/region_operation.json")).build();
TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
TOKEN_RESPONSE, addInstance, operationResponse).getTargetPoolApi("myproject", "us-central1");
- assertEquals(api.addInstance("test",
- "https://www.googleapis.com/compute/v1/projects/myproject/zones/europe-west1-a/instances/test"),
+ assertEquals(api.addInstance("test", INSTANCES),
new ParseRegionOperationTest().expected());
}
+ @Test(expectedExceptions = ResourceNotFoundException.class)
public void testAddInstanceResponseIs4xx() throws Exception {
- HttpRequest addInstance = HttpRequest
- .builder()
- .method("POST")
- .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools/test/addInstance")
- .addHeader("Accept", "application/json")
- .addHeader("Authorization", "Bearer " + TOKEN)
- .payload(payloadFromResourceWithContentType("/targetpool_addinstance.json", MediaType.APPLICATION_JSON))
- .build();
-
+ HttpRequest addInstance = makeGenericRequest("POST", "addInstance", "/targetpool_addinstance.json");
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
TOKEN_RESPONSE, addInstance, operationResponse).getTargetPoolApi("myproject", "us-central1");
- assertNull(api.addInstance("test", "https://www.googleapis" +
- ".com/compute/v1/projects/myproject/zones/europe-west1-a/instances/test"));
+ api.addInstance("test", INSTANCES);
+ }
+
+ public void testRemoveInstanceResponseIs2xx(){
+ HttpRequest removeInstance = makeGenericRequest("POST", "removeInstance", "/targetpool_addinstance.json");
+
+ HttpResponse operationResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/region_operation.json")).build();
+
+ TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
+ TOKEN_RESPONSE, removeInstance, operationResponse).getTargetPoolApi("myproject", "us-central1");
+
+ assertEquals(api.removeInstance("test", INSTANCES),
+ new ParseRegionOperationTest().expected());
+ }
+
+ @Test(expectedExceptions = ResourceNotFoundException.class)
+ public void testRemoveInstanceResponseIs4xx() throws Exception {
+ HttpRequest removeInstance = makeGenericRequest("POST", "removeInstance", "/targetpool_addinstance.json");
+ HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
+
+ TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
+ TOKEN_RESPONSE, removeInstance, operationResponse).getTargetPoolApi("myproject", "us-central1");
+
+ api.removeInstance("test", INSTANCES);
+ }
+
+ public void testAddHealthCheckResponseIs2xx(){
+ HttpRequest addHealthCheck = makeGenericRequest("POST", "addHealthCheck", "/targetpool_changehealthcheck.json");
+
+ HttpResponse operationResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/region_operation.json")).build();
+
+ TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
+ TOKEN_RESPONSE, addHealthCheck, operationResponse).getTargetPoolApi("myproject", "us-central1");
+
+ assertEquals(api.addHealthCheck("test", HEALTH_CHECKS),
+ new ParseRegionOperationTest().expected());
+ }
+
+ @Test(expectedExceptions = ResourceNotFoundException.class)
+ public void testAddHealthCheckResponseIs4xx() throws Exception {
+ HttpRequest addHealthCheck = makeGenericRequest("POST", "addHealthCheck", "/targetpool_changehealthcheck.json");
+ HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
+
+ TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
+ TOKEN_RESPONSE, addHealthCheck, operationResponse).getTargetPoolApi("myproject", "us-central1");
+
+ api.addHealthCheck("test", HEALTH_CHECKS);
+ }
+
+ public void testRemoveHealthCheckResponseIs2xx(){
+ HttpRequest removeHealthCheck = makeGenericRequest("POST", "removeHealthCheck", "/targetpool_changehealthcheck.json");
+
+ HttpResponse operationResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/region_operation.json")).build();
+
+ TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
+ TOKEN_RESPONSE, removeHealthCheck, operationResponse).getTargetPoolApi("myproject", "us-central1");
+
+ assertEquals(api.removeHealthCheck("test", HEALTH_CHECKS),
+ new ParseRegionOperationTest().expected());
+ }
+
+ @Test(expectedExceptions = ResourceNotFoundException.class)
+ public void testRemoveHealthCheckResponseIs4xx() throws Exception {
+ HttpRequest removeHealthCheck = makeGenericRequest("POST", "removeHealthCheck", "/targetpool_changehealthcheck.json");
+ HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
+
+ TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
+ TOKEN_RESPONSE, removeHealthCheck, operationResponse).getTargetPoolApi("myproject", "us-central1");
+
+ api.removeHealthCheck("test", HEALTH_CHECKS);
+ }
+
+ public void testSetBackupResponseIs2xx(){
+ HttpRequest setBackup = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools/testpool/setBackup")
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN)
+ .payload(payloadFromResourceWithContentType("/targetpool_setbackup.json", MediaType.APPLICATION_JSON))
+ .build();
+ HttpResponse operationResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/region_operation.json")).build();
+
+ TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
+ TOKEN_RESPONSE, setBackup, operationResponse).getTargetPoolApi("myproject", "us-central1");
+
+ assertEquals(api.setBackup("testpool", TARGET_POOL ),
+ new ParseRegionOperationTest().expected());
+ }
+
+ public void testSetBackupWithFailoverRatioResponseIs2xx(){
+ HttpRequest setBackup = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/"
+ + "us-central1/targetPools/testpool/setBackup?failoverRatio=0.5")
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN)
+ .payload(payloadFromResourceWithContentType("/targetpool_setbackup.json", MediaType.APPLICATION_JSON))
+ .build();
+ HttpResponse operationResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/region_operation.json")).build();
+
+ TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
+ TOKEN_RESPONSE, setBackup, operationResponse).getTargetPoolApi("myproject", "us-central1");
+
+ Float failoverRatio = Float.valueOf("0.5");
+ assertEquals(api.setBackup("testpool", failoverRatio, TARGET_POOL ),
+ new ParseRegionOperationTest().expected());
+ }
+
+ @Test(expectedExceptions = ResourceNotFoundException.class)
+ public void testSetBackupResponseIs4xx() throws Exception {
+ HttpRequest setBackup = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools/testpool/setBackup")
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN)
+ .payload(payloadFromResourceWithContentType("/targetpool_setbackup.json", MediaType.APPLICATION_JSON))
+ .build();
+ HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
+
+ TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
+ TOKEN_RESPONSE, setBackup, operationResponse).getTargetPoolApi("myproject", "us-central1");
+
+ api.setBackup("testpool", TARGET_POOL );
+ }
+
+ public HttpRequest makeGenericRequest(String method, String endpoint, String requestPayloadFile){
+ HttpRequest request = HttpRequest
+ .builder()
+ .method(method)
+ .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools/test/" + endpoint)
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN)
+ .payload(payloadFromResourceWithContentType(requestPayloadFile, MediaType.APPLICATION_JSON))
+ .build();
+ return request;
}
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiLiveTest.java
index 5126b65..032b31f 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiLiveTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiLiveTest.java
@@ -20,15 +20,19 @@ import org.jclouds.collect.IterableWithMarker;
import org.jclouds.googlecomputeengine.domain.TargetPool;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiLiveTest;
import org.jclouds.googlecomputeengine.options.ListOptions;
+import org.jclouds.googlecomputeengine.options.TargetPoolCreationOptions;
+import org.jclouds.googlecomputeengine.options.TargetPoolCreationOptions.SessionAffinityValue;
import org.testng.annotations.Test;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
+import static com.google.common.base.Optional.fromNullable;
public class TargetPoolApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
private static final String TARGETPOOL_NAME = "targetpool-api-live-test";
private static final int TIME_WAIT = 30;
+ private static final String DESCRIPTION = "A New TargetPool!";
private TargetPoolApi api() {
return api.getTargetPoolApi(userProject.get(), DEFAULT_REGION_NAME);
@@ -36,7 +40,10 @@ public class TargetPoolApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
@Test(groups = "live")
public void testInsertTargetPool() {
- assertRegionOperationDoneSucessfully(api().create(TARGETPOOL_NAME), TIME_WAIT);
+ TargetPoolCreationOptions targetPoolCreationOptions = new TargetPoolCreationOptions()
+ .description(DESCRIPTION)
+ .sessionAffinity(SessionAffinityValue.CLIENT_IP);
+ assertRegionOperationDoneSucessfully(api().create(TARGETPOOL_NAME, targetPoolCreationOptions), TIME_WAIT);
}
@Test(groups = "live", dependsOnMethods = "testInsertTargetPool")
@@ -44,9 +51,11 @@ public class TargetPoolApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
TargetPool targetPool = api().get(TARGETPOOL_NAME);
assertNotNull(targetPool);
assertEquals(targetPool.getName(), TARGETPOOL_NAME);
+ assertEquals(targetPool.getDescription(), fromNullable(DESCRIPTION));
+ assertEquals(targetPool.getSessionAffinity(), fromNullable(SessionAffinityValue.CLIENT_IP));
}
- @Test(groups = "live", dependsOnMethods = "testGetTargetPool")
+ @Test(groups = "live", dependsOnMethods = "testInsertTargetPool")
public void testListTargetPool() {
IterableWithMarker<TargetPool> targetPool = api().list(new ListOptions.Builder()
@@ -54,8 +63,9 @@ public class TargetPoolApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
assertEquals(targetPool.toList().size(), 1);
}
- @Test(groups = "live", dependsOnMethods = "testListTargetPool")
+ @Test(groups = "live", dependsOnMethods = {"testListTargetPool", "testGetTargetPool"})
public void testDeleteTargetPool() {
assertRegionOperationDoneSucessfully(api().delete(TARGETPOOL_NAME), TIME_WAIT);
}
+
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseForwardingRuleListTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseForwardingRuleListTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseForwardingRuleListTest.java
index 8b6a0ee..e2c0f40 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseForwardingRuleListTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseForwardingRuleListTest.java
@@ -17,8 +17,10 @@
package org.jclouds.googlecomputeengine.parse;
import com.google.common.collect.ImmutableSet;
+
import org.jclouds.date.internal.SimpleDateFormatDateService;
import org.jclouds.googlecomputeengine.domain.ForwardingRule;
+import org.jclouds.googlecomputeengine.domain.ForwardingRule.IPProtocolOption;
import org.jclouds.googlecomputeengine.domain.ListPage;
import org.jclouds.googlecomputeengine.domain.Resource;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
@@ -26,6 +28,7 @@ import org.testng.annotations.Test;
import javax.ws.rs.Consumes;
import javax.ws.rs.core.MediaType;
+
import java.net.URI;
@Test(groups = "unit")
@@ -49,7 +52,7 @@ public class ParseForwardingRuleListTest extends BaseGoogleComputeEngineParseTes
.name("test-forwarding-rule")
.region(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/europe-west1"))
.ipAddress("23.251.129.77")
- .ipProtocol("TCP")
+ .ipProtocol(IPProtocolOption.TCP)
.target(URI.create("https://www.googleapis" +
".com/compute/v1/projects/myproject/regions/europe-west1/targetPools/test-target-pool"))
.portRange("1-65535")
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseForwardingRuleTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseForwardingRuleTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseForwardingRuleTest.java
index 712e0ee..0f06726 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseForwardingRuleTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseForwardingRuleTest.java
@@ -18,11 +18,13 @@ package org.jclouds.googlecomputeengine.parse;
import org.jclouds.date.internal.SimpleDateFormatDateService;
import org.jclouds.googlecomputeengine.domain.ForwardingRule;
+import org.jclouds.googlecomputeengine.domain.ForwardingRule.IPProtocolOption;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
import org.testng.annotations.Test;
import javax.ws.rs.Consumes;
import javax.ws.rs.core.MediaType;
+
import java.net.URI;
@Test(groups = "unit")
@@ -44,7 +46,7 @@ public class ParseForwardingRuleTest extends BaseGoogleComputeEngineParseTest<Fo
.region(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/europe-west1"))
.target(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/europe-west1/targetPools/test-target-pool"))
.ipAddress("23.251.129.77")
- .ipProtocol("TCP")
+ .ipProtocol(IPProtocolOption.TCP)
.portRange("1-65535")
.build();
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolListTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolListTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolListTest.java
index 0bf743f..5a2cb50 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolListTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolListTest.java
@@ -17,15 +17,18 @@
package org.jclouds.googlecomputeengine.parse;
import com.google.common.collect.ImmutableSet;
+
import org.jclouds.date.internal.SimpleDateFormatDateService;
import org.jclouds.googlecomputeengine.domain.ListPage;
import org.jclouds.googlecomputeengine.domain.Resource;
import org.jclouds.googlecomputeengine.domain.TargetPool;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
+import org.jclouds.googlecomputeengine.options.TargetPoolCreationOptions.SessionAffinityValue;
import org.testng.annotations.Test;
import javax.ws.rs.Consumes;
import javax.ws.rs.core.MediaType;
+
import java.net.URI;
@Test(groups = "unit")
@@ -47,7 +50,7 @@ public class ParseTargetPoolListTest extends BaseGoogleComputeEngineParseTest<Li
.selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools/test-targetpool"))
.name("test-targetpool")
.region(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1"))
- .sessionAffinity("NONE")
+ .sessionAffinity(SessionAffinityValue.NONE)
.build())
).build();
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolTest.java
index faf7a77..160d424 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolTest.java
@@ -19,10 +19,12 @@ package org.jclouds.googlecomputeengine.parse;
import org.jclouds.date.internal.SimpleDateFormatDateService;
import org.jclouds.googlecomputeengine.domain.TargetPool;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
+import org.jclouds.googlecomputeengine.options.TargetPoolCreationOptions.SessionAffinityValue;
import org.testng.annotations.Test;
import javax.ws.rs.Consumes;
import javax.ws.rs.core.MediaType;
+
import java.net.URI;
@Test(groups = "unit")
@@ -41,7 +43,7 @@ public class ParseTargetPoolTest extends BaseGoogleComputeEngineParseTest<Target
.creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2014-01-07T05:25:27.783-08:00"))
.selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools/test-targetpool"))
.name("test-targetpool")
- .sessionAffinity("NONE")
+ .sessionAffinity(SessionAffinityValue.NONE)
.region(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1"))
.build();
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/test/resources/forwardingrule_get.json
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/resources/forwardingrule_get.json b/google-compute-engine/src/test/resources/forwardingrule_get.json
index c3e29e5..b6775bf 100644
--- a/google-compute-engine/src/test/resources/forwardingrule_get.json
+++ b/google-compute-engine/src/test/resources/forwardingrule_get.json
@@ -1,12 +1,12 @@
{
-"kind": "compute#forwardingRule",
-"id": "6732523704970219884",
-"creationTimestamp": "2014-01-08T06:51:10.809-08:00",
-"name": "test-forwarding-rule",
-"region": "https://www.googleapis.com/compute/v1/projects/myproject/regions/europe-west1",
-"IPAddress": "23.251.129.77",
-"IPProtocol": "TCP",
-"portRange": "1-65535",
-"target": "https://www.googleapis.com/compute/v1/projects/myproject/regions/europe-west1/targetPools/test-target-pool",
-"selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/regions/europe-west1/forwardingRules/test-forwarding-rule"
+ "kind": "compute#forwardingRule",
+ "id": "6732523704970219884",
+ "creationTimestamp": "2014-01-08T06:51:10.809-08:00",
+ "name": "test-forwarding-rule",
+ "region": "https://www.googleapis.com/compute/v1/projects/myproject/regions/europe-west1",
+ "IPAddress": "23.251.129.77",
+ "IPProtocol": "TCP",
+ "portRange": "1-65535",
+ "target": "https://www.googleapis.com/compute/v1/projects/myproject/regions/europe-west1/targetPools/test-target-pool",
+ "selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/regions/europe-west1/forwardingRules/test-forwarding-rule"
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/test/resources/forwardingrule_set_target.json
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/resources/forwardingrule_set_target.json b/google-compute-engine/src/test/resources/forwardingrule_set_target.json
new file mode 100644
index 0000000..67e7a8e
--- /dev/null
+++ b/google-compute-engine/src/test/resources/forwardingrule_set_target.json
@@ -0,0 +1 @@
+{"target":"https://www.googleapis.com/compute/v1/projects/myproject/regions/europe-west1/targetPools/test-target-pool"}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/test/resources/targetpool_addinstance.json
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/resources/targetpool_addinstance.json b/google-compute-engine/src/test/resources/targetpool_addinstance.json
index 63fc50f..a50c1cd 100644
--- a/google-compute-engine/src/test/resources/targetpool_addinstance.json
+++ b/google-compute-engine/src/test/resources/targetpool_addinstance.json
@@ -1 +1 @@
-{"instance":"https://www.googleapis.com/compute/v1/projects/myproject/zones/europe-west1-a/instances/test"}
\ No newline at end of file
+{"instances":[{"instance":"https://www.googleapis.com/compute/v1/projects/myproject/zones/europe-west1-a/instances/test"}]}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/test/resources/targetpool_changehealthcheck.json
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/resources/targetpool_changehealthcheck.json b/google-compute-engine/src/test/resources/targetpool_changehealthcheck.json
new file mode 100644
index 0000000..94cd40b
--- /dev/null
+++ b/google-compute-engine/src/test/resources/targetpool_changehealthcheck.json
@@ -0,0 +1 @@
+{"healthChecks":[{"healthCheck":"https://www.googleapis.com/compute/v1/projects/myproject/global/httpHealthChecks/health-check-1"}]}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/test/resources/targetpool_setbackup.json
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/resources/targetpool_setbackup.json b/google-compute-engine/src/test/resources/targetpool_setbackup.json
new file mode 100644
index 0000000..c3c059d
--- /dev/null
+++ b/google-compute-engine/src/test/resources/targetpool_setbackup.json
@@ -0,0 +1 @@
+{"target":"https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools/tpool"}
\ No newline at end of file
[4/6] initial commit to support GCE LB
Posted by ad...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AddressApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AddressApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AddressApiExpectTest.java
index 1816b78..28c3657 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AddressApiExpectTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AddressApiExpectTest.java
@@ -47,7 +47,7 @@ public class AddressApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
.payload(payloadFromResource("/address_get.json")).build();
AddressApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, get, operationResponse).getAddressApiForProject("myproject");
+ TOKEN_RESPONSE, get, operationResponse).getAddressApi("myproject");
assertEquals(api.getInRegion("us-central1", "test-ip1"),
new ParseAddressTest().expected());
@@ -64,7 +64,7 @@ public class AddressApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
AddressApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, get, operationResponse).getAddressApiForProject("myproject");
+ TOKEN_RESPONSE, get, operationResponse).getAddressApi("myproject");
assertNull(api.getInRegion("us-central1", "test-ip1"));
}
@@ -84,7 +84,7 @@ public class AddressApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
AddressApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
TOKEN_RESPONSE, insert,
- insertAddressResponse).getAddressApiForProject("myproject");
+ insertAddressResponse).getAddressApi("myproject");
assertEquals(api.createInRegion("us-central1", "test-ip1"), new ParseOperationTest().expected());
}
@@ -102,7 +102,7 @@ public class AddressApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
.payload(payloadFromResource("/region_operation.json")).build();
AddressApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, delete, deleteResponse).getAddressApiForProject("myproject");
+ TOKEN_RESPONSE, delete, deleteResponse).getAddressApi("myproject");
assertEquals(api.deleteInRegion("us-central1", "test-ip1"),
new ParseOperationTest().expected());
@@ -120,7 +120,7 @@ public class AddressApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
HttpResponse deleteResponse = HttpResponse.builder().statusCode(404).build();
AddressApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, delete, deleteResponse).getAddressApiForProject("myproject");
+ TOKEN_RESPONSE, delete, deleteResponse).getAddressApi("myproject");
assertNull(api.deleteInRegion("us-central1", "test-ip1"));
}
@@ -138,7 +138,7 @@ public class AddressApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
.payload(payloadFromResource("/address_list.json")).build();
AddressApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, list, operationResponse).getAddressApiForProject("myproject");
+ TOKEN_RESPONSE, list, operationResponse).getAddressApi("myproject");
assertEquals(api.listFirstPageInRegion("us-central1").toString(),
new ParseAddressListTest().expected().toString());
@@ -156,7 +156,7 @@ public class AddressApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
AddressApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, list, operationResponse).getAddressApiForProject("myproject");
+ TOKEN_RESPONSE, list, operationResponse).getAddressApi("myproject");
assertTrue(api.listInRegion("us-central1").concat().isEmpty());
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AddressApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AddressApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AddressApiLiveTest.java
index c11d04e..94f2521 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AddressApiLiveTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AddressApiLiveTest.java
@@ -35,7 +35,7 @@ public class AddressApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
private static final int TIME_WAIT = 30;
private AddressApi api() {
- return api.getAddressApiForProject(userProject.get());
+ return api.getAddressApi(userProject.get());
}
@Test(groups = "live")
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiExpectTest.java
index 83b716f..560f9e6 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiExpectTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiExpectTest.java
@@ -53,7 +53,7 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
.payload(payloadFromResource("/disk_get.json")).build();
DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, get, operationResponse).getDiskApiForProject("myproject");
+ TOKEN_RESPONSE, get, operationResponse).getDiskApi("myproject");
assertEquals(api.getInZone("us-central1-a", "testimage1"),
new ParseDiskTest().expected());
@@ -70,7 +70,7 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, get, operationResponse).getDiskApiForProject("myproject");
+ TOKEN_RESPONSE, get, operationResponse).getDiskApi("myproject");
assertNull(api.getInZone("us-central1-a", "testimage1"));
}
@@ -90,7 +90,7 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
TOKEN_RESPONSE, insert,
- insertDiskResponse).getDiskApiForProject("myproject");
+ insertDiskResponse).getDiskApi("myproject");
assertEquals(api.createInZone("testimage1", 1, "us-central1-a"), new ParseOperationTest().expected());
}
@@ -110,7 +110,7 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
TOKEN_RESPONSE, insert,
- insertDiskResponse).getDiskApiForProject("myproject");
+ insertDiskResponse).getDiskApi("myproject");
DiskCreationOptions diskCreationOptions = new DiskCreationOptions().sourceImage(URI.create(IMAGE_URL));
assertEquals(api.createInZone("testimage1", 1, "us-central1-a", diskCreationOptions), new ParseOperationTest().expected());
@@ -131,7 +131,7 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
TOKEN_RESPONSE, insert,
- insertDiskResponse).getDiskApiForProject("myproject");
+ insertDiskResponse).getDiskApi("myproject");
DiskCreationOptions diskCreationOptions = new DiskCreationOptions().type(URI.create(SSD_URL));
assertEquals(api.createInZone("testimage1", 1,
@@ -154,7 +154,7 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
TOKEN_RESPONSE, createSnapshotRequest,
- createSnapshotResponse).getDiskApiForProject("myproject");
+ createSnapshotResponse).getDiskApi("myproject");
assertEquals(api.createSnapshotInZone("us-central1-a", "testimage1", "test-snap"), new ParseOperationTest().expected());
}
@@ -175,7 +175,7 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
TOKEN_RESPONSE, createSnapshotRequest,
- createSnapshotResponse).getDiskApiForProject("myproject");
+ createSnapshotResponse).getDiskApi("myproject");
api.createSnapshotInZone("us-central1-a", "testimage1", "test-snap");
}
@@ -193,7 +193,7 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
.payload(payloadFromResource("/zone_operation.json")).build();
DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, delete, deleteResponse).getDiskApiForProject("myproject");
+ TOKEN_RESPONSE, delete, deleteResponse).getDiskApi("myproject");
assertEquals(api.deleteInZone("us-central1-a", "testimage1"),
new ParseOperationTest().expected());
@@ -211,7 +211,7 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
HttpResponse deleteResponse = HttpResponse.builder().statusCode(404).build();
DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, delete, deleteResponse).getDiskApiForProject("myproject");
+ TOKEN_RESPONSE, delete, deleteResponse).getDiskApi("myproject");
assertNull(api.deleteInZone("us-central1-a", "testimage1"));
}
@@ -229,7 +229,7 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
.payload(payloadFromResource("/disk_list.json")).build();
DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, list, operationResponse).getDiskApiForProject("myproject");
+ TOKEN_RESPONSE, list, operationResponse).getDiskApi("myproject");
assertEquals(api.listFirstPageInZone("us-central1-a").toString(),
new ParseDiskListTest().expected().toString());
@@ -247,7 +247,7 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, list, operationResponse).getDiskApiForProject("myproject");
+ TOKEN_RESPONSE, list, operationResponse).getDiskApi("myproject");
assertTrue(api.listInZone("us-central1-a").concat().isEmpty());
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiLiveTest.java
index 2d0afb4..3db43fc 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiLiveTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiLiveTest.java
@@ -40,7 +40,7 @@ public class DiskApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
public static final int sizeGb = 1;
private DiskApi api() {
- return api.getDiskApiForProject(userProject.get());
+ return api.getDiskApi(userProject.get());
}
@Test(groups = "live")
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiExpectTest.java
index 7a5759b..29e46db 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiExpectTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiExpectTest.java
@@ -65,7 +65,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
public void testGetFirewallResponseIs2xx() throws Exception {
FirewallApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, GET_FIREWALL_REQUEST, GET_FIREWALL_RESPONSE).getFirewallApiForProject("myproject");
+ TOKEN_RESPONSE, GET_FIREWALL_REQUEST, GET_FIREWALL_RESPONSE).getFirewallApi("myproject");
assertEquals(api.get("jclouds-test"), new ParseFirewallTest().expected());
}
@@ -112,7 +112,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
FirewallApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, get, operationResponse).getFirewallApiForProject("myproject");
+ TOKEN_RESPONSE, get, operationResponse).getFirewallApi("myproject");
assertNull(api.get("jclouds-test"));
}
@@ -138,7 +138,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
.payload(payloadFromResource("/operation.json")).build();
FirewallApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, request, insertFirewallResponse).getFirewallApiForProject("myproject");
+ TOKEN_RESPONSE, request, insertFirewallResponse).getFirewallApi("myproject");
assertEquals(api.createInNetwork("myfw", URI.create("https://www.googleapis" +
".com/compute/v1/projects/myproject/global/networks/default"),
@@ -174,7 +174,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
FirewallApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
TOKEN_RESPONSE, update,
- updateFirewallResponse).getFirewallApiForProject("myproject");
+ updateFirewallResponse).getFirewallApi("myproject");
assertEquals(api.update("myfw",
new FirewallOptions()
@@ -211,7 +211,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
FirewallApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
TOKEN_RESPONSE, update,
- updateFirewallResponse).getFirewallApiForProject("myproject");
+ updateFirewallResponse).getFirewallApi("myproject");
assertEquals(api.patch("myfw",
new FirewallOptions()
@@ -240,7 +240,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
.payload(payloadFromResource("/operation.json")).build();
FirewallApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, delete, deleteResponse).getFirewallApiForProject("myproject");
+ TOKEN_RESPONSE, delete, deleteResponse).getFirewallApi("myproject");
assertEquals(api.delete("default-allow-internal"),
new ParseOperationTest().expected());
@@ -258,7 +258,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
HttpResponse deleteResponse = HttpResponse.builder().statusCode(404).build();
FirewallApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, delete, deleteResponse).getFirewallApiForProject("myproject");
+ TOKEN_RESPONSE, delete, deleteResponse).getFirewallApi("myproject");
assertNull(api.delete("default-allow-internal"));
}
@@ -276,7 +276,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
.payload(payloadFromResource("/firewall_list.json")).build();
FirewallApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, list, operationResponse).getFirewallApiForProject("myproject");
+ TOKEN_RESPONSE, list, operationResponse).getFirewallApi("myproject");
assertEquals(api.listFirstPage().toString(),
new ParseFirewallListTest().expected().toString());
@@ -294,7 +294,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
FirewallApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, list, operationResponse).getFirewallApiForProject("myproject");
+ TOKEN_RESPONSE, list, operationResponse).getFirewallApi("myproject");
assertTrue(api.list().concat().isEmpty());
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiLiveTest.java
index 669046f..f390d9e 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiLiveTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiLiveTest.java
@@ -42,14 +42,14 @@ public class FirewallApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
private static final int TIME_WAIT = 30;
private FirewallApi api() {
- return api.getFirewallApiForProject(userProject.get());
+ return api.getFirewallApi(userProject.get());
}
@Test(groups = "live")
public void testInsertFirewall() {
- // need to create the network first
- assertGlobalOperationDoneSucessfully(api.getNetworkApiForProject(userProject.get()).createInIPv4Range
+ // need to insert the network first
+ assertGlobalOperationDoneSucessfully(api.getNetworkApi(userProject.get()).createInIPv4Range
(FIREWALL_NETWORK_NAME, IPV4_RANGE), TIME_WAIT);
FirewallOptions firewall = new FirewallOptions()
@@ -149,7 +149,7 @@ public class FirewallApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
public void testDeleteFirewall() {
assertGlobalOperationDoneSucessfully(api().delete(FIREWALL_NAME), TIME_WAIT);
- assertGlobalOperationDoneSucessfully(api.getNetworkApiForProject(userProject.get()).delete
+ assertGlobalOperationDoneSucessfully(api.getNetworkApi(userProject.get()).delete
(FIREWALL_NETWORK_NAME), TIME_WAIT);
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiExpectTest.java
new file mode 100644
index 0000000..f3f1c71
--- /dev/null
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiExpectTest.java
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecomputeengine.features;
+
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiExpectTest;
+import org.jclouds.googlecomputeengine.parse.ParseRegionOperationTest;
+import org.jclouds.googlecomputeengine.parse.ParseForwardingRuleListTest;
+import org.jclouds.googlecomputeengine.parse.ParseForwardingRuleTest;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.testng.annotations.Test;
+
+import javax.ws.rs.core.MediaType;
+
+import java.net.URI;
+
+import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE;
+import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_SCOPE;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.AssertJUnit.assertNull;
+
+@Test(groups = "unit")
+public class ForwardingRuleApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
+
+ public void testGetForwardingRuleResponseIs2xx() throws Exception {
+ HttpRequest get = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://www.googleapis" +
+ ".com/compute/v1/projects/myproject/regions/us-central1/forwardingRules/test-forwarding-rule")
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN).build();
+
+ HttpResponse operationResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/forwardingrule_get.json")).build();
+
+ ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
+ TOKEN_RESPONSE, get, operationResponse).getForwardingRuleApi("myproject", "us-central1");
+
+ assertEquals(api.get("test-forwarding-rule"),
+ new ParseForwardingRuleTest().expected());
+ }
+
+ public void testGetForwardingRuleResponseIs4xx() throws Exception {
+ HttpRequest get = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://www.googleapis" +
+ ".com/compute/v1/projects/myproject/regions/us-central1/forwardingRules/test-forwarding-rule")
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN).build();
+
+ HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
+
+ ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
+ TOKEN_RESPONSE, get, operationResponse).getForwardingRuleApi("myproject", "us-central1");
+
+ assertNull(api.get("test-forwarding-rule"));
+ }
+
+ public void testInsertForwardingRuleResponseIs2xx() {
+ HttpRequest insert = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/forwardingRules")
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN)
+ .payload(payloadFromResourceWithContentType("/forwardingrule_insert.json", MediaType.APPLICATION_JSON))
+ .build();
+
+ HttpResponse insertForwardingRuleResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/region_operation.json")).build();
+
+ ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
+ TOKEN_RESPONSE, insert,
+ insertForwardingRuleResponse).getForwardingRuleApi("myproject", "us-central1");
+ assertEquals(api.create("test-forwarding-rule",
+ URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/europe-west1/" +
+ "targetPools/test-target-pool")), new ParseRegionOperationTest().expected());
+ }
+
+ public void testDeleteForwardingRuleResponseIs2xx() {
+ HttpRequest delete = HttpRequest
+ .builder()
+ .method("DELETE")
+ .endpoint("https://www.googleapis" +
+ ".com/compute/v1/projects/myproject/regions/us-central1/forwardingRules/test-forwarding-rule")
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN).build();
+
+ HttpResponse deleteResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/region_operation.json")).build();
+
+ ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
+ TOKEN_RESPONSE, delete, deleteResponse).getForwardingRuleApi("myproject", "us-central1");
+
+ assertEquals(api.delete("test-forwarding-rule"),
+ new ParseRegionOperationTest().expected());
+ }
+
+ public void testDeleteForwardingRuleResponseIs4xx() {
+ HttpRequest delete = HttpRequest
+ .builder()
+ .method("DELETE")
+ .endpoint("https://www.googleapis" +
+ ".com/compute/v1/projects/myproject/regions/us-central1/forwardingRules/test-targetPool")
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN).build();
+
+ HttpResponse deleteResponse = HttpResponse.builder().statusCode(404).build();
+
+ ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
+ TOKEN_RESPONSE, delete, deleteResponse).getForwardingRuleApi("myproject", "us-central1");
+
+ assertNull(api.delete("test-targetPool"));
+ }
+
+ public void testListForwardingRulesResponseIs2xx() {
+ HttpRequest list = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/forwardingRules")
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN).build();
+
+ HttpResponse operationResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/forwardingrule_list.json")).build();
+
+ ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
+ TOKEN_RESPONSE, list, operationResponse).getForwardingRuleApi("myproject", "us-central1");
+
+ assertEquals(api.list().toString(),
+ new ParseForwardingRuleListTest().expected().toString());
+ }
+
+ public void testListForwardingRulesResponseIs4xx() {
+ HttpRequest list = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/forwardingRules")
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN).build();
+
+ HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
+
+ ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
+ TOKEN_RESPONSE, list, operationResponse).getForwardingRuleApi("myproject", "us-central1");
+
+ assertTrue(api.list().concat().isEmpty());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiLiveTest.java
new file mode 100644
index 0000000..833d455
--- /dev/null
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiLiveTest.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecomputeengine.features;
+
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.googlecomputeengine.domain.ForwardingRule;
+import org.jclouds.googlecomputeengine.domain.TargetPool;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiLiveTest;
+import org.jclouds.googlecomputeengine.options.ListOptions;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+public class ForwardingRuleApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
+
+ private static final String FORWARDING_RULE_NAME = "forwarding-rule-api-live-test";
+ private static final String TARGETPOOL_NAME = "forwarding-rule-api-live-test-targetpool";
+ private static final int TIME_WAIT = 30;
+ private TargetPool targetPool;
+
+ /**
+ * The API under test
+ * @return
+ */
+ private ForwardingRuleApi api() {
+ return api.getForwardingRuleApi(userProject.get(), DEFAULT_REGION_NAME);
+ }
+
+ private TargetPoolApi targetPoolApi() {
+ return api.getTargetPoolApi(userProject.get(), DEFAULT_REGION_NAME);
+ }
+
+ @BeforeClass
+ public void init() {
+ assertRegionOperationDoneSucessfully(targetPoolApi().create(TARGETPOOL_NAME), TIME_WAIT);
+ targetPool = targetPoolApi().get(TARGETPOOL_NAME);
+ }
+
+ @AfterClass
+ public void tearDown() {
+ assertRegionOperationDoneSucessfully(targetPoolApi().delete(TARGETPOOL_NAME), TIME_WAIT);
+ }
+
+ @Test(groups = "live")
+ public void testInsertForwardingRule() {
+ assertRegionOperationDoneSucessfully(api().create(FORWARDING_RULE_NAME, targetPool.getSelfLink()), TIME_WAIT);
+ }
+
+ @Test(groups = "live", dependsOnMethods = "testInsertForwardingRule")
+ public void testGetForwardingRule() {
+ ForwardingRule forwardingRule = api().get(FORWARDING_RULE_NAME);
+ assertNotNull(forwardingRule);
+ assertEquals(forwardingRule.getName(), FORWARDING_RULE_NAME);
+ }
+
+ @Test(groups = "live", dependsOnMethods = "testGetForwardingRule")
+ public void testListForwardingRule() {
+
+ IterableWithMarker<ForwardingRule> forwardingRule = api().list(new ListOptions.Builder()
+ .filter("name eq " + FORWARDING_RULE_NAME));
+ assertEquals(forwardingRule.toList().size(), 1);
+ }
+
+ @Test(groups = "live", dependsOnMethods = "testListForwardingRule")
+ public void testDeleteForwardingRule() {
+ assertRegionOperationDoneSucessfully(api().delete(FORWARDING_RULE_NAME), TIME_WAIT);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalOperationApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalOperationApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalOperationApiExpectTest.java
index 7fac1d7..bf4aa21 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalOperationApiExpectTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalOperationApiExpectTest.java
@@ -49,7 +49,7 @@ public class GlobalOperationApiExpectTest extends BaseGoogleComputeEngineApiExpe
public void testGetOperationResponseIs2xx() throws Exception {
GlobalOperationApi operationApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, GET_GLOBAL_OPERATION_REQUEST, GET_GLOBAL_OPERATION_RESPONSE).getGlobalOperationApiForProject("myproject");
+ TOKEN_RESPONSE, GET_GLOBAL_OPERATION_REQUEST, GET_GLOBAL_OPERATION_RESPONSE).getGlobalOperationApi("myproject");
assertEquals(operationApi.get("operation-1354084865060-4cf88735faeb8-bbbb12cb"),
new ParseOperationTest().expected());
@@ -60,7 +60,7 @@ public class GlobalOperationApiExpectTest extends BaseGoogleComputeEngineApiExpe
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
GlobalOperationApi globalOperationApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, GET_GLOBAL_OPERATION_REQUEST, operationResponse).getGlobalOperationApiForProject("myproject");
+ TOKEN_RESPONSE, GET_GLOBAL_OPERATION_REQUEST, operationResponse).getGlobalOperationApi("myproject");
assertNull(globalOperationApi.get("operation-1354084865060-4cf88735faeb8-bbbb12cb"));
}
@@ -75,7 +75,7 @@ public class GlobalOperationApiExpectTest extends BaseGoogleComputeEngineApiExpe
HttpResponse operationResponse = HttpResponse.builder().statusCode(204).build();
GlobalOperationApi globalOperationApi = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, delete, operationResponse).getGlobalOperationApiForProject("myproject");
+ TOKEN_RESPONSE, delete, operationResponse).getGlobalOperationApi("myproject");
globalOperationApi.delete("operation-1352178598164-4cdcc9d031510-4aa46279");
}
@@ -90,7 +90,7 @@ public class GlobalOperationApiExpectTest extends BaseGoogleComputeEngineApiExpe
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
GlobalOperationApi globalOperationApi = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, delete, operationResponse).getGlobalOperationApiForProject("myproject");
+ TOKEN_RESPONSE, delete, operationResponse).getGlobalOperationApi("myproject");
globalOperationApi.delete("operation-1352178598164-4cdcc9d031510-4aa46279");
}
@@ -107,7 +107,7 @@ public class GlobalOperationApiExpectTest extends BaseGoogleComputeEngineApiExpe
.payload(payloadFromResource("/global_operation_list.json")).build();
GlobalOperationApi globalOperationApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, get, operationResponse).getGlobalOperationApiForProject("myproject");
+ TOKEN_RESPONSE, get, operationResponse).getGlobalOperationApi("myproject");
assertEquals(globalOperationApi.listFirstPage().toString(),
new ParseOperationListTest().expected().toString());
@@ -130,7 +130,7 @@ public class GlobalOperationApiExpectTest extends BaseGoogleComputeEngineApiExpe
.payload(payloadFromResource("/global_operation_list.json")).build();
GlobalOperationApi globalOperationApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, get, operationResponse).getGlobalOperationApiForProject("myproject");
+ TOKEN_RESPONSE, get, operationResponse).getGlobalOperationApi("myproject");
assertEquals(globalOperationApi.listAtMarker("CglPUEVSQVRJT04SOzU5MDQyMTQ4Nzg1Mi5vcGVyYXRpb24tMTM1Mj" +
"I0NDI1ODAzMC00Y2RkYmU2YTJkNmIwLWVkMzIyMzQz",
@@ -149,7 +149,7 @@ public class GlobalOperationApiExpectTest extends BaseGoogleComputeEngineApiExpe
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
GlobalOperationApi globalOperationApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, get, operationResponse).getGlobalOperationApiForProject("myproject");
+ TOKEN_RESPONSE, get, operationResponse).getGlobalOperationApi("myproject");
assertTrue(globalOperationApi.list().concat().isEmpty());
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalOperationApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalOperationApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalOperationApiLiveTest.java
index 704df02..010fcac 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalOperationApiLiveTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalOperationApiLiveTest.java
@@ -41,13 +41,13 @@ public class GlobalOperationApiLiveTest extends BaseGoogleComputeEngineApiLiveTe
private Operation deleteOperation;
private GlobalOperationApi api() {
- return api.getGlobalOperationApiForProject(userProject.get());
+ return api.getGlobalOperationApi(userProject.get());
}
@Test(groups = "live")
public void testCreateOperations() {
- //create some operations by adding and deleting metadata items
+ //insert some operations by adding and deleting metadata items
// this will make sure there is stuff to listFirstPage
addOperation = assertGlobalOperationDoneSucessfully(addItemToMetadata(api.getProjectApi(),
userProject.get(), METADATA_ITEM_KEY, METADATA_ITEM_VALUE), 20);
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiExpectTest.java
new file mode 100644
index 0000000..906c685
--- /dev/null
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiExpectTest.java
@@ -0,0 +1,177 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecomputeengine.features;
+
+import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE;
+import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_SCOPE;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.AssertJUnit.assertNull;
+
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiExpectTest;
+import org.jclouds.googlecomputeengine.parse.ParseHttpHealthCheckListTest;
+import org.jclouds.googlecomputeengine.parse.ParseHttpHealthCheckTest;
+import org.jclouds.googlecomputeengine.parse.ParseRegionOperationTest;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit")
+public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
+
+ public void testGetHttpHealthCheckResponseIs2xx() throws Exception {
+ HttpRequest get = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/global/httpHealthChecks/http-health-check-api-live-test")
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN).build();
+
+ HttpResponse operationResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/httphealthcheck_get.json")).build();
+
+ HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
+ TOKEN_RESPONSE, get, operationResponse).getHttpHealthCheckApi("myproject");
+
+ assertEquals(api.get("http-health-check-api-live-test"),
+ new ParseHttpHealthCheckTest().expected());
+ }
+
+ public void testGetHttpHealthCheckResponseIs4xx() throws Exception {
+ HttpRequest get = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/global/httpHealthChecks/http-health-check-test")
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN).build();
+
+ HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
+
+ HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
+ TOKEN_RESPONSE, get, operationResponse).getHttpHealthCheckApi("myproject");
+
+ assertNull(api.get("http-health-check-test"));
+ }
+
+ public void testInsertHttpHealthCheckResponseIs2xx() {
+ HttpRequest insert = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/global/httpHealthChecks")
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN)
+ .payload(payloadFromResourceWithContentType("/httphealthcheck_insert.json", MediaType.APPLICATION_JSON))
+ .build();
+
+ HttpResponse insertHttpHealthCheckResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/global_operation.json")).build();
+
+ HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
+ TOKEN_RESPONSE, insert,
+ insertHttpHealthCheckResponse).getHttpHealthCheckApi("myproject");
+ assertEquals(api.insert("http-health-check", 0, 0), new ParseRegionOperationTest().expected());
+ }
+
+ public void testInsertHttpHealthCheckResponseIs4xx() {
+ HttpRequest create = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/global/httpHealthChecks")
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN)
+ .payload(payloadFromResourceWithContentType("/httphealthcheck_insert.json", MediaType.APPLICATION_JSON))
+ .build();
+
+ HttpResponse insertHttpHealthCheckResponse = HttpResponse.builder().statusCode(404).build();
+
+ HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
+ TOKEN_RESPONSE, create, insertHttpHealthCheckResponse).getHttpHealthCheckApi("myproject");
+
+ assertNull(api.insert("http-health-check", 0, 0));
+ }
+
+ public void testDeleteHttpHealthCheckResponseIs2xx() {
+ HttpRequest delete = HttpRequest
+ .builder()
+ .method("DELETE")
+ .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/global/httpHealthChecks/http-health-check")
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN).build();
+
+ HttpResponse deleteResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/global_operation.json")).build();
+
+ HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
+ TOKEN_RESPONSE, delete, deleteResponse).getHttpHealthCheckApi("myproject");
+
+ assertEquals(api.delete("http-health-check"),
+ new ParseRegionOperationTest().expected());
+ }
+
+ public void testDeleteHttpHealthCheckResponseIs4xx() {
+ HttpRequest delete = HttpRequest
+ .builder()
+ .method("DELETE")
+ .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/global/httpHealthChecks/http-health-check")
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN).build();
+
+ HttpResponse deleteResponse = HttpResponse.builder().statusCode(404).build();
+
+ HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
+ TOKEN_RESPONSE, delete, deleteResponse).getHttpHealthCheckApi("myproject");
+
+ assertNull(api.delete("http-health-check"));
+ }
+
+ public void testListHttpHealthChecksResponseIs2xx() {
+ HttpRequest list = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/global/httpHealthChecks")
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN).build();
+
+ HttpResponse operationResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/httphealthcheck_list.json")).build();
+
+ HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
+ TOKEN_RESPONSE, list, operationResponse).getHttpHealthCheckApi("myproject");
+
+ assertEquals(api.list().toString(),
+ new ParseHttpHealthCheckListTest().expected().toString());
+ }
+
+ public void testListHttpHealthChecksResponseIs4xx() {
+ HttpRequest list = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/global/httpHealthChecks")
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN).build();
+
+ HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
+
+ HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
+ TOKEN_RESPONSE, list, operationResponse).getHttpHealthCheckApi("myproject");
+
+ assertTrue(api.list().concat().isEmpty());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiLiveTest.java
new file mode 100644
index 0000000..9adcd4d
--- /dev/null
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiLiveTest.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecomputeengine.features;
+
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.googlecomputeengine.domain.HttpHealthCheck;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiLiveTest;
+import org.jclouds.googlecomputeengine.options.ListOptions;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+public class HttpHealthCheckApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
+
+ private static final String HTTP_HEALTH_CHECK_NAME = "http-health-check-api-live-test";
+ private static final int TIME_WAIT = 60;
+
+ private HttpHealthCheckApi api() {
+ return api.getHttpHealthCheckApi(userProject.get());
+ }
+
+ @Test(groups = "live")
+ public void testInsertHttpHealthCheck() {
+ assertGlobalOperationDoneSucessfully(api().insert(HTTP_HEALTH_CHECK_NAME), TIME_WAIT);
+ }
+
+ @Test(groups = "live", dependsOnMethods = "testInsertHttpHealthCheck")
+ public void testGetHttpHealthCheck() {
+ HttpHealthCheck httpHealthCheck = api().get(HTTP_HEALTH_CHECK_NAME);
+ assertNotNull(httpHealthCheck);
+ assertEquals(httpHealthCheck.getName(), HTTP_HEALTH_CHECK_NAME);
+ }
+
+ @Test(groups = "live", dependsOnMethods = "testGetHttpHealthCheck")
+ public void testListHttpHealthCheck() {
+ IterableWithMarker<HttpHealthCheck> httpHealthCheck = api().list(new ListOptions.Builder()
+ .filter("name eq " + HTTP_HEALTH_CHECK_NAME));
+ assertEquals(httpHealthCheck.toList().size(), 1);
+ }
+
+ @Test(groups = "live", dependsOnMethods = "testListHttpHealthCheck")
+ public void testDeleteHttpHealthCheck() {
+ assertGlobalOperationDoneSucessfully(api().delete(HTTP_HEALTH_CHECK_NAME), TIME_WAIT);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiExpectTest.java
index 0665e1b..c1781f1 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiExpectTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiExpectTest.java
@@ -79,7 +79,7 @@ public class ImageApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
.payload(payloadFromResource("/image_get.json")).build();
ImageApi imageApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, get, operationResponse).getImageApiForProject("centos-cloud");
+ TOKEN_RESPONSE, get, operationResponse).getImageApi("centos-cloud");
assertEquals(imageApi.get("centos-6-2-v20120326"),
new ParseImageTest().expected());
@@ -97,7 +97,7 @@ public class ImageApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
ImageApi imageApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, get, operationResponse).getImageApiForProject("centos-cloud");
+ TOKEN_RESPONSE, get, operationResponse).getImageApi("centos-cloud");
assertNull(imageApi.get("centos-6-2-v20120326"));
}
@@ -115,7 +115,7 @@ public class ImageApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
.payload(payloadFromResource("/operation.json")).build();
ImageApi imageApi = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, delete, deleteResponse).getImageApiForProject("myproject");
+ TOKEN_RESPONSE, delete, deleteResponse).getImageApi("myproject");
assertEquals(imageApi.delete("centos-6-2-v20120326"),
new ParseOperationTest().expected());
@@ -133,7 +133,7 @@ public class ImageApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
HttpResponse deleteResponse = HttpResponse.builder().statusCode(404).build();
ImageApi imageApi = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, delete, deleteResponse).getImageApiForProject("myproject");
+ TOKEN_RESPONSE, delete, deleteResponse).getImageApi("myproject");
assertNull(imageApi.delete("centos-6-2-v20120326"));
}
@@ -141,7 +141,7 @@ public class ImageApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
public void testListImagesResponseIs2xx() {
ImageApi imageApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, LIST_PROJECT_IMAGES_REQUEST, LIST_PROJECT_IMAGES_RESPONSE).getImageApiForProject
+ TOKEN_RESPONSE, LIST_PROJECT_IMAGES_REQUEST, LIST_PROJECT_IMAGES_RESPONSE).getImageApi
("myproject");
assertEquals(imageApi.listFirstPage().toString(),
@@ -153,7 +153,7 @@ public class ImageApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
ImageApi imageApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, LIST_PROJECT_IMAGES_REQUEST, operationResponse).getImageApiForProject("myproject");
+ TOKEN_RESPONSE, LIST_PROJECT_IMAGES_REQUEST, operationResponse).getImageApi("myproject");
assertTrue(imageApi.list().concat().isEmpty());
}
@@ -173,7 +173,7 @@ public class ImageApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
.payload(payloadFromResource("/operation.json")).build();
ImageApi imageApi = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, createImage, createImageResponse).getImageApiForProject("myproject");
+ TOKEN_RESPONSE, createImage, createImageResponse).getImageApi("myproject");
assertEquals(imageApi.createImageFromPD("my-image", "https://www.googleapis.com/" +
"compute/v1/projects/myproject/zones/us-central1-a/disks/mydisk"),
@@ -195,7 +195,7 @@ public class ImageApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
HttpResponse createImageResponse = HttpResponse.builder().statusCode(404).build();
ImageApi imageApi = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, createImage, createImageResponse).getImageApiForProject("myproject");
+ TOKEN_RESPONSE, createImage, createImageResponse).getImageApi("myproject");
imageApi.createImageFromPD("my-image", "https://www.googleapis.com/" +
"compute/v1/projects/myproject/zones/us-central1-a/disks/mydisk");
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiLiveTest.java
index 9c9ca55..c8a8cd7 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiLiveTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiLiveTest.java
@@ -47,15 +47,15 @@ public class ImageApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
private URI diskURI;
private ImageApi api() {
- return api.getImageApiForProject("centos-cloud");
+ return api.getImageApi("centos-cloud");
}
private ImageApi imageApi(){
- return api.getImageApiForProject(userProject.get());
+ return api.getImageApi(userProject.get());
}
private DiskApi diskApi() {
- return api.getDiskApiForProject(userProject.get());
+ return api.getDiskApi(userProject.get());
}
@Test(groups = "live")
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiExpectTest.java
index bb681c7..4e66f85 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiExpectTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiExpectTest.java
@@ -92,7 +92,7 @@ public class InstanceApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
InstanceApi api = requestsSendResponses(
requestForScopes(COMPUTE_READONLY_SCOPE), TOKEN_RESPONSE,
- GET_INSTANCE_REQUEST, GET_INSTANCE_RESPONSE).getInstanceApiForProject("myproject");
+ GET_INSTANCE_REQUEST, GET_INSTANCE_RESPONSE).getInstanceApi("myproject");
assertEquals(api.getInZone("us-central1-a", "test-1"), new ParseInstanceTest().expected());
}
@@ -102,7 +102,7 @@ public class InstanceApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
InstanceApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, GET_INSTANCE_REQUEST, operationResponse).getInstanceApiForProject("myproject");
+ TOKEN_RESPONSE, GET_INSTANCE_REQUEST, operationResponse).getInstanceApi("myproject");
assertNull(api.getInZone("us-central1-a", "test-1"));
}
@@ -121,7 +121,7 @@ public class InstanceApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
InstanceApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, get, operationResponse).getInstanceApiForProject("myproject");
+ TOKEN_RESPONSE, get, operationResponse).getInstanceApi("myproject");
assertEquals(api.getSerialPortOutputInZone("us-central1-a", "test-1"), new ParseInstanceSerialOutputTest().expected());
}
@@ -140,7 +140,7 @@ public class InstanceApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
TOKEN_RESPONSE, GET_PROJECT_REQUEST, GET_PROJECT_RESPONSE,
requestForScopes(COMPUTE_SCOPE),
TOKEN_RESPONSE, insert,
- CREATE_INSTANCE_RESPONSE)).getInstanceApiForProject("myproject");
+ CREATE_INSTANCE_RESPONSE)).getInstanceApi("myproject");
InstanceTemplate options = InstanceTemplate.builder().forMachineType("us-central1-a/n1-standard-1")
.addNetworkInterface(URI.create("https://www.googleapis" +
@@ -165,7 +165,7 @@ public class InstanceApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
InstanceApi api = requestsSendResponses(ImmutableMap.of(requestForScopes(COMPUTE_READONLY_SCOPE),
TOKEN_RESPONSE, GET_PROJECT_REQUEST, GET_PROJECT_RESPONSE,
requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, insert, insertInstanceResponse)).getInstanceApiForProject("myproject");
+ TOKEN_RESPONSE, insert, insertInstanceResponse)).getInstanceApi("myproject");
InstanceTemplate options = InstanceTemplate.builder().forMachineType("us-central1-a/n1-standard-1")
.addNetworkInterface(URI.create("https://www.googleapis" +
@@ -194,7 +194,7 @@ public class InstanceApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
.payload(payloadFromResource("/zone_operation.json")).build();
InstanceApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, delete, deleteResponse).getInstanceApiForProject("myproject");
+ TOKEN_RESPONSE, delete, deleteResponse).getInstanceApi("myproject");
assertEquals(api.deleteInZone("us-central1-a", "test-1"),
new ParseOperationTest().expected());
@@ -212,7 +212,7 @@ public class InstanceApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
HttpResponse deleteResponse = HttpResponse.builder().statusCode(404).build();
InstanceApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, delete, deleteResponse).getInstanceApiForProject("myproject");
+ TOKEN_RESPONSE, delete, deleteResponse).getInstanceApi("myproject");
assertNull(api.deleteInZone("us-central1-a", "test-1"));
}
@@ -221,7 +221,7 @@ public class InstanceApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
InstanceApi api = requestsSendResponses(
requestForScopes(COMPUTE_READONLY_SCOPE), TOKEN_RESPONSE,
- LIST_INSTANCES_REQUEST, LIST_INSTANCES_RESPONSE).getInstanceApiForProject("myproject");
+ LIST_INSTANCES_REQUEST, LIST_INSTANCES_RESPONSE).getInstanceApi("myproject");
assertEquals(api.listFirstPageInZone("us-central1-a").toString(),
new ParseInstanceListTest().expected().toString());
@@ -239,7 +239,7 @@ public class InstanceApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
InstanceApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, list, operationResponse).getInstanceApiForProject("myproject");
+ TOKEN_RESPONSE, list, operationResponse).getInstanceApi("myproject");
assertTrue(api.listInZone("us-central1-a").concat().isEmpty());
}
@@ -259,7 +259,7 @@ public class InstanceApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
.payload(payloadFromResource("/zone_operation.json")).build();
InstanceApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, setMetadata, setMetadataResponse).getInstanceApiForProject("myproject");
+ TOKEN_RESPONSE, setMetadata, setMetadataResponse).getInstanceApi("myproject");
assertEquals(api.setMetadataInZone("us-central1-a", "test-1", ImmutableMap.of("foo", "bar"), "efgh"),
new ParseOperationTest().expected());
@@ -280,7 +280,7 @@ public class InstanceApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
HttpResponse setMetadataResponse = HttpResponse.builder().statusCode(404).build();
InstanceApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, setMetadata, setMetadataResponse).getInstanceApiForProject("myproject");
+ TOKEN_RESPONSE, setMetadata, setMetadataResponse).getInstanceApi("myproject");
api.setMetadataInZone("us-central1-a", "test-1", ImmutableMap.of("foo", "bar"), "efgh");
}
@@ -300,7 +300,7 @@ public class InstanceApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
.payload(payloadFromResource("/zone_operation.json")).build();
InstanceApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, setTags, setTagsResponse).getInstanceApiForProject("myproject");
+ TOKEN_RESPONSE, setTags, setTagsResponse).getInstanceApi("myproject");
assertEquals(api.setTagsInZone("us-central1-a", "test-1", ImmutableSet.of("foo", "bar"), "efgh"),
new ParseOperationTest().expected());
@@ -321,7 +321,7 @@ public class InstanceApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
HttpResponse setTagsResponse = HttpResponse.builder().statusCode(404).build();
InstanceApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, setTags, setTagsResponse).getInstanceApiForProject("myproject");
+ TOKEN_RESPONSE, setTags, setTagsResponse).getInstanceApi("myproject");
api.setTagsInZone("us-central1-a", "test-1", ImmutableSet.of("foo", "bar"), "efgh");
}
@@ -339,7 +339,7 @@ public class InstanceApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
.payload(payloadFromResource("/zone_operation.json")).build();
InstanceApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, reset, resetResponse).getInstanceApiForProject("myproject");
+ TOKEN_RESPONSE, reset, resetResponse).getInstanceApi("myproject");
assertEquals(api.resetInZone("us-central1-a", "test-1"),
new ParseOperationTest().expected());
@@ -358,7 +358,7 @@ public class InstanceApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
HttpResponse resetResponse = HttpResponse.builder().statusCode(404).build();
InstanceApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, reset, resetResponse).getInstanceApiForProject("myproject");
+ TOKEN_RESPONSE, reset, resetResponse).getInstanceApi("myproject");
api.resetInZone("us-central1-a", "test-1");
}
@@ -378,7 +378,7 @@ public class InstanceApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
.payload(payloadFromResource("/zone_operation.json")).build();
InstanceApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, attach, attachResponse).getInstanceApiForProject("myproject");
+ TOKEN_RESPONSE, attach, attachResponse).getInstanceApi("myproject");
assertEquals(api.attachDiskInZone("us-central1-a", "test-1",
new AttachDiskOptions()
@@ -403,7 +403,7 @@ public class InstanceApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
HttpResponse attachResponse = HttpResponse.builder().statusCode(404).build();
InstanceApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, attach, attachResponse).getInstanceApiForProject("myproject");
+ TOKEN_RESPONSE, attach, attachResponse).getInstanceApi("myproject");
api.attachDiskInZone("us-central1-a", "test-1",
new AttachDiskOptions()
@@ -428,7 +428,7 @@ public class InstanceApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
.payload(payloadFromResource("/zone_operation.json")).build();
InstanceApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, detach, detachResponse).getInstanceApiForProject("myproject");
+ TOKEN_RESPONSE, detach, detachResponse).getInstanceApi("myproject");
assertEquals(api.detachDiskInZone("us-central1-a", "test-1", "test-disk-1"),
new ParseOperationTest().expected());
@@ -449,7 +449,7 @@ public class InstanceApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
HttpResponse detachResponse = HttpResponse.builder().statusCode(404).build();
InstanceApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, detach, detachResponse).getInstanceApiForProject("myproject");
+ TOKEN_RESPONSE, detach, detachResponse).getInstanceApi("myproject");
api.detachDiskInZone("us-central1-a", "test-1", "test-disk-1");
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
index dd3981e..13af8f2 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
@@ -70,7 +70,7 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
@Override
protected GoogleComputeEngineApi create(Properties props, Iterable<Module> modules) {
GoogleComputeEngineApi api = super.create(props, modules);
- URI imageUri = api.getImageApiForProject("centos-cloud")
+ URI imageUri = api.getImageApi("centos-cloud")
.list(new ListOptions.Builder().filter("name eq centos.*"))
.concat()
.filter(new Predicate<Image>() {
@@ -98,22 +98,22 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
}
private InstanceApi api() {
- return api.getInstanceApiForProject(userProject.get());
+ return api.getInstanceApi(userProject.get());
}
private DiskApi diskApi() {
- return api.getDiskApiForProject(userProject.get());
+ return api.getDiskApi(userProject.get());
}
@Test(groups = "live")
public void testInsertInstance() {
- // need to create the network first
- assertGlobalOperationDoneSucessfully(api.getNetworkApiForProject(userProject.get()).createInIPv4Range
+ // need to insert the network first
+ assertGlobalOperationDoneSucessfully(api.getNetworkApi(userProject.get()).createInIPv4Range
(INSTANCE_NETWORK_NAME, IPV4_RANGE), TIME_WAIT);
DiskCreationOptions diskCreationOptions = new DiskCreationOptions().sourceImage(instance.getImage());
- assertZoneOperationDoneSucessfully(api.getDiskApiForProject(userProject.get())
+ assertZoneOperationDoneSucessfully(api.getDiskApi(userProject.get())
.createInZone(BOOT_DISK_NAME, DEFAULT_DISK_SIZE_GB, DEFAULT_ZONE_NAME, diskCreationOptions),
TIME_WAIT);
@@ -225,11 +225,11 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
public void testDeleteInstance() {
assertZoneOperationDoneSucessfully(api().deleteInZone(DEFAULT_ZONE_NAME, INSTANCE_NAME), TIME_WAIT);
- assertZoneOperationDoneSucessfully(api.getDiskApiForProject(userProject.get()).deleteInZone(DEFAULT_ZONE_NAME, DISK_NAME),
+ assertZoneOperationDoneSucessfully(api.getDiskApi(userProject.get()).deleteInZone(DEFAULT_ZONE_NAME, DISK_NAME),
TIME_WAIT);
- assertZoneOperationDoneSucessfully(api.getDiskApiForProject(userProject.get()).deleteInZone(DEFAULT_ZONE_NAME, BOOT_DISK_NAME),
+ assertZoneOperationDoneSucessfully(api.getDiskApi(userProject.get()).deleteInZone(DEFAULT_ZONE_NAME, BOOT_DISK_NAME),
TIME_WAIT);
- assertGlobalOperationDoneSucessfully(api.getNetworkApiForProject(userProject.get()).delete
+ assertGlobalOperationDoneSucessfully(api.getNetworkApi(userProject.get()).delete
(INSTANCE_NETWORK_NAME), TIME_WAIT);
}
@@ -242,11 +242,11 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
protected void tearDownContext() {
try {
waitZoneOperationDone(api().deleteInZone(DEFAULT_ZONE_NAME, INSTANCE_NAME), TIME_WAIT);
- waitZoneOperationDone(api.getDiskApiForProject(userProject.get()).deleteInZone(DEFAULT_ZONE_NAME, DISK_NAME),
+ waitZoneOperationDone(api.getDiskApi(userProject.get()).deleteInZone(DEFAULT_ZONE_NAME, DISK_NAME),
TIME_WAIT);
- waitZoneOperationDone(api.getDiskApiForProject(userProject.get()).deleteInZone(DEFAULT_ZONE_NAME, BOOT_DISK_NAME),
+ waitZoneOperationDone(api.getDiskApi(userProject.get()).deleteInZone(DEFAULT_ZONE_NAME, BOOT_DISK_NAME),
TIME_WAIT);
- waitGlobalOperationDone(api.getNetworkApiForProject(userProject.get()).delete
+ waitGlobalOperationDone(api.getNetworkApi(userProject.get()).delete
(INSTANCE_NETWORK_NAME), TIME_WAIT);
} catch (Exception e) {
// we don't really care about any exception here, so just delete away.
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/MachineTypeApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/MachineTypeApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/MachineTypeApiExpectTest.java
index 35dec08..31bfdea 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/MachineTypeApiExpectTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/MachineTypeApiExpectTest.java
@@ -68,7 +68,7 @@ public class MachineTypeApiExpectTest extends BaseGoogleComputeEngineApiExpectTe
.payload(payloadFromResource("/machinetype.json")).build();
MachineTypeApi machineTypeApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, get, operationResponse).getMachineTypeApiForProject("myproject");
+ TOKEN_RESPONSE, get, operationResponse).getMachineTypeApi("myproject");
assertEquals(machineTypeApi.getInZone("us-central1-a", "n1-standard-1"),
new ParseMachineTypeTest().expected());
@@ -86,7 +86,7 @@ public class MachineTypeApiExpectTest extends BaseGoogleComputeEngineApiExpectTe
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
MachineTypeApi machineTypeApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, get, operationResponse).getMachineTypeApiForProject("myproject");
+ TOKEN_RESPONSE, get, operationResponse).getMachineTypeApi("myproject");
assertNull(machineTypeApi.getInZone("us-central1-a", "n1-standard-1"));
}
@@ -94,7 +94,7 @@ public class MachineTypeApiExpectTest extends BaseGoogleComputeEngineApiExpectTe
public void testListMachineTypeNoOptionsResponseIs2xx() throws Exception {
MachineTypeApi machineTypeApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, LIST_MACHINE_TYPES_REQUEST, LIST_MACHINE_TYPES_RESPONSE).getMachineTypeApiForProject
+ TOKEN_RESPONSE, LIST_MACHINE_TYPES_REQUEST, LIST_MACHINE_TYPES_RESPONSE).getMachineTypeApi
("myproject");
assertEquals(machineTypeApi.listFirstPageInZone("us-central1-a").toString(),
@@ -106,7 +106,7 @@ public class MachineTypeApiExpectTest extends BaseGoogleComputeEngineApiExpectTe
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
MachineTypeApi machineTypeApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, LIST_MACHINE_TYPES_REQUEST, operationResponse).getMachineTypeApiForProject("myproject");
+ TOKEN_RESPONSE, LIST_MACHINE_TYPES_REQUEST, operationResponse).getMachineTypeApi("myproject");
assertTrue(machineTypeApi.listInZone("us-central1-a").concat().isEmpty());
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/MachineTypeApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/MachineTypeApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/MachineTypeApiLiveTest.java
index d9d00a1..2e43eab 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/MachineTypeApiLiveTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/MachineTypeApiLiveTest.java
@@ -39,7 +39,7 @@ public class MachineTypeApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
private MachineType machineType;
private MachineTypeApi api() {
- return api.getMachineTypeApiForProject(userProject.get());
+ return api.getMachineTypeApi(userProject.get());
}
@Test(groups = "live")
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/NetworkApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/NetworkApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/NetworkApiExpectTest.java
index 1b2d73b..69852f1 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/NetworkApiExpectTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/NetworkApiExpectTest.java
@@ -48,7 +48,7 @@ public class NetworkApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
public void testGetNetworkResponseIs2xx() throws Exception {
NetworkApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, GET_NETWORK_REQUEST, GET_NETWORK_RESPONSE).getNetworkApiForProject("myproject");
+ TOKEN_RESPONSE, GET_NETWORK_REQUEST, GET_NETWORK_RESPONSE).getNetworkApi("myproject");
assertEquals(api.get("jclouds-test"),
new ParseNetworkTest().expected());
@@ -65,7 +65,7 @@ public class NetworkApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
NetworkApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, get, operationResponse).getNetworkApiForProject("myproject");
+ TOKEN_RESPONSE, get, operationResponse).getNetworkApi("myproject");
assertNull(api.get("jclouds-test"));
}
@@ -85,7 +85,7 @@ public class NetworkApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
NetworkApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
TOKEN_RESPONSE, insert,
- insertNetworkResponse).getNetworkApiForProject("myproject");
+ insertNetworkResponse).getNetworkApi("myproject");
assertEquals(api.createInIPv4Range("test-network", "10.0.0.0/8"), new ParseOperationTest().expected());
}
@@ -103,7 +103,7 @@ public class NetworkApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
.payload(payloadFromResource("/operation.json")).build();
NetworkApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, delete, deleteResponse).getNetworkApiForProject("myproject");
+ TOKEN_RESPONSE, delete, deleteResponse).getNetworkApi("myproject");
assertEquals(api.delete("jclouds-test"),
new ParseOperationTest().expected());
@@ -121,7 +121,7 @@ public class NetworkApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
HttpResponse deleteResponse = HttpResponse.builder().statusCode(404).build();
NetworkApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, delete, deleteResponse).getNetworkApiForProject("myproject");
+ TOKEN_RESPONSE, delete, deleteResponse).getNetworkApi("myproject");
assertNull(api.delete("jclouds-test"));
}
@@ -139,7 +139,7 @@ public class NetworkApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
.payload(payloadFromResource("/network_list.json")).build();
NetworkApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, list, operationResponse).getNetworkApiForProject("myproject");
+ TOKEN_RESPONSE, list, operationResponse).getNetworkApi("myproject");
assertEquals(api.listFirstPage().toString(),
new ParseNetworkListTest().expected().toString());
@@ -157,7 +157,7 @@ public class NetworkApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
NetworkApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, list, operationResponse).getNetworkApiForProject("myproject");
+ TOKEN_RESPONSE, list, operationResponse).getNetworkApi("myproject");
assertTrue(api.list().concat().isEmpty());
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/NetworkApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/NetworkApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/NetworkApiLiveTest.java
index 208ec1b..94d1fc5 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/NetworkApiLiveTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/NetworkApiLiveTest.java
@@ -38,7 +38,7 @@ public class NetworkApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
private static final int TIME_WAIT = 10;
private NetworkApi api() {
- return api.getNetworkApiForProject(userProject.get());
+ return api.getNetworkApi(userProject.get());
}
@Test(groups = "live")
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionApiExpectTest.java
index f4e32cb..548c704 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionApiExpectTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionApiExpectTest.java
@@ -57,7 +57,7 @@ public class RegionApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
.payload(payloadFromResource("/region_get.json")).build();
RegionApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, GET_REGION_REQ, operationResponse).getRegionApiForProject("myproject");
+ TOKEN_RESPONSE, GET_REGION_REQ, operationResponse).getRegionApi("myproject");
assertEquals(api.get("us-central1"),
new ParseRegionTest().expected());
@@ -68,7 +68,7 @@ public class RegionApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
RegionApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, GET_REGION_REQ, operationResponse).getRegionApiForProject("myproject");
+ TOKEN_RESPONSE, GET_REGION_REQ, operationResponse).getRegionApi("myproject");
assertNull(api.get("us-central1"));
}
@@ -76,7 +76,7 @@ public class RegionApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
public void testListRegionNoOptionsResponseIs2xx() throws Exception {
RegionApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, LIST_REGIONS_REQ, LIST_REGIONS_RESPONSE).getRegionApiForProject("myproject");
+ TOKEN_RESPONSE, LIST_REGIONS_REQ, LIST_REGIONS_RESPONSE).getRegionApi("myproject");
assertEquals(api.listFirstPage().toString(),
new ParseRegionListTest().expected().toString());
@@ -87,7 +87,7 @@ public class RegionApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
RegionApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, LIST_REGIONS_REQ, operationResponse).getRegionApiForProject("myproject");
+ TOKEN_RESPONSE, LIST_REGIONS_REQ, operationResponse).getRegionApi("myproject");
assertTrue(api.list().concat().isEmpty());
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionApiLiveTest.java
index 6558f36..73d237c 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionApiLiveTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionApiLiveTest.java
@@ -39,7 +39,7 @@ public class RegionApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
private Region region;
private RegionApi api() {
- return api.getRegionApiForProject(userProject.get());
+ return api.getRegionApi(userProject.get());
}
@Test(groups = "live")
[5/6] initial commit to support GCE LB
Posted by ad...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/AddressApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/AddressApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/AddressApi.java
index d363715..e142d7a 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/AddressApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/AddressApi.java
@@ -53,8 +53,6 @@ import org.jclouds.rest.binders.BindToJsonPayload;
/**
* Provides access to Addresses via their REST API.
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/addresses"/>
*/
@SkipEncoding({'/', '='})
@RequestFilters(OAuthAuthenticationFilter.class)
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/DiskApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/DiskApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/DiskApi.java
index 266bff8..ba3c3f1 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/DiskApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/DiskApi.java
@@ -55,8 +55,6 @@ import org.jclouds.rest.binders.BindToJsonPayload;
/**
* Provides access to Disks via their REST API.
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/disks"/>
*/
@SkipEncoding({'/', '='})
@RequestFilters(OAuthAuthenticationFilter.class)
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/FirewallApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/FirewallApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/FirewallApi.java
index 9dcc35b..33d2e41 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/FirewallApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/FirewallApi.java
@@ -60,9 +60,6 @@ import org.jclouds.rest.binders.BindToJsonPayload;
/**
* Provides access to Firewalls via their REST API.
- * <p/>
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/firewalls"/>
*/
@SkipEncoding({'/', '='})
@RequestFilters(OAuthAuthenticationFilter.class)
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApi.java
new file mode 100644
index 0000000..c474286
--- /dev/null
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApi.java
@@ -0,0 +1,197 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecomputeengine.features;
+
+import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.collect.PagedIterable;
+import org.jclouds.googlecomputeengine.domain.ForwardingRule;
+import org.jclouds.googlecomputeengine.domain.Operation;
+import org.jclouds.googlecomputeengine.functions.internal.ParseForwardingRules;
+import org.jclouds.googlecomputeengine.options.ListOptions;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.oauth.v2.config.OAuthScopes;
+import org.jclouds.oauth.v2.filters.OAuthAuthenticator;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.ResponseParser;
+import org.jclouds.rest.annotations.SkipEncoding;
+import org.jclouds.rest.annotations.Transform;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+import java.net.URI;
+
+import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE;
+import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_SCOPE;
+
+/**
+ * Provides access to ForwardingRules via their REST API.
+ */
+@SkipEncoding({'/', '='})
+@RequestFilters(OAuthAuthenticator.class)
+@Consumes(MediaType.APPLICATION_JSON)
+public interface ForwardingRuleApi {
+
+ /**
+ * Returns the specified ForwardingRule resource.
+ *
+ * @param forwardingRule the name of the ForwardingRule resource to return.
+ * @return a ForwardingRule resource.
+ */
+ @Named("ForwardingRules:get")
+ @GET
+ @Path("/forwardingRules/{forwardingRule}")
+ @OAuthScopes(COMPUTE_READONLY_SCOPE)
+ @Fallback(NullOnNotFoundOr404.class)
+ @Nullable
+ ForwardingRule get(@PathParam("forwardingRule") String forwardingRule);
+
+ /**
+ * Creates a ForwardingRule resource in the specified project and region using the data included in the request.
+ *
+ * @param forwardingRuleName the name of the forwarding rule.
+ * @param targetSelfLink the URL of the target resource to receive the matched traffic. The target resource must live
+ * in the same region as this forwarding rule.
+ * @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
+ * you, and look for the status field.
+ */
+ @Named("ForwardingRules:insert")
+ @POST
+ @Produces(MediaType.APPLICATION_JSON)
+ @Path("/forwardingRules")
+ @OAuthScopes(COMPUTE_SCOPE)
+ @MapBinder(BindToJsonPayload.class)
+ Operation create(@PayloadParam("name") String forwardingRuleName,
+ @PayloadParam("target") URI targetSelfLink);
+
+ /**
+ * Creates a ForwardingRule resource in the specified project and region using the data included in the request.
+ *
+ * @param forwardingRuleName the name of the forwarding rule.
+ * @param targetSelfLink the URL of the target resource to receive the matched traffic. The target resource must live
+ * in the same region as this forwarding rule.
+ * @param portRange If IPProtocol is TCP or UDP, packets addressed to ports in the specified range will be
+ * forwarded to backend. By default, this is empty and all ports are allowed.
+ * @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
+ * you, and look for the status field.
+ */
+ @Named("ForwardingRules:insert")
+ @POST
+ @Produces(MediaType.APPLICATION_JSON)
+ @Path("/forwardingRules")
+ @OAuthScopes(COMPUTE_SCOPE)
+ @MapBinder(BindToJsonPayload.class)
+ Operation create(@PayloadParam("name") String forwardingRuleName,
+ @PayloadParam("target") URI targetSelfLink,
+ @PayloadParam("portRange") String portRange);
+
+ /**
+ * Creates a ForwardingRule resource in the specified project and region using the data included in the request.
+ *
+ * @param forwardingRuleName the name of the forwarding rule.
+ * @param targetSelfLink the URL of the target resource to receive the matched traffic. The target resource must live
+ * in the same region as this forwarding rule.
+ * @param portRange If IPProtocol is TCP or UDP, packets addressed to ports in the specified range will be
+ * forwarded to backend. By default, this is empty and all ports are allowed.
+ * @param ipAddress the external IP address that this forwarding rule is serving on behalf of. If this is a
+ * reserved address, the address must live in the same region as the forwarding rule. By default, this field is empty and an ephemeral IP is assigned to the ForwardingRule.
+ * @param ipProtocol the IP protocol to which this rule applies. If left empty, the default value used is TCP.
+ * @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
+ * you, and look for the status field.
+ */
+ @Named("ForwardingRules:insert")
+ @POST
+ @Produces(MediaType.APPLICATION_JSON)
+ @Path("/forwardingRules")
+ @OAuthScopes(COMPUTE_SCOPE)
+ @MapBinder(BindToJsonPayload.class)
+ Operation create(@PayloadParam("name") String forwardingRuleName,
+ @PayloadParam("target") URI targetSelfLink,
+ @PayloadParam("portRange") String portRange,
+ @PayloadParam("IPAddress") String ipAddress,
+ @PayloadParam("IPProtocol") String ipProtocol);
+
+ /**
+ * Deletes the specified TargetPool resource.
+ *
+ * @param forwardingRule name of the persistent forwarding rule resource to delete.
+ * @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
+ * you, and look for the status field.
+ */
+ @Named("ForwardingRules:delete")
+ @DELETE
+ @Path("/forwardingRules/{forwardingRule}")
+ @OAuthScopes(COMPUTE_SCOPE)
+ @Fallback(NullOnNotFoundOr404.class)
+ @Nullable
+ Operation delete(@PathParam("forwardingRule") String forwardingRule);
+
+
+ /**
+ * @return a Paged, Fluent Iterable that is able to fetch additional pages when required
+ * @see org.jclouds.collect.PagedIterable
+ */
+ @Named("ForwardingRules:list")
+ @GET
+ @Path("/forwardingRules")
+ @OAuthScopes(COMPUTE_READONLY_SCOPE)
+ @ResponseParser(ParseForwardingRules.class)
+ @Transform(ParseForwardingRules.ToPagedIterable.class)
+ @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
+ PagedIterable<ForwardingRule> list();
+
+ @Named("ForwardingRules:list")
+ @GET
+ @Path("/forwardingRules")
+ @OAuthScopes(COMPUTE_READONLY_SCOPE)
+ @ResponseParser(ParseForwardingRules.class)
+ @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
+ IterableWithMarker<ForwardingRule> list(ListOptions options);
+
+ /**
+ * Changes the target url for a forwarding rule.
+ *
+ * @param forwardingRule the name of the ForwardingRule resource in which target is to be set.
+ * @param target The URL of the target resource to receive traffic from this forwarding rule.
+ * It must live in the same region as this forwarding rule.
+ *
+ * @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
+ * you, and look for the status field.
+ */
+ @Named("ForwardingRules:setTarget")
+ @POST
+ @Path("/forwardingRules/{forwardingRule}/setTarget")
+ @OAuthScopes(COMPUTE_SCOPE)
+ @Fallback(NullOnNotFoundOr404.class)
+ @MapBinder(BindToJsonPayload.class)
+ @Nullable
+ Operation setTarget(@PathParam("forwardingRule") String forwardingRule,
+ @PayloadParam("target") String target);
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/GlobalOperationApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/GlobalOperationApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/GlobalOperationApi.java
index 818ae86..77a57b8 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/GlobalOperationApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/GlobalOperationApi.java
@@ -47,8 +47,6 @@ import org.jclouds.rest.annotations.Transform;
/**
* Provides access to Global Operations via their REST API.
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/globalOperations"/>
*/
@SkipEncoding({'/', '='})
@RequestFilters(OAuthAuthenticationFilter.class)
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApi.java
new file mode 100644
index 0000000..d562827
--- /dev/null
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApi.java
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecomputeengine.features;
+
+import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.collect.PagedIterable;
+import org.jclouds.googlecomputeengine.domain.HttpHealthCheck;
+import org.jclouds.googlecomputeengine.domain.Operation;
+import org.jclouds.googlecomputeengine.functions.internal.ParseHttpHealthChecks;
+import org.jclouds.googlecomputeengine.options.ListOptions;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.oauth.v2.config.OAuthScopes;
+import org.jclouds.oauth.v2.filters.OAuthAuthenticator;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.PATCH;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.ResponseParser;
+import org.jclouds.rest.annotations.SkipEncoding;
+import org.jclouds.rest.annotations.Transform;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE;
+import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_SCOPE;
+
+/**
+ * Provides access to HttpHealthChecks via their REST API.
+ */
+@SkipEncoding({'/', '='})
+@RequestFilters(OAuthAuthenticator.class)
+@Consumes(MediaType.APPLICATION_JSON)
+public interface HttpHealthCheckApi {
+
+ /**
+ * Returns the specified HttpHealthCheck resource.
+ *
+ * @param httpHealthCheck the name of the HttpHealthCheck resource to return.
+ * @return a HttpHealthCheck resource.
+ */
+ @Named("HttpHealthChecks:get")
+ @GET
+ @Path("/{httpHealthCheck}")
+ @OAuthScopes(COMPUTE_READONLY_SCOPE)
+ @Fallback(NullOnNotFoundOr404.class)
+ @Nullable
+ HttpHealthCheck get(@PathParam("httpHealthCheck") String httpHealthCheck);
+
+ /**
+ * Creates a HttpHealthCheck resource in the specified project and region using the data included in the request.
+ *
+ * @param httpHealthCheckName the name of the forwarding rule.
+ * @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
+ * you, and look for the status field.
+ */
+ @Named("HttpHealthChecks:insert")
+ @POST
+ @Produces(MediaType.APPLICATION_JSON)
+ @OAuthScopes(COMPUTE_SCOPE)
+ @MapBinder(BindToJsonPayload.class)
+ @Fallback(NullOnNotFoundOr404.class)
+ Operation insert(@PayloadParam("name") String httpHealthCheckName);
+
+ /**
+ * Creates a HttpHealthCheck resource in the specified project and region using the data included in the request.
+ *
+ * @param httpHealthCheckName the name of the forwarding rule.
+ * @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
+ * you, and look for the status field.
+ */
+ @Named("HttpHealthChecks:insert")
+ @POST
+ @Produces(MediaType.APPLICATION_JSON)
+ @OAuthScopes(COMPUTE_SCOPE)
+ @MapBinder(BindToJsonPayload.class)
+ @Fallback(NullOnNotFoundOr404.class)
+ Operation insert(@PayloadParam("name") String httpHealthCheckName, @PayloadParam("timeoutSec") int
+ timeoutSec, @PayloadParam("unhealthyThreshold") int unhealthyThreshold);
+
+ /**
+ * Deletes the specified TargetPool resource.
+ *
+ * @param httpHealthCheck name of the persistent forwarding rule resource to delete.
+ * @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
+ * you, and look for the status field.
+ */
+ @Named("HttpHealthChecks:delete")
+ @DELETE
+ @Path("/{httpHealthCheck}")
+ @OAuthScopes(COMPUTE_SCOPE)
+ @Fallback(NullOnNotFoundOr404.class)
+ @Nullable
+ Operation delete(@PathParam("httpHealthCheck") String httpHealthCheck);
+
+ /**
+ * @return a Paged, Fluent Iterable that is able to fetch additional pages when required
+ * @see org.jclouds.collect.PagedIterable
+ */
+ @Named("HttpHealthChecks:list")
+ @GET
+ @OAuthScopes(COMPUTE_READONLY_SCOPE)
+ @ResponseParser(ParseHttpHealthChecks.class)
+ @Transform(ParseHttpHealthChecks.ToPagedIterable.class)
+ @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
+ PagedIterable<HttpHealthCheck> list();
+
+ /**
+ * @param options @see org.jclouds.googlecomputeengine.options.ListOptions
+ * @return IterableWithMarker
+ */
+ @Named("HttpHealthChecks:list")
+ @GET
+ @OAuthScopes(COMPUTE_READONLY_SCOPE)
+ @ResponseParser(ParseHttpHealthChecks.class)
+ @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
+ IterableWithMarker<HttpHealthCheck> list(ListOptions options);
+
+ /**
+ * Changes target url for forwarding rule.
+ *
+ * @param httpHealthCheck the name of the HttpHealthCheck resource to update.
+ *
+ * @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
+ * you, and look for the status field.
+ */
+ @Named("HttpHealthChecks:patch")
+ @PATCH
+ @Path("/{httpHealthCheck}")
+ @OAuthScopes(COMPUTE_SCOPE)
+ @Fallback(NullOnNotFoundOr404.class)
+ @MapBinder(BindToJsonPayload.class)
+ @Nullable
+ Operation patch(@PathParam("httpHealthCheck") String httpHealthCheck);
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ImageApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ImageApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ImageApi.java
index f52d5cd..deaf7dc 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ImageApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ImageApi.java
@@ -53,9 +53,6 @@ import org.jclouds.rest.binders.BindToJsonPayload;
/**
* Provides access to Images via their REST API.
- * <p/>
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/images"/>
*/
@SkipEncoding({'/', '='})
@RequestFilters(OAuthAuthenticationFilter.class)
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/InstanceApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/InstanceApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/InstanceApi.java
index aaa2d04..1585679 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/InstanceApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/InstanceApi.java
@@ -61,8 +61,6 @@ import org.jclouds.rest.binders.BindToJsonPayload;
/**
* Provides access to Instances via their REST API.
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/instances"/>
* @see InstanceApi
*/
@SkipEncoding({'/', '='})
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/MachineTypeApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/MachineTypeApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/MachineTypeApi.java
index 9c0e411..8977fbe 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/MachineTypeApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/MachineTypeApi.java
@@ -45,8 +45,6 @@ import org.jclouds.rest.annotations.Transform;
/**
* Provides access to MachineTypes via their REST API.
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/machineTypes"/>
*/
@SkipEncoding({'/', '='})
@RequestFilters(OAuthAuthenticationFilter.class)
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/NetworkApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/NetworkApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/NetworkApi.java
index 8f21287..bee6861 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/NetworkApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/NetworkApi.java
@@ -53,8 +53,6 @@ import org.jclouds.rest.binders.BindToJsonPayload;
/**
* Provides access to Networks via their REST API.
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/networks"/>
*/
@SkipEncoding({'/', '='})
@RequestFilters(OAuthAuthenticationFilter.class)
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ProjectApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ProjectApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ProjectApi.java
index eed0417..59cb5a0 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ProjectApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ProjectApi.java
@@ -44,8 +44,6 @@ import org.jclouds.rest.annotations.SkipEncoding;
/**
* Provides access to Projects via their REST API.
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/projects"/>
*/
@SkipEncoding({'/', '='})
@RequestFilters(OAuthAuthenticationFilter.class)
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/RegionApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/RegionApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/RegionApi.java
index 608a614..5350151 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/RegionApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/RegionApi.java
@@ -43,8 +43,6 @@ import org.jclouds.rest.annotations.Transform;
/**
* Provides access to Regions via their REST API.
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/regions"/>
*/
@SkipEncoding({'/', '='})
@RequestFilters(OAuthAuthenticationFilter.class)
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/RegionOperationApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/RegionOperationApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/RegionOperationApi.java
index 4afab63..99cf162 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/RegionOperationApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/RegionOperationApi.java
@@ -47,8 +47,6 @@ import org.jclouds.rest.annotations.Transform;
/**
* Provides access to Operations via their REST API.
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/operations"/>
*/
@SkipEncoding({'/', '='})
@RequestFilters(OAuthAuthenticationFilter.class)
@@ -144,7 +142,7 @@ public interface RegionOperationApi {
PagedIterable<Operation> listInRegion(@PathParam("region") String region);
/**
- * A paged version of RegionOperationApi#listFirstPageInRegion(String)
+ * A paged version of RegionOperationApi#listFirstPage(String)
*
* @return a Paged, Fluent Iterable that is able to fetch additional pages when required
* @see org.jclouds.collect.PagedIterable
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/RouteApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/RouteApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/RouteApi.java
index e7b2b12..815ea8e 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/RouteApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/RouteApi.java
@@ -55,8 +55,6 @@ import org.jclouds.rest.annotations.Transform;
/**
* Provides access to Routes via their REST API.
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/routess"/>
*/
@SkipEncoding({'/', '='})
@RequestFilters(OAuthAuthenticationFilter.class)
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/SnapshotApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/SnapshotApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/SnapshotApi.java
index e0ac384..06616e8 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/SnapshotApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/SnapshotApi.java
@@ -48,8 +48,6 @@ import org.jclouds.rest.annotations.Transform;
/**
* Provides access to Snapshots via their REST API.
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/snapshots"/>
*/
@SkipEncoding({'/', '='})
@RequestFilters(OAuthAuthenticationFilter.class)
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetPoolApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetPoolApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetPoolApi.java
new file mode 100644
index 0000000..e5f282d
--- /dev/null
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetPoolApi.java
@@ -0,0 +1,272 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecomputeengine.features;
+
+import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.collect.PagedIterable;
+import org.jclouds.googlecomputeengine.domain.Operation;
+import org.jclouds.googlecomputeengine.domain.TargetPool;
+import org.jclouds.googlecomputeengine.functions.internal.ParseTargetPools;
+import org.jclouds.googlecomputeengine.options.ListOptions;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.oauth.v2.config.OAuthScopes;
+import org.jclouds.oauth.v2.filters.OAuthAuthenticator;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.ResponseParser;
+import org.jclouds.rest.annotations.SkipEncoding;
+import org.jclouds.rest.annotations.Transform;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import java.net.URI;
+import java.util.List;
+
+import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE;
+import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_SCOPE;
+
+/**
+ * Provides access to TargetPools via their REST API.
+ */
+@SkipEncoding({'/', '='})
+@RequestFilters(OAuthAuthenticator.class)
+@Consumes(MediaType.APPLICATION_JSON)
+public interface TargetPoolApi {
+
+ /**
+ * Returns the specified TargetPool resource.
+ *
+ * @param targetPool the name of the TargetPool resource to return.
+ * @return a TargetPool resource.
+ */
+ @Named("TargetPools:get")
+ @GET
+ @Path("/targetPools/{targetPool}")
+ @OAuthScopes(COMPUTE_READONLY_SCOPE)
+ @Fallback(NullOnNotFoundOr404.class)
+ @Nullable
+ TargetPool get(@PathParam("targetPool") String targetPool);
+
+ /**
+ * Creates a TargetPool resource in the specified project and region using the data included in the request.
+ *
+ * @param targetPoolName the name of the targetPool.
+ * @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
+ * you, and look for the status field.
+ */
+ @Named("TargetPools:insert")
+ @POST
+ @Produces(MediaType.APPLICATION_JSON)
+ @Path("/targetPools")
+ @OAuthScopes(COMPUTE_SCOPE)
+ @MapBinder(BindToJsonPayload.class)
+ Operation create(@PayloadParam("name") String targetPoolName);
+
+ /**
+ * Creates a TargetPool resource in the specified project and region using the data included in the request.
+ *
+ * @param targetPoolName the name of the targetPool.
+ * @param instances A list of resource URLs to the member VMs serving this pool. They must live in zones
+ * contained in the same region as this pool.
+ * @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
+ * you, and look for the status field.
+ */
+ @Named("TargetPools:insert")
+ @POST
+ @Produces(MediaType.APPLICATION_JSON)
+ @Path("/targetPools")
+ @OAuthScopes(COMPUTE_SCOPE)
+ @MapBinder(BindToJsonPayload.class)
+ Operation create(@PayloadParam("name") String targetPoolName, @PayloadParam("instances") List<URI> instances);
+
+ /**
+ * Creates a TargetPool resource in the specified project and region using the data included in the request.
+ *
+ * @param targetPoolName the name of the targetPool.
+ * @param instances A list of resource URLs to the member VMs serving this pool. They must live in zones
+ * contained in the same region as this pool.
+ * @param healthChecks A URL to one HttpHealthCheck resource. A member VM in this pool is considered healthy if
+ * and only if the specified health checks pass. An empty list means all member virtual
+ * machines will be considered healthy at all times but the health status of this target
+ * pool will be marked as unhealthy to indicate that no health checks are being performed.
+ * @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
+ * you, and look for the status field.
+ */
+ @Named("TargetPools:insert")
+ @POST
+ @Produces(MediaType.APPLICATION_JSON)
+ @Path("/targetPools")
+ @OAuthScopes(COMPUTE_SCOPE)
+ @MapBinder(BindToJsonPayload.class)
+ Operation create(@PayloadParam("name") String targetPoolName, @PayloadParam("instances") List<URI> instances,
+ @PayloadParam("healthChecks") List<URI> healthChecks);
+
+ /**
+ * Creates a TargetPool resource in the specified project and region using the data included in the request.
+ *
+ * @param targetPoolName the name of the targetPool.
+ * @param instances A list of resource URLs to the member VMs serving this pool. They must live in zones
+ * contained in the same region as this pool.
+ * @param healthChecks A URL to one HttpHealthCheck resource. A member VM in this pool is considered healthy if
+ * and only if the specified health checks pass. An empty list means all member virtual
+ * machines will be considered healthy at all times but the health status of this target
+ * pool will be marked as unhealthy to indicate that no health checks are being performed.
+ * @param backupPool it is applicable only when the target pool is serving a forwarding rule as the primary pool.
+ * Must be a fully-qualified URL to a target pool that is in the same region as the primary
+ * target pool.
+ * @param sessionAffinity Defines the session affinity option. Session affinity determines the hash method that
+ * Google Compute Engine uses to distribute traffic. Acceptable values are:
+ * "CLIENT_IP": Connections from the same client IP are guaranteed to go to the same VM in the pool while that VM remains healthy.
+ * "CLIENT_IP_PROTO": Connections from the same client IP and port are guaranteed to go to the same VM in the pool while that VM remains healthy.
+ * "NONE": Connections from the same client IP may go to any VM in the pool.
+ * @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
+ * you, and look for the status field.
+ */
+ @Named("TargetPools:insert")
+ @POST
+ @Produces(MediaType.APPLICATION_JSON)
+ @Path("/targetPools")
+ @OAuthScopes(COMPUTE_SCOPE)
+ @MapBinder(BindToJsonPayload.class)
+ Operation create(@PayloadParam("name") String targetPoolName, @PayloadParam("instances") List<URI> instances,
+ @PayloadParam("healthChecks") List<URI> healthChecks, @PayloadParam("backupPool") String backupPool,
+ @PayloadParam("sessionAffinity") String sessionAffinity);
+
+ /**
+ * Deletes the specified TargetPool resource.
+ *
+ * @param targetPool name of the persistent target pool resource to delete.
+ * @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
+ * you, and look for the status field.
+ */
+ @Named("TargetPools:delete")
+ @DELETE
+ @Path("/targetPools/{targetPool}")
+ @OAuthScopes(COMPUTE_SCOPE)
+ @Fallback(NullOnNotFoundOr404.class)
+ @Nullable
+ Operation delete(@PathParam("targetPool") String targetPool);
+
+ /**
+ * @return a Paged, Fluent Iterable that is able to fetch additional pages when required
+ * @see org.jclouds.collect.PagedIterable
+ */
+ @Named("TargetPools:list")
+ @GET
+ @Path("/targetPools")
+ @OAuthScopes(COMPUTE_READONLY_SCOPE)
+ @ResponseParser(ParseTargetPools.class)
+ @Transform(ParseTargetPools.ToPagedIterable.class)
+ @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
+ PagedIterable<TargetPool> list();
+
+ /**
+ * @param options @see org.jclouds.googlecomputeengine.options.ListOptions
+ * @return IterableWithMarker
+ */
+ @Named("TargetPools:list")
+ @GET
+ @Path("/targetPools")
+ @OAuthScopes(COMPUTE_READONLY_SCOPE)
+ @ResponseParser(ParseTargetPools.class)
+ @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
+ IterableWithMarker<TargetPool> list(ListOptions options);
+
+ /**
+ * Adds instance to the targetPool.
+ *
+ * @param targetPool the name of the target pool.
+ * @param instanceName the name for the instance to be added to targetPool.
+ *
+ * @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
+ * you, and look for the status field.
+ */
+ @Named("TargetPools:addInstance")
+ @POST
+ @Path("/targetPools/{targetPool}/addInstance")
+ @OAuthScopes(COMPUTE_SCOPE)
+ @Fallback(NullOnNotFoundOr404.class)
+ @MapBinder(BindToJsonPayload.class)
+ @Nullable
+ Operation addInstance(@PathParam("targetPool") String targetPool, @PayloadParam("instance") String instanceName);
+
+ /**
+ * Adds health check URL to targetPool.
+ *
+ * @param targetPool the name of the target pool.
+ * @param healthCheck the name for the healthCheck to be added to targetPool.
+ *
+ * @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
+ * you, and look for the status field.
+ */
+ @Named("TargetPools:addHealthCheck")
+ @POST
+ @Path("/targetPools/{targetPool}/addHealthCheck")
+ @OAuthScopes(COMPUTE_SCOPE)
+ @Fallback(NullOnNotFoundOr404.class)
+ @MapBinder(BindToJsonPayload.class)
+ @Nullable
+ Operation addHealthCheck(@PathParam("targetPool") String targetPool, @PayloadParam("healthCheck") String healthCheck);
+
+ /**
+ * Removes instance URL from targetPool.
+ *
+ * @param targetPool the name of the target pool.
+ * @param instanceName the name for the instance to be removed from targetPool.
+ *
+ * @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
+ * you, and look for the status field.
+ */
+ @Named("TargetPools:removeInstance")
+ @POST
+ @Path("/targetPools/{targetPool}/removeInstance")
+ @OAuthScopes(COMPUTE_SCOPE)
+ @Fallback(NullOnNotFoundOr404.class)
+ @MapBinder(BindToJsonPayload.class)
+ @Nullable
+ Operation removeInstance(@PathParam("targetPool") String targetPool, @PayloadParam("instanceName") String instanceName);
+
+ /**
+ * Changes backup pool configurations.
+ *
+ * @param targetPool the name of the target pool.
+ * @param target the URL of target pool for which you want to use as backup.
+ *
+ * @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
+ * you, and look for the status field.
+ */
+ @Named("TargetPools:setBackup")
+ @POST
+ @Path("/targetPools/{targetPool}/setBackup")
+ @OAuthScopes(COMPUTE_SCOPE)
+ @Fallback(NullOnNotFoundOr404.class)
+ @MapBinder(BindToJsonPayload.class)
+ @Nullable
+ Operation setBackup(@PathParam("targetPool") String targetPool, @PayloadParam("target") String target);
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ZoneApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ZoneApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ZoneApi.java
index 26d10a6..32ef1ad 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ZoneApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ZoneApi.java
@@ -43,8 +43,6 @@ import org.jclouds.rest.annotations.Transform;
/**
* Provides access to Zones via their REST API.
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/zones"/>
*/
@SkipEncoding({'/', '='})
@RequestFilters(OAuthAuthenticationFilter.class)
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ZoneOperationApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ZoneOperationApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ZoneOperationApi.java
index 3dd69e1..44ff057 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ZoneOperationApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ZoneOperationApi.java
@@ -47,8 +47,6 @@ import org.jclouds.rest.annotations.Transform;
/**
* Provides access to Operations via their REST API.
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/operations"/>
*/
@SkipEncoding({'/', '='})
@RequestFilters(OAuthAuthenticationFilter.class)
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/CreateNetworkIfNeeded.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/CreateNetworkIfNeeded.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/CreateNetworkIfNeeded.java
index c6bc1ac..e6d4b11 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/CreateNetworkIfNeeded.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/CreateNetworkIfNeeded.java
@@ -74,27 +74,27 @@ public class CreateNetworkIfNeeded implements Function<NetworkAndAddressRange, N
public Network apply(NetworkAndAddressRange input) {
checkNotNull(input, "input");
- Network nw = api.getNetworkApiForProject(userProject.get()).get(input.getName());
+ Network nw = api.getNetworkApi(userProject.get()).get(input.getName());
if (nw != null) {
return nw;
}
if (input.getGateway().isPresent()) {
- AtomicReference<Operation> operation = Atomics.newReference(api.getNetworkApiForProject(userProject
+ AtomicReference<Operation> operation = Atomics.newReference(api.getNetworkApi(userProject
.get()).createInIPv4RangeWithGateway(input.getName(), input.getIpV4Range(), input.getGateway().get()));
retry(operationDonePredicate, operationCompleteCheckTimeout, operationCompleteCheckInterval,
MILLISECONDS).apply(operation);
- checkState(!operation.get().getHttpError().isPresent(), "Could not create network, operation failed" + operation);
+ checkState(!operation.get().getHttpError().isPresent(), "Could not insert network, operation failed" + operation);
} else {
- AtomicReference<Operation> operation = Atomics.newReference(api.getNetworkApiForProject(userProject
+ AtomicReference<Operation> operation = Atomics.newReference(api.getNetworkApi(userProject
.get()).createInIPv4Range(input.getName(), input.getIpV4Range()));
retry(operationDonePredicate, operationCompleteCheckTimeout, operationCompleteCheckInterval,
MILLISECONDS).apply(operation);
- checkState(!operation.get().getHttpError().isPresent(), "Could not create network, operation failed" + operation);
+ checkState(!operation.get().getHttpError().isPresent(), "Could not insert network, operation failed" + operation);
}
- return checkNotNull(api.getNetworkApiForProject(userProject.get()).get(input.getName()),
+ return checkNotNull(api.getNetworkApi(userProject.get()).get(input.getName()),
"no network with name %s was found", input.getName());
}
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseAddresses.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseAddresses.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseAddresses.java
index 59b4408..f7a4d73 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseAddresses.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseAddresses.java
@@ -58,7 +58,7 @@ public class ParseAddresses extends ParseJson<ListPage<Address>> {
@Override
public IterableWithMarker<Address> apply(Object input) {
- return api.getAddressApiForProject(projectName)
+ return api.getAddressApi(projectName)
.listAtMarkerInRegion(regionName, input.toString(), options);
}
};
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseDisks.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseDisks.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseDisks.java
index eca4a11..2373838 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseDisks.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseDisks.java
@@ -58,7 +58,7 @@ public class ParseDisks extends ParseJson<ListPage<Disk>> {
@Override
public IterableWithMarker<Disk> apply(Object input) {
- return api.getDiskApiForProject(projectName)
+ return api.getDiskApi(projectName)
.listAtMarkerInZone(zoneName, input.toString(), options);
}
};
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseFirewalls.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseFirewalls.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseFirewalls.java
index 05d11bd..8cb7c5f 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseFirewalls.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseFirewalls.java
@@ -55,7 +55,7 @@ public class ParseFirewalls extends ParseJson<ListPage<Firewall>> {
@Override
public IterableWithMarker<Firewall> apply(Object input) {
- return api.getFirewallApiForProject(projectName).listAtMarker(input.toString(), options);
+ return api.getFirewallApi(projectName).listAtMarker(input.toString(), options);
}
};
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseForwardingRules.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseForwardingRules.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseForwardingRules.java
new file mode 100644
index 0000000..f3d13dd
--- /dev/null
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseForwardingRules.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecomputeengine.functions.internal;
+
+import com.google.common.base.Function;
+import com.google.inject.TypeLiteral;
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
+import org.jclouds.googlecomputeengine.domain.ForwardingRule;
+import org.jclouds.googlecomputeengine.domain.ListPage;
+import org.jclouds.googlecomputeengine.options.ListOptions;
+import org.jclouds.http.functions.ParseJson;
+import org.jclouds.json.Json;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+@Singleton
+public class ParseForwardingRules extends ParseJson<ListPage<ForwardingRule>> {
+
+ @Inject
+ public ParseForwardingRules(Json json) {
+ super(json, new TypeLiteral<ListPage<ForwardingRule>>() {
+ });
+ }
+
+ public static class ToPagedIterable extends BaseWithRegionToPagedIterable<ForwardingRule, ToPagedIterable> {
+
+ private final GoogleComputeEngineApi api;
+
+ @Inject
+ protected ToPagedIterable(GoogleComputeEngineApi api) {
+ this.api = checkNotNull(api, "api");
+ }
+
+ @Override
+ protected Function<Object, IterableWithMarker<ForwardingRule>> fetchNextPage(final String projectName,
+ final String regionName,
+ final ListOptions options) {
+ return new Function<Object, IterableWithMarker<ForwardingRule>>() {
+
+ @Override
+ public IterableWithMarker<ForwardingRule> apply(Object input) {
+ return api.getForwardingRuleApi(projectName, regionName).list(options);
+ }
+ };
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseGlobalOperations.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseGlobalOperations.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseGlobalOperations.java
index b2a589e..3fdf230 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseGlobalOperations.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseGlobalOperations.java
@@ -55,7 +55,7 @@ public class ParseGlobalOperations extends ParseJson<ListPage<Operation>> {
@Override
public IterableWithMarker<Operation> apply(Object input) {
- return api.getGlobalOperationApiForProject(projectName).listAtMarker(input.toString(), options);
+ return api.getGlobalOperationApi(projectName).listAtMarker(input.toString(), options);
}
};
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseHttpHealthChecks.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseHttpHealthChecks.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseHttpHealthChecks.java
new file mode 100644
index 0000000..5ddc8d9
--- /dev/null
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseHttpHealthChecks.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecomputeengine.functions.internal;
+
+import com.google.common.base.Function;
+import com.google.inject.TypeLiteral;
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
+import org.jclouds.googlecomputeengine.domain.HttpHealthCheck;
+import org.jclouds.googlecomputeengine.domain.ListPage;
+import org.jclouds.googlecomputeengine.options.ListOptions;
+import org.jclouds.http.functions.ParseJson;
+import org.jclouds.json.Json;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+@Singleton
+public class ParseHttpHealthChecks extends ParseJson<ListPage<HttpHealthCheck>> {
+
+ @Inject
+ public ParseHttpHealthChecks(Json json) {
+ super(json, new TypeLiteral<ListPage<HttpHealthCheck>>() {
+ });
+ }
+
+ public static class ToPagedIterable extends BaseToPagedIterable<HttpHealthCheck, ToPagedIterable> {
+
+ private final GoogleComputeEngineApi api;
+
+ @Inject
+ protected ToPagedIterable(GoogleComputeEngineApi api) {
+ this.api = checkNotNull(api, "api");
+ }
+
+ @Override
+ protected Function<Object, IterableWithMarker<HttpHealthCheck>> fetchNextPage(final String projectName,
+ final ListOptions options) {
+ return new Function<Object, IterableWithMarker<HttpHealthCheck>>() {
+
+ @Override
+ public IterableWithMarker<HttpHealthCheck> apply(Object input) {
+ return api.getHttpHealthCheckApi(projectName).list(options);
+ }
+ };
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseImages.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseImages.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseImages.java
index 6d23343..102d07b 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseImages.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseImages.java
@@ -55,7 +55,7 @@ public class ParseImages extends ParseJson<ListPage<Image>> {
@Override
public IterableWithMarker<Image> apply(Object input) {
- return api.getImageApiForProject(projectName).listAtMarker(input.toString(), options);
+ return api.getImageApi(projectName).listAtMarker(input.toString(), options);
}
};
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseInstances.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseInstances.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseInstances.java
index 001a98c..356ca45 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseInstances.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseInstances.java
@@ -56,7 +56,7 @@ public class ParseInstances extends ParseJson<ListPage<Instance>> {
@Override
public IterableWithMarker<Instance> apply(Object input) {
- return api.getInstanceApiForProject(project)
+ return api.getInstanceApi(project)
.listAtMarkerInZone(zone, input.toString(), options);
}
};
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseMachineTypes.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseMachineTypes.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseMachineTypes.java
index be78b92..0e53257 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseMachineTypes.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseMachineTypes.java
@@ -55,7 +55,7 @@ public class ParseMachineTypes extends ParseJson<ListPage<MachineType>> {
@Override
public IterableWithMarker<MachineType> apply(Object input) {
- return api.getMachineTypeApiForProject(project)
+ return api.getMachineTypeApi(project)
.listAtMarkerInZone(zone, input.toString(), options);
}
};
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseNetworks.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseNetworks.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseNetworks.java
index 0aa550b..62603aa 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseNetworks.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseNetworks.java
@@ -55,7 +55,7 @@ public class ParseNetworks extends ParseJson<ListPage<Network>> {
@Override
public IterableWithMarker<Network> apply(Object input) {
- return api.getNetworkApiForProject(projectName).listAtMarker(input.toString(), options);
+ return api.getNetworkApi(projectName).listAtMarker(input.toString(), options);
}
};
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRegionOperations.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRegionOperations.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRegionOperations.java
index 84c8954..d5fcbfb 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRegionOperations.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRegionOperations.java
@@ -56,7 +56,7 @@ public class ParseRegionOperations extends ParseJson<ListPage<Operation>> {
@Override
public IterableWithMarker<Operation> apply(Object input) {
- return api.getRegionOperationApiForProject(projectName)
+ return api.getRegionOperationApi(projectName)
.listAtMarkerInRegion(regionName, input.toString(), options);
}
};
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRegions.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRegions.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRegions.java
index ca1819e..6680413 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRegions.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRegions.java
@@ -55,7 +55,7 @@ public class ParseRegions extends ParseJson<ListPage<Region>> {
@Override
public IterableWithMarker<Region> apply(Object input) {
- return api.getRegionApiForProject(projectName).listAtMarker(input.toString(), options);
+ return api.getRegionApi(projectName).listAtMarker(input.toString(), options);
}
};
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRoutes.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRoutes.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRoutes.java
index 6191892..8d40984 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRoutes.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRoutes.java
@@ -55,7 +55,7 @@ public class ParseRoutes extends ParseJson<ListPage<Route>> {
@Override
public IterableWithMarker<Route> apply(Object input) {
- return api.getRouteApiForProject(projectName).listAtMarker(input.toString(), options);
+ return api.getRouteApi(projectName).listAtMarker(input.toString(), options);
}
};
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseSnapshots.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseSnapshots.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseSnapshots.java
index 66ac2e7..c778ad5 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseSnapshots.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseSnapshots.java
@@ -57,7 +57,7 @@ public class ParseSnapshots extends ParseJson<ListPage<Snapshot>> {
@Override
public IterableWithMarker<Snapshot> apply(Object input) {
- return api.getSnapshotApiForProject(projectName)
+ return api.getSnapshotApi(projectName)
.listAtMarker(input.toString(), options);
}
};
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseTargetPools.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseTargetPools.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseTargetPools.java
new file mode 100644
index 0000000..2f19ca2
--- /dev/null
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseTargetPools.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecomputeengine.functions.internal;
+
+import com.google.common.base.Function;
+import com.google.inject.TypeLiteral;
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
+import org.jclouds.googlecomputeengine.domain.ListPage;
+import org.jclouds.googlecomputeengine.domain.TargetPool;
+import org.jclouds.googlecomputeengine.options.ListOptions;
+import org.jclouds.http.functions.ParseJson;
+import org.jclouds.json.Json;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+@Singleton
+public class ParseTargetPools extends ParseJson<ListPage<TargetPool>> {
+
+ @Inject
+ public ParseTargetPools(Json json) {
+ super(json, new TypeLiteral<ListPage<TargetPool>>() {
+ });
+ }
+
+ public static class ToPagedIterable extends BaseWithZoneToPagedIterable<TargetPool, ToPagedIterable> {
+
+ private final GoogleComputeEngineApi api;
+
+ @Inject
+ protected ToPagedIterable(GoogleComputeEngineApi api) {
+ this.api = checkNotNull(api, "api");
+ }
+
+ @Override
+ protected Function<Object, IterableWithMarker<TargetPool>> fetchNextPage(final String projectName,
+ final String regionName,
+ final ListOptions options) {
+ return new Function<Object, IterableWithMarker<TargetPool>>() {
+
+ @Override
+ public IterableWithMarker<TargetPool> apply(Object input) {
+ return api.getTargetPoolApi(projectName, regionName)
+ .list(options);
+ }
+ };
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseZoneOperations.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseZoneOperations.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseZoneOperations.java
index 28cc443..1d0adbd 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseZoneOperations.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseZoneOperations.java
@@ -56,7 +56,7 @@ public class ParseZoneOperations extends ParseJson<ListPage<Operation>> {
@Override
public IterableWithMarker<Operation> apply(Object input) {
- return api.getZoneOperationApiForProject(projectName)
+ return api.getZoneOperationApi(projectName)
.listAtMarkerInZone(zoneName, input.toString(), options);
}
};
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseZones.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseZones.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseZones.java
index f3e54ea..0d474d6 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseZones.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseZones.java
@@ -55,7 +55,7 @@ public class ParseZones extends ParseJson<ListPage<Zone>> {
@Override
public IterableWithMarker<Zone> apply(Object input) {
- return api.getZoneApiForProject(projectName).listAtMarker(input.toString(), options);
+ return api.getZoneApi(projectName).listAtMarker(input.toString(), options);
}
};
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/FirewallOptions.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/FirewallOptions.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/FirewallOptions.java
index d70d4d0..300ce53 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/FirewallOptions.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/FirewallOptions.java
@@ -24,7 +24,7 @@ import org.jclouds.googlecomputeengine.domain.Firewall;
import com.google.common.collect.ImmutableSet;
/**
- * Options to create a firewall.
+ * Options to insert a firewall.
*
* @see Firewall
*/
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/ListOptions.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/ListOptions.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/ListOptions.java
index 9a3e88e..08b4367 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/ListOptions.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/ListOptions.java
@@ -22,8 +22,6 @@ import org.jclouds.http.options.BaseHttpRequestOptions;
/**
* Allows to optionally specify a filter, max results and a page token for <code>listFirstPage()</code> REST methods.
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/operations/listFirstPage"/>
*/
public class ListOptions extends BaseHttpRequestOptions {
@@ -72,6 +70,14 @@ public class ListOptions extends BaseHttpRequestOptions {
return this;
}
+ /**
+ * Marks the beginning of the next list page
+ */
+ public ListOptions marker(String marker) {
+ this.queryParameters.put("pageToken", checkNotNull(marker, "marker"));
+ return this;
+ }
+
public static class Builder {
/**
@@ -87,5 +93,12 @@ public class ListOptions extends BaseHttpRequestOptions {
public ListOptions maxResults(Integer maxResults) {
return new ListOptions().maxResults(maxResults);
}
+
+ /**
+ * @see ListOptions#marker(String)
+ */
+ public ListOptions marker(String marker) {
+ return new ListOptions().marker(marker);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/RouteOptions.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/RouteOptions.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/RouteOptions.java
index ec891ce..a6fa6ac 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/RouteOptions.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/RouteOptions.java
@@ -22,7 +22,7 @@ import java.util.Set;
import com.google.common.collect.ImmutableSet;
/**
- * Options to create a route.
+ * Options to insert a route.
*
* @see org.jclouds.googlecomputeengine.domain.Route
*/
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/predicates/GlobalOperationDonePredicate.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/predicates/GlobalOperationDonePredicate.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/predicates/GlobalOperationDonePredicate.java
index ac34bcc..f7be915 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/predicates/GlobalOperationDonePredicate.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/predicates/GlobalOperationDonePredicate.java
@@ -45,7 +45,7 @@ public class GlobalOperationDonePredicate implements Predicate<AtomicReference<O
@Override
public boolean apply(AtomicReference<Operation> input) {
checkNotNull(input, "input");
- Operation current = api.getGlobalOperationApiForProject(project.get()).get(input.get().getName());
+ Operation current = api.getGlobalOperationApi(project.get()).get(input.get().getName());
switch (current.getStatus()) {
case DONE:
input.set(current);
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/predicates/RegionOperationDonePredicate.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/predicates/RegionOperationDonePredicate.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/predicates/RegionOperationDonePredicate.java
index 1f3dee6..54f0f3c 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/predicates/RegionOperationDonePredicate.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/predicates/RegionOperationDonePredicate.java
@@ -53,7 +53,7 @@ public class RegionOperationDonePredicate implements Predicate<AtomicReference<O
public boolean apply(AtomicReference<Operation> input) {
checkNotNull(input, "input");
- Operation current = api.getRegionOperationApiForProject(project.get())
+ Operation current = api.getRegionOperationApi(project.get())
.getInRegion(regions.get().get(input.get().getRegion().get()).getName(),
input.get().getName());
switch (current.getStatus()) {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/predicates/ZoneOperationDonePredicate.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/predicates/ZoneOperationDonePredicate.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/predicates/ZoneOperationDonePredicate.java
index c63c6f3..c681ae7 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/predicates/ZoneOperationDonePredicate.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/predicates/ZoneOperationDonePredicate.java
@@ -52,7 +52,7 @@ public class ZoneOperationDonePredicate implements Predicate<AtomicReference<Ope
@Override
public boolean apply(AtomicReference<Operation> input) {
checkNotNull(input, "input");
- Operation current = api.getZoneOperationApiForProject(project.get())
+ Operation current = api.getZoneOperationApi(project.get())
.getInZone(zones.get().get(input.get().getZone().get()).getId(),
input.get().getName());
switch (current.getStatus()) {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/PageSystemExpectTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/PageSystemExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/PageSystemExpectTest.java
index 8fa44b9..e437ffe 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/PageSystemExpectTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/PageSystemExpectTest.java
@@ -49,7 +49,7 @@ public class PageSystemExpectTest extends BaseGoogleComputeEngineApiExpectTest {
.payload(payloadFromResource("/image_list_single_page.json")).build();
ImageApi imageApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, list, operationResponse).getImageApiForProject("myproject");
+ TOKEN_RESPONSE, list, operationResponse).getImageApi("myproject");
PagedIterable<Image> images = imageApi.list();
@@ -98,7 +98,7 @@ public class PageSystemExpectTest extends BaseGoogleComputeEngineApiExpectTest {
ImageApi imageApi = orderedRequestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
TOKEN_RESPONSE, list1, list1response, list2, list2Response, list3, list3Response)
- .getImageApiForProject("myproject");
+ .getImageApi("myproject");
PagedIterable<Image> images = imageApi.list(new ListOptions.Builder().maxResults(3));
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceLiveTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceLiveTest.java
index 2011d2d..8cb05f2 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceLiveTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceLiveTest.java
@@ -65,7 +65,7 @@ public class GoogleComputeEngineServiceLiveTest extends BaseComputeServiceLiveTe
Supplier<String> userProject = context.utils().injector().getInstance(Key.get(new TypeLiteral<Supplier<String>>() {
}, UserProject.class));
ImmutableSet.Builder<String> deprecatedMachineTypes = ImmutableSet.builder();
- for (MachineType machine : api.getMachineTypeApiForProject(userProject.get())
+ for (MachineType machine : api.getMachineTypeApi(userProject.get())
.listInZone(DEFAULT_ZONE_NAME).concat()) {
if (machine.getDeprecated().isPresent()) {
deprecatedMachineTypes.add(machine.getId());
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/NetworkToSecurityGroupTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/NetworkToSecurityGroupTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/NetworkToSecurityGroupTest.java
index 795c989..3662fe9 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/NetworkToSecurityGroupTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/NetworkToSecurityGroupTest.java
@@ -60,7 +60,7 @@ public class NetworkToSecurityGroupTest {
FirewallApi fwApi = createMock(FirewallApi.class);
ListOptions options = new Builder().filter("network eq .*/jclouds-test");
- expect(api.getFirewallApiForProject(projectSupplier.get()))
+ expect(api.getFirewallApi(projectSupplier.get()))
.andReturn(fwApi);
expect(fwApi.list(options)).andReturn(PagedIterables.of(IterableWithMarkers.from(ImmutableSet.of(FirewallToIpPermissionTest.fwForTest()))));
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/loaders/FindNetworkOrCreateTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/loaders/FindNetworkOrCreateTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/loaders/FindNetworkOrCreateTest.java
index 467995f..655f763 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/loaders/FindNetworkOrCreateTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/loaders/FindNetworkOrCreateTest.java
@@ -59,7 +59,7 @@ public class FindNetworkOrCreateTest {
}
};
- expect(api.getNetworkApiForProject(userProject.get())).andReturn(nwApi).atLeastOnce();
+ expect(api.getNetworkApi(userProject.get())).andReturn(nwApi).atLeastOnce();
expect(nwApi.get("this-network")).andReturn(network);
@@ -103,18 +103,18 @@ public class FindNetworkOrCreateTest {
}
};
- expect(api.getNetworkApiForProject(userProject.get())).andReturn(nwApi).atLeastOnce();
- expect(api.getGlobalOperationApiForProject(userProject.get())).andReturn(globalApi).atLeastOnce();
+ expect(api.getNetworkApi(userProject.get())).andReturn(nwApi).atLeastOnce();
+ expect(api.getGlobalOperationApi(userProject.get())).andReturn(globalApi).atLeastOnce();
expect(nwApi.createInIPv4Range("this-network", "0.0.0.0/0"))
.andReturn(createOp);
- expect(globalApi.get("create-op")).andReturn(createOp);
+ expect(globalApi.get("insert-op")).andReturn(createOp);
// pre-creation
expect(nwApi.get("this-network")).andReturn(null).times(2);
// post-creation
expect(nwApi.get("this-network")).andReturn(network);
- expect(createOp.getName()).andReturn("create-op");
+ expect(createOp.getName()).andReturn("insert-op");
expect(createOp.getStatus()).andReturn(Operation.Status.DONE);
expect(createOp.getHttpError()).andReturn(fromNullable((HttpResponse)null));
replay(api, nwApi, createOp, globalApi);
[2/6] git commit: Added options and binders for LB apis.
Posted by ad...@apache.org.
Added options and binders for LB apis.
Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/commit/bbf953be
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/tree/bbf953be
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/diff/bbf953be
Branch: refs/heads/master
Commit: bbf953be07c0467aef095bf63cd7ee3df538fa40
Parents: ed9fc5c
Author: Daniel Broudy <br...@google.com>
Authored: Fri Oct 24 16:22:37 2014 -0700
Committer: Adrian Cole <ac...@twitter.com>
Committed: Thu Oct 30 18:54:43 2014 -0700
----------------------------------------------------------------------
.../GoogleComputeEngineApi.java | 2 +-
.../binders/ForwardingRuleCreationBinder.java | 73 +++++++
.../binders/HttpHealthCheckCreationBinder.java | 79 ++++++++
.../TargetPoolChangeHealthChecksBinder.java | 33 ++++
.../TargetPoolChangeInstancesBinder.java | 33 ++++
.../binders/TargetPoolCreationBinder.java | 75 ++++++++
.../TargetPoolMapofSetofMapGenericBinder.java | 64 +++++++
.../domain/ForwardingRule.java | 30 ++-
.../domain/HttpHealthCheck.java | 4 +-
.../googlecomputeengine/domain/TargetPool.java | 25 +--
.../features/ForwardingRuleApi.java | 53 +-----
.../features/HttpHealthCheckApi.java | 41 ++--
.../features/TargetPoolApi.java | 149 ++++++---------
.../functions/internal/ParseDiskTypes.java | 2 +-
.../options/ForwardingRuleCreationOptions.java | 116 ++++++++++++
.../options/HttpHealthCheckCreationOptions.java | 163 ++++++++++++++++
.../options/TargetPoolCreationOptions.java | 151 +++++++++++++++
.../ForwardingRuleCreationBinderTest.java | 84 +++++++++
.../HttpHealthCheckCreationBinderTest.java | 80 ++++++++
.../TargetPoolAddInstanceBinderTest.java | 75 ++++++++
.../binders/TargetPoolCreationBinderTest.java | 84 +++++++++
.../features/DiskTypeApiExpectTest.java | 8 +-
.../features/DiskTypeApiLiveTest.java | 2 +-
.../features/ForwardingRuleApiExpectTest.java | 147 +++++++++------
.../features/ForwardingRuleApiLiveTest.java | 9 +-
.../features/HttpHealthCheckApiExpectTest.java | 99 +++++++++-
.../features/HttpHealthCheckApiLiveTest.java | 4 +-
.../features/TargetPoolApiExpectTest.java | 189 ++++++++++++++++---
.../features/TargetPoolApiLiveTest.java | 16 +-
.../parse/ParseForwardingRuleListTest.java | 5 +-
.../parse/ParseForwardingRuleTest.java | 4 +-
.../parse/ParseTargetPoolListTest.java | 5 +-
.../parse/ParseTargetPoolTest.java | 4 +-
.../src/test/resources/forwardingrule_get.json | 20 +-
.../resources/forwardingrule_set_target.json | 1 +
.../test/resources/targetpool_addinstance.json | 2 +-
.../resources/targetpool_changehealthcheck.json | 1 +
.../test/resources/targetpool_setbackup.json | 1 +
38 files changed, 1647 insertions(+), 286 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/GoogleComputeEngineApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/GoogleComputeEngineApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/GoogleComputeEngineApi.java
index bbf2bda..5ba978b 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/GoogleComputeEngineApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/GoogleComputeEngineApi.java
@@ -77,7 +77,7 @@ public interface GoogleComputeEngineApi extends Closeable {
*/
@Delegate
@Path("/projects/{project}")
- DiskTypeApi getDiskTypeApiForProject(@PathParam("project") String projectName);
+ DiskTypeApi getDiskTypeApi(@PathParam("project") String projectName);
/**
* Provides access to Firewall features
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/ForwardingRuleCreationBinder.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/ForwardingRuleCreationBinder.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/ForwardingRuleCreationBinder.java
new file mode 100644
index 0000000..f8d2daa
--- /dev/null
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/ForwardingRuleCreationBinder.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecomputeengine.binders;
+
+import java.net.URI;
+import java.util.Map;
+
+import javax.inject.Inject;
+
+import org.jclouds.googlecomputeengine.domain.ForwardingRule.IPProtocolOption;
+import org.jclouds.googlecomputeengine.options.ForwardingRuleCreationOptions;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.json.Json;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+
+public class ForwardingRuleCreationBinder extends BindToJsonPayload {
+
+ @Inject ForwardingRuleCreationBinder(Json jsonBinder) {
+ super(jsonBinder);
+ }
+
+ @Override public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ ForwardingRuleCreationOptions options = (ForwardingRuleCreationOptions) postParams.get("options");
+ String name = postParams.get("name").toString();
+ ForwardingRuleCreationBinderHelper forwardingRuleCreationBinderHelper = new ForwardingRuleCreationBinderHelper(name, options);
+ return super.bindToRequest(request, forwardingRuleCreationBinderHelper);
+ }
+
+ private class ForwardingRuleCreationBinderHelper{
+
+ /**
+ * Values used to bind ForwardingRuleOptions to json request.
+ * Note: Two break convention of starting with lower case letters due to
+ * attributes on GCE starting with upper case letters.
+ */
+ @SuppressWarnings("unused")
+ private String name;
+ @SuppressWarnings("unused")
+ private String description;
+ @SuppressWarnings("unused")
+ private String IPAddress;
+ @SuppressWarnings("unused")
+ private IPProtocolOption IPProtocol;
+ @SuppressWarnings("unused")
+ private String portRange;
+ @SuppressWarnings("unused")
+ private URI target;
+
+ private ForwardingRuleCreationBinderHelper(String name, ForwardingRuleCreationOptions forwardingRuleCreationOptions){
+ this.name = name;
+ this.description = forwardingRuleCreationOptions.getDescription();
+ this.IPAddress = forwardingRuleCreationOptions.getIPAddress();
+ this.IPProtocol = forwardingRuleCreationOptions.getIPProtocol();
+ this.portRange = forwardingRuleCreationOptions.getPortRange();
+ this.target = forwardingRuleCreationOptions.getTarget();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/HttpHealthCheckCreationBinder.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/HttpHealthCheckCreationBinder.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/HttpHealthCheckCreationBinder.java
new file mode 100644
index 0000000..3da57cd
--- /dev/null
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/HttpHealthCheckCreationBinder.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecomputeengine.binders;
+
+import java.util.Map;
+
+import javax.inject.Inject;
+
+import org.jclouds.googlecomputeengine.options.HttpHealthCheckCreationOptions;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.json.Json;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+
+public class HttpHealthCheckCreationBinder extends BindToJsonPayload {
+
+ @Inject HttpHealthCheckCreationBinder(Json jsonBinder) {
+ super(jsonBinder);
+ }
+
+ @Override public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ HttpHealthCheckCreationOptions options = (HttpHealthCheckCreationOptions) postParams.get("options");
+ String name = postParams.get("name").toString();
+ HttpHealthCheckBinderHelper helper = new HttpHealthCheckBinderHelper(name, options);
+ return super.bindToRequest(request, helper);
+ }
+
+ private class HttpHealthCheckBinderHelper{
+
+ /**
+ * Values used to bind HttpHealthCheckCreationOptions to json request.
+ */
+ @SuppressWarnings("unused")
+ private String name;
+ @SuppressWarnings("unused")
+ private String host;
+ @SuppressWarnings("unused")
+ private String requestPath;
+ @SuppressWarnings("unused")
+ private Integer port;
+ @SuppressWarnings("unused")
+ private Integer checkIntervalSec;
+ @SuppressWarnings("unused")
+ private Integer timeoutSec;
+ @SuppressWarnings("unused")
+ private Integer unhealthyThreshold;
+ @SuppressWarnings("unused")
+ private Integer healthyThreshold;
+ @SuppressWarnings("unused")
+ private String description;
+
+ private HttpHealthCheckBinderHelper(String name, HttpHealthCheckCreationOptions httpHealthCheckCreationOptions){
+ this.name = name;
+ this.host = httpHealthCheckCreationOptions.getHost();
+ this.requestPath = httpHealthCheckCreationOptions.getHost();
+ this.port = httpHealthCheckCreationOptions.getPort();
+ this.checkIntervalSec = httpHealthCheckCreationOptions.getCheckIntervalSec();
+ this.timeoutSec = httpHealthCheckCreationOptions.getTimeoutSec();
+ this.unhealthyThreshold = httpHealthCheckCreationOptions.getUnhealthyThreshold();
+ this.healthyThreshold = httpHealthCheckCreationOptions.getHealthyThreshold();
+ this.description = httpHealthCheckCreationOptions.getDescription();
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/TargetPoolChangeHealthChecksBinder.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/TargetPoolChangeHealthChecksBinder.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/TargetPoolChangeHealthChecksBinder.java
new file mode 100644
index 0000000..0eee860
--- /dev/null
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/TargetPoolChangeHealthChecksBinder.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecomputeengine.binders;
+
+import javax.inject.Inject;
+
+import org.jclouds.json.Json;
+
+/**
+ * Binder used for adding and deleting healthChecks from a target pool.
+ */
+public class TargetPoolChangeHealthChecksBinder extends TargetPoolMapofSetofMapGenericBinder {
+
+ @Inject TargetPoolChangeHealthChecksBinder(Json jsonBinder) {
+ super(jsonBinder);
+ super.SetOuterString("healthChecks");
+ super.SetInnerString("healthCheck");
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/TargetPoolChangeInstancesBinder.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/TargetPoolChangeInstancesBinder.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/TargetPoolChangeInstancesBinder.java
new file mode 100644
index 0000000..5551172
--- /dev/null
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/TargetPoolChangeInstancesBinder.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecomputeengine.binders;
+
+import javax.inject.Inject;
+
+import org.jclouds.json.Json;
+
+/**
+ * Binder used for adding and deleting instances from a target pool.
+ */
+public class TargetPoolChangeInstancesBinder extends TargetPoolMapofSetofMapGenericBinder {
+
+ @Inject TargetPoolChangeInstancesBinder(Json jsonBinder) {
+ super(jsonBinder);
+ super.SetOuterString("instances");
+ super.SetInnerString("instance");
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/TargetPoolCreationBinder.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/TargetPoolCreationBinder.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/TargetPoolCreationBinder.java
new file mode 100644
index 0000000..67c4832
--- /dev/null
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/TargetPoolCreationBinder.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecomputeengine.binders;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.Set;
+
+import javax.inject.Inject;
+
+import org.jclouds.googlecomputeengine.options.TargetPoolCreationOptions;
+import org.jclouds.googlecomputeengine.options.TargetPoolCreationOptions.SessionAffinityValue;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.json.Json;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+
+public class TargetPoolCreationBinder extends BindToJsonPayload {
+
+ @Inject TargetPoolCreationBinder(Json jsonBinder) {
+ super(jsonBinder);
+ }
+
+ @Override public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ TargetPoolCreationOptions options = (TargetPoolCreationOptions) postParams.get("options");
+ String name = postParams.get("name").toString();
+ TargetPoolBinderHelper targetPoolBinderHelper = new TargetPoolBinderHelper(name, options);
+ return super.bindToRequest(request, targetPoolBinderHelper);
+ }
+
+ private class TargetPoolBinderHelper{
+
+ /**
+ * Values used to bind TargetPoolCreationOptions to json request.
+ */
+ @SuppressWarnings("unused")
+ private String name;
+ @SuppressWarnings("unused")
+ private Set<URI> healthChecks;
+ @SuppressWarnings("unused")
+ private Set<URI> instances;
+ @SuppressWarnings("unused")
+ private SessionAffinityValue sessionAffinity;
+ @SuppressWarnings("unused")
+ private Float failoverRatio;
+ @SuppressWarnings("unused")
+ private URI backupPool;
+ @SuppressWarnings("unused")
+ private String description;
+
+ private TargetPoolBinderHelper(String name, TargetPoolCreationOptions targetPoolCreationOptions){
+ this.name = name;
+ this.healthChecks = targetPoolCreationOptions.getHealthChecks();
+ this.instances = targetPoolCreationOptions.getInstances();
+ this.sessionAffinity = targetPoolCreationOptions.getSessionAffinity();
+ this.failoverRatio = targetPoolCreationOptions.getFailoverRatio();
+ this.backupPool = targetPoolCreationOptions.getBackupPool();
+ this.description = targetPoolCreationOptions.getDescription();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/TargetPoolMapofSetofMapGenericBinder.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/TargetPoolMapofSetofMapGenericBinder.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/TargetPoolMapofSetofMapGenericBinder.java
new file mode 100644
index 0000000..a87891e
--- /dev/null
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/TargetPoolMapofSetofMapGenericBinder.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecomputeengine.binders;
+
+import java.net.URI;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.json.Json;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import com.google.common.collect.ImmutableMap;
+
+
+public class TargetPoolMapofSetofMapGenericBinder extends BindToJsonPayload {
+
+ @Inject TargetPoolMapofSetofMapGenericBinder(Json jsonBinder) {
+ super(jsonBinder);
+ }
+ private String outterString;
+ private String innerString;
+
+ public void SetOuterString(String outterString){
+ this.outterString = outterString;
+ }
+
+ public void SetInnerString(String innerString){
+ this.innerString = innerString;
+ }
+
+ /**
+ * For the addInstance request the request body is in an atypical form.
+ * @see <a href="https://cloud.google.com/compute/docs/reference/latest/targetPools/addInstance"/>
+ */
+ @Override public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ Set<URI> instances = (Set<URI>) postParams.get(outterString);
+ Map<String, Set<Map<String, URI>>> finalInstances = new HashMap<String, Set<Map<String, URI>>>();
+ Set<Map<String, URI>> innerInstances = new HashSet<Map<String, URI>>();
+ for (URI instance : instances){
+ innerInstances.add(ImmutableMap.of(innerString, instance));
+ }
+ finalInstances.put(outterString, innerInstances);
+ return super.bindToRequest(request, finalInstances);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/ForwardingRule.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/ForwardingRule.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/ForwardingRule.java
index 6bafba8..fd59a95 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/ForwardingRule.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/ForwardingRule.java
@@ -17,7 +17,7 @@
package org.jclouds.googlecomputeengine.domain;
import com.google.common.annotations.Beta;
-import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
import com.google.common.base.Optional;
import java.beans.ConstructorProperties;
@@ -33,9 +33,25 @@ import org.jclouds.javax.annotation.Nullable;
@Beta
public class ForwardingRule extends Resource {
+
+ /**
+ * "AH": Specifies the IP Authentication Header protocol.
+ * "ESP": Specifies the IP Encapsulating Security Payload protocol.
+ * "SCTP": Specifies the Stream Control Transmission Protocol.
+ * "TCP": Specifies the Transmission Control Protocol.
+ * "UDP": Specifies the User Datagram Protocol.
+ */
+ public enum IPProtocolOption {
+ AH,
+ ESP,
+ SCTP,
+ TCP,
+ UDP
+ }
+
private final URI region;
private final Optional<String> ipAddress;
- private final Optional<String> ipProtocol;
+ private final Optional<IPProtocolOption> ipProtocol;
private final Optional<String> portRange;
private final URI target;
@@ -44,7 +60,7 @@ public class ForwardingRule extends Resource {
"portRange", "target"
})
private ForwardingRule(String id, Date creationTimestamp, URI selfLink, String name, String description,
- URI region, @Nullable String ipAddress, @Nullable String ipProtocol, @Nullable String portRange,
+ URI region, @Nullable String ipAddress, @Nullable IPProtocolOption ipProtocol, @Nullable String portRange,
URI target) {
super(Kind.FORWARDING_RULE, id, creationTimestamp, selfLink, name, description);
this.region = checkNotNull(region, "region of %s", name);
@@ -77,7 +93,7 @@ public class ForwardingRule extends Resource {
/**
* @return the IP protocol to which this rule applies. If left empty, the default value used is TCP.
*/
- public Optional<String> getIpProtocol() {
+ public Optional<IPProtocolOption> getIpProtocol() {
return ipProtocol;
}
@@ -114,7 +130,7 @@ public class ForwardingRule extends Resource {
* {@inheritDoc}
*/
@Override
- protected MoreObjects.ToStringHelper string() {
+ protected Objects.ToStringHelper string() {
return super.string()
.omitNullValues()
.add("region", region)
@@ -131,7 +147,7 @@ public class ForwardingRule extends Resource {
public static final class Builder extends Resource.Builder<Builder> {
private URI region;
private String ipAddress;
- private String ipProtocol;
+ private IPProtocolOption ipProtocol;
private String portRange;
private URI target;
@@ -154,7 +170,7 @@ public class ForwardingRule extends Resource {
/**
* @see org.jclouds.googlecomputeengine.domain.ForwardingRule#getIpProtocol()
*/
- public Builder ipProtocol(String ipProtocol) {
+ public Builder ipProtocol(IPProtocolOption ipProtocol) {
this.ipProtocol = ipProtocol;
return this;
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/HttpHealthCheck.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/HttpHealthCheck.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/HttpHealthCheck.java
index 92d39b8..8e0096a 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/HttpHealthCheck.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/HttpHealthCheck.java
@@ -17,7 +17,7 @@
package org.jclouds.googlecomputeengine.domain;
import com.google.common.annotations.Beta;
-import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
import com.google.common.base.Optional;
import java.beans.ConstructorProperties;
@@ -128,7 +128,7 @@ public class HttpHealthCheck extends Resource {
* {@inheritDoc}
*/
@Override
- protected MoreObjects.ToStringHelper string() {
+ protected Objects.ToStringHelper string() {
return super.string()
.omitNullValues()
.add("host", host.orNull())
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/TargetPool.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/TargetPool.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/TargetPool.java
index ff0c770..923ed03 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/TargetPool.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/TargetPool.java
@@ -17,7 +17,7 @@
package org.jclouds.googlecomputeengine.domain;
import com.google.common.annotations.Beta;
-import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableSet;
@@ -30,6 +30,7 @@ import static com.google.common.base.Objects.equal;
import static com.google.common.base.Optional.fromNullable;
import static com.google.common.base.Preconditions.checkNotNull;
+import org.jclouds.googlecomputeengine.options.TargetPoolCreationOptions.SessionAffinityValue;
import org.jclouds.javax.annotation.Nullable;
/**
@@ -41,17 +42,17 @@ public final class TargetPool extends Resource {
private final URI region;
private final Set<URI> healthChecks;
private final Set<URI> instances;
- private final Optional<String> sessionAffinity;
+ private final Optional<SessionAffinityValue> sessionAffinity;
private final float failoverRatio;
- private final Optional<String> backupPool;
+ private final Optional<URI> backupPool;
@ConstructorProperties({
"id", "creationTimestamp", "selfLink", "name", "description", "region", "healthChecks", "instances",
"sessionAffinity", "failoverRatio", "backupPool"
})
private TargetPool(String id, Date creationTimestamp, URI selfLink, String name, String description,
- URI region, Set<URI> healthChecks, Set<URI> instances, @Nullable String sessionAffinity,
- float failoverRatio, @Nullable String backupPool) {
+ URI region, Set<URI> healthChecks, Set<URI> instances, @Nullable SessionAffinityValue sessionAffinity,
+ float failoverRatio, @Nullable URI backupPool) {
super(Kind.TARGET_POOL, id, creationTimestamp, selfLink, name, description);
this.region = checkNotNull(region, "region of %s", name);
this.healthChecks = healthChecks == null ? ImmutableSet.<URI>of() : healthChecks;
@@ -94,7 +95,7 @@ public final class TargetPool extends Resource {
* @return the session affinity option, determines the hash method that Google Compute Engine uses to
* distribute traffic.
*/
- public Optional<String> getSessionAffinity() {
+ public Optional<SessionAffinityValue> getSessionAffinity() {
return sessionAffinity;
}
@@ -123,7 +124,7 @@ public final class TargetPool extends Resource {
* or to all VMs when no VM is healthy.
* @return the backup pool
*/
- public Optional<String> getBackupPool() {
+ public Optional<URI> getBackupPool() {
return backupPool;
}
@@ -144,7 +145,7 @@ public final class TargetPool extends Resource {
* {@inheritDoc}
*/
@Override
- protected MoreObjects.ToStringHelper string() {
+ protected Objects.ToStringHelper string() {
return super.string()
.omitNullValues()
.add("region", region)
@@ -163,9 +164,9 @@ public final class TargetPool extends Resource {
private URI region;
private ImmutableSet.Builder<URI> healthChecks = ImmutableSet.builder();
private ImmutableSet.Builder<URI> instances = ImmutableSet.builder();
- private String sessionAffinity;
+ private SessionAffinityValue sessionAffinity;
private float failoverRatio;
- private String backupPool;
+ private URI backupPool;
/**
* @see TargetPool#getRegion()
@@ -194,7 +195,7 @@ public final class TargetPool extends Resource {
/**
* @see TargetPool#getSessionAffinity()
*/
- public Builder sessionAffinity(String sessionAffinity) {
+ public Builder sessionAffinity(SessionAffinityValue sessionAffinity) {
this.sessionAffinity = sessionAffinity;
return this;
}
@@ -207,7 +208,7 @@ public final class TargetPool extends Resource {
return this;
}
- public Builder backupPool(String backupPool) {
+ public Builder backupPool(URI backupPool) {
this.backupPool = backupPool;
return this;
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApi.java
index c474286..8e1b630 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApi.java
@@ -24,6 +24,8 @@ import org.jclouds.googlecomputeengine.domain.ForwardingRule;
import org.jclouds.googlecomputeengine.domain.Operation;
import org.jclouds.googlecomputeengine.functions.internal.ParseForwardingRules;
import org.jclouds.googlecomputeengine.options.ListOptions;
+import org.jclouds.googlecomputeengine.options.ForwardingRuleCreationOptions;
+import org.jclouds.googlecomputeengine.binders.ForwardingRuleCreationBinder;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.oauth.v2.config.OAuthScopes;
import org.jclouds.oauth.v2.filters.OAuthAuthenticator;
@@ -46,7 +48,6 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
-import java.net.URI;
import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE;
import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_SCOPE;
@@ -87,56 +88,10 @@ public interface ForwardingRuleApi {
@Produces(MediaType.APPLICATION_JSON)
@Path("/forwardingRules")
@OAuthScopes(COMPUTE_SCOPE)
- @MapBinder(BindToJsonPayload.class)
- Operation create(@PayloadParam("name") String forwardingRuleName,
- @PayloadParam("target") URI targetSelfLink);
-
- /**
- * Creates a ForwardingRule resource in the specified project and region using the data included in the request.
- *
- * @param forwardingRuleName the name of the forwarding rule.
- * @param targetSelfLink the URL of the target resource to receive the matched traffic. The target resource must live
- * in the same region as this forwarding rule.
- * @param portRange If IPProtocol is TCP or UDP, packets addressed to ports in the specified range will be
- * forwarded to backend. By default, this is empty and all ports are allowed.
- * @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
- * you, and look for the status field.
- */
- @Named("ForwardingRules:insert")
- @POST
- @Produces(MediaType.APPLICATION_JSON)
- @Path("/forwardingRules")
- @OAuthScopes(COMPUTE_SCOPE)
- @MapBinder(BindToJsonPayload.class)
+ @MapBinder(ForwardingRuleCreationBinder.class)
Operation create(@PayloadParam("name") String forwardingRuleName,
- @PayloadParam("target") URI targetSelfLink,
- @PayloadParam("portRange") String portRange);
+ @PayloadParam("options") ForwardingRuleCreationOptions options);
- /**
- * Creates a ForwardingRule resource in the specified project and region using the data included in the request.
- *
- * @param forwardingRuleName the name of the forwarding rule.
- * @param targetSelfLink the URL of the target resource to receive the matched traffic. The target resource must live
- * in the same region as this forwarding rule.
- * @param portRange If IPProtocol is TCP or UDP, packets addressed to ports in the specified range will be
- * forwarded to backend. By default, this is empty and all ports are allowed.
- * @param ipAddress the external IP address that this forwarding rule is serving on behalf of. If this is a
- * reserved address, the address must live in the same region as the forwarding rule. By default, this field is empty and an ephemeral IP is assigned to the ForwardingRule.
- * @param ipProtocol the IP protocol to which this rule applies. If left empty, the default value used is TCP.
- * @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
- * you, and look for the status field.
- */
- @Named("ForwardingRules:insert")
- @POST
- @Produces(MediaType.APPLICATION_JSON)
- @Path("/forwardingRules")
- @OAuthScopes(COMPUTE_SCOPE)
- @MapBinder(BindToJsonPayload.class)
- Operation create(@PayloadParam("name") String forwardingRuleName,
- @PayloadParam("target") URI targetSelfLink,
- @PayloadParam("portRange") String portRange,
- @PayloadParam("IPAddress") String ipAddress,
- @PayloadParam("IPProtocol") String ipProtocol);
/**
* Deletes the specified TargetPool resource.
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApi.java
index d562827..d31c6d0 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApi.java
@@ -20,9 +20,11 @@ import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.collect.IterableWithMarker;
import org.jclouds.collect.PagedIterable;
+import org.jclouds.googlecomputeengine.binders.HttpHealthCheckCreationBinder;
import org.jclouds.googlecomputeengine.domain.HttpHealthCheck;
import org.jclouds.googlecomputeengine.domain.Operation;
import org.jclouds.googlecomputeengine.functions.internal.ParseHttpHealthChecks;
+import org.jclouds.googlecomputeengine.options.HttpHealthCheckCreationOptions;
import org.jclouds.googlecomputeengine.options.ListOptions;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.oauth.v2.config.OAuthScopes;
@@ -42,6 +44,7 @@ import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
@@ -84,7 +87,6 @@ public interface HttpHealthCheckApi {
@Produces(MediaType.APPLICATION_JSON)
@OAuthScopes(COMPUTE_SCOPE)
@MapBinder(BindToJsonPayload.class)
- @Fallback(NullOnNotFoundOr404.class)
Operation insert(@PayloadParam("name") String httpHealthCheckName);
/**
@@ -98,10 +100,8 @@ public interface HttpHealthCheckApi {
@POST
@Produces(MediaType.APPLICATION_JSON)
@OAuthScopes(COMPUTE_SCOPE)
- @MapBinder(BindToJsonPayload.class)
- @Fallback(NullOnNotFoundOr404.class)
- Operation insert(@PayloadParam("name") String httpHealthCheckName, @PayloadParam("timeoutSec") int
- timeoutSec, @PayloadParam("unhealthyThreshold") int unhealthyThreshold);
+ @MapBinder(HttpHealthCheckCreationBinder.class)
+ Operation insert(@PayloadParam("name") String name, @PayloadParam("options") HttpHealthCheckCreationOptions options);
/**
* Deletes the specified TargetPool resource.
@@ -142,10 +142,11 @@ public interface HttpHealthCheckApi {
IterableWithMarker<HttpHealthCheck> list(ListOptions options);
/**
- * Changes target url for forwarding rule.
- *
- * @param httpHealthCheck the name of the HttpHealthCheck resource to update.
+ * Updates a HttpHealthCheck resource in the specified project
+ * using the data included in the request. This method supports patch semantics.
*
+ * @param name the name of the HttpHealthCheck resource to update.
+ * @param options the options to set for the healthCheck
* @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
* you, and look for the status field.
*/
@@ -153,8 +154,26 @@ public interface HttpHealthCheckApi {
@PATCH
@Path("/{httpHealthCheck}")
@OAuthScopes(COMPUTE_SCOPE)
- @Fallback(NullOnNotFoundOr404.class)
- @MapBinder(BindToJsonPayload.class)
+ @MapBinder(HttpHealthCheckCreationBinder.class)
@Nullable
- Operation patch(@PathParam("httpHealthCheck") String httpHealthCheck);
+ Operation patch(@PathParam("httpHealthCheck") @PayloadParam("name") String name, @PayloadParam("options") HttpHealthCheckCreationOptions options);
+
+ /**
+ * Updates a HttpHealthCheck resource in the specified project using the data included in the request.
+ * Any options left blank will be overwritten!
+ *
+ * @param name the name of the forwarding rule.
+ * @param options the options to set for the healthCheck
+ * @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
+ * you, and look for the status field.
+ */
+ @Named("HttpHealthChecks:update")
+ @PUT
+ @Path("/{httpHealthCheck}")
+ @Produces(MediaType.APPLICATION_JSON)
+ @OAuthScopes(COMPUTE_SCOPE)
+ @MapBinder(HttpHealthCheckCreationBinder.class)
+ Operation update(@PathParam("httpHealthCheck") @PayloadParam("name") String name,
+ @PayloadParam("options") HttpHealthCheckCreationOptions options);
+
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetPoolApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetPoolApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetPoolApi.java
index e5f282d..3e19eda 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetPoolApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetPoolApi.java
@@ -16,6 +16,9 @@
*/
package org.jclouds.googlecomputeengine.features;
+import java.net.URI;
+import java.util.Set;
+
import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.collect.IterableWithMarker;
@@ -24,6 +27,10 @@ import org.jclouds.googlecomputeengine.domain.Operation;
import org.jclouds.googlecomputeengine.domain.TargetPool;
import org.jclouds.googlecomputeengine.functions.internal.ParseTargetPools;
import org.jclouds.googlecomputeengine.options.ListOptions;
+import org.jclouds.googlecomputeengine.options.TargetPoolCreationOptions;
+import org.jclouds.googlecomputeengine.binders.TargetPoolChangeHealthChecksBinder;
+import org.jclouds.googlecomputeengine.binders.TargetPoolChangeInstancesBinder;
+import org.jclouds.googlecomputeengine.binders.TargetPoolCreationBinder;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.oauth.v2.config.OAuthScopes;
import org.jclouds.oauth.v2.filters.OAuthAuthenticator;
@@ -44,9 +51,8 @@ import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
-import java.net.URI;
-import java.util.List;
import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE;
import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_SCOPE;
@@ -77,6 +83,7 @@ public interface TargetPoolApi {
* Creates a TargetPool resource in the specified project and region using the data included in the request.
*
* @param targetPoolName the name of the targetPool.
+ * @param the options of the TargetPool to create.
* @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
* you, and look for the status field.
*/
@@ -85,78 +92,9 @@ public interface TargetPoolApi {
@Produces(MediaType.APPLICATION_JSON)
@Path("/targetPools")
@OAuthScopes(COMPUTE_SCOPE)
- @MapBinder(BindToJsonPayload.class)
- Operation create(@PayloadParam("name") String targetPoolName);
-
- /**
- * Creates a TargetPool resource in the specified project and region using the data included in the request.
- *
- * @param targetPoolName the name of the targetPool.
- * @param instances A list of resource URLs to the member VMs serving this pool. They must live in zones
- * contained in the same region as this pool.
- * @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
- * you, and look for the status field.
- */
- @Named("TargetPools:insert")
- @POST
- @Produces(MediaType.APPLICATION_JSON)
- @Path("/targetPools")
- @OAuthScopes(COMPUTE_SCOPE)
- @MapBinder(BindToJsonPayload.class)
- Operation create(@PayloadParam("name") String targetPoolName, @PayloadParam("instances") List<URI> instances);
-
- /**
- * Creates a TargetPool resource in the specified project and region using the data included in the request.
- *
- * @param targetPoolName the name of the targetPool.
- * @param instances A list of resource URLs to the member VMs serving this pool. They must live in zones
- * contained in the same region as this pool.
- * @param healthChecks A URL to one HttpHealthCheck resource. A member VM in this pool is considered healthy if
- * and only if the specified health checks pass. An empty list means all member virtual
- * machines will be considered healthy at all times but the health status of this target
- * pool will be marked as unhealthy to indicate that no health checks are being performed.
- * @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
- * you, and look for the status field.
- */
- @Named("TargetPools:insert")
- @POST
- @Produces(MediaType.APPLICATION_JSON)
- @Path("/targetPools")
- @OAuthScopes(COMPUTE_SCOPE)
- @MapBinder(BindToJsonPayload.class)
- Operation create(@PayloadParam("name") String targetPoolName, @PayloadParam("instances") List<URI> instances,
- @PayloadParam("healthChecks") List<URI> healthChecks);
-
- /**
- * Creates a TargetPool resource in the specified project and region using the data included in the request.
- *
- * @param targetPoolName the name of the targetPool.
- * @param instances A list of resource URLs to the member VMs serving this pool. They must live in zones
- * contained in the same region as this pool.
- * @param healthChecks A URL to one HttpHealthCheck resource. A member VM in this pool is considered healthy if
- * and only if the specified health checks pass. An empty list means all member virtual
- * machines will be considered healthy at all times but the health status of this target
- * pool will be marked as unhealthy to indicate that no health checks are being performed.
- * @param backupPool it is applicable only when the target pool is serving a forwarding rule as the primary pool.
- * Must be a fully-qualified URL to a target pool that is in the same region as the primary
- * target pool.
- * @param sessionAffinity Defines the session affinity option. Session affinity determines the hash method that
- * Google Compute Engine uses to distribute traffic. Acceptable values are:
- * "CLIENT_IP": Connections from the same client IP are guaranteed to go to the same VM in the pool while that VM remains healthy.
- * "CLIENT_IP_PROTO": Connections from the same client IP and port are guaranteed to go to the same VM in the pool while that VM remains healthy.
- * "NONE": Connections from the same client IP may go to any VM in the pool.
- * @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
- * you, and look for the status field.
- */
- @Named("TargetPools:insert")
- @POST
- @Produces(MediaType.APPLICATION_JSON)
- @Path("/targetPools")
- @OAuthScopes(COMPUTE_SCOPE)
- @MapBinder(BindToJsonPayload.class)
- Operation create(@PayloadParam("name") String targetPoolName, @PayloadParam("instances") List<URI> instances,
- @PayloadParam("healthChecks") List<URI> healthChecks, @PayloadParam("backupPool") String backupPool,
- @PayloadParam("sessionAffinity") String sessionAffinity);
+ @MapBinder(TargetPoolCreationBinder.class)
+ Operation create(@PayloadParam("name") String targetPoolName,
+ @PayloadParam("options") TargetPoolCreationOptions targetPoolCreationOptions);
/**
* Deletes the specified TargetPool resource.
@@ -211,10 +149,26 @@ public interface TargetPoolApi {
@POST
@Path("/targetPools/{targetPool}/addInstance")
@OAuthScopes(COMPUTE_SCOPE)
- @Fallback(NullOnNotFoundOr404.class)
- @MapBinder(BindToJsonPayload.class)
+ @MapBinder(TargetPoolChangeInstancesBinder.class)
+ @Nullable
+ Operation addInstance(@PathParam("targetPool") String targetPool, @PayloadParam("instances") Set<URI> instances);
+
+ /**
+ * Removes instance URL from targetPool.
+ *
+ * @param targetPool the name of the target pool.
+ * @param instanceName the name for the instance to be removed from targetPool.
+ *
+ * @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
+ * you, and look for the status field.
+ */
+ @Named("TargetPools:removeInstance")
+ @POST
+ @Path("/targetPools/{targetPool}/removeInstance")
+ @OAuthScopes(COMPUTE_SCOPE)
+ @MapBinder(TargetPoolChangeInstancesBinder.class)
@Nullable
- Operation addInstance(@PathParam("targetPool") String targetPool, @PayloadParam("instance") String instanceName);
+ Operation removeInstance(@PathParam("targetPool") String targetPool, @PayloadParam("instances") Set<URI> instances);
/**
* Adds health check URL to targetPool.
@@ -229,28 +183,28 @@ public interface TargetPoolApi {
@POST
@Path("/targetPools/{targetPool}/addHealthCheck")
@OAuthScopes(COMPUTE_SCOPE)
- @Fallback(NullOnNotFoundOr404.class)
- @MapBinder(BindToJsonPayload.class)
+ @MapBinder(TargetPoolChangeHealthChecksBinder.class)
@Nullable
- Operation addHealthCheck(@PathParam("targetPool") String targetPool, @PayloadParam("healthCheck") String healthCheck);
+ Operation addHealthCheck(@PathParam("targetPool") String targetPool, @PayloadParam("healthChecks") Set<URI> healthChecks);
+
/**
- * Removes instance URL from targetPool.
+ * Removes health check URL from targetPool.
*
* @param targetPool the name of the target pool.
- * @param instanceName the name for the instance to be removed from targetPool.
+ * @param the name for the instance to be removed from targetPool.
*
* @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
* you, and look for the status field.
*/
- @Named("TargetPools:removeInstance")
+ @Named("TargetPools:removeHealthChek")
@POST
- @Path("/targetPools/{targetPool}/removeInstance")
+ @Path("/targetPools/{targetPool}/removeHealthCheck")
@OAuthScopes(COMPUTE_SCOPE)
- @Fallback(NullOnNotFoundOr404.class)
- @MapBinder(BindToJsonPayload.class)
+ @MapBinder(TargetPoolChangeHealthChecksBinder.class)
@Nullable
- Operation removeInstance(@PathParam("targetPool") String targetPool, @PayloadParam("instanceName") String instanceName);
+ Operation removeHealthCheck(@PathParam("targetPool") String targetPool, @PayloadParam("healthChecks") Set<URI> healthChecks);
+
/**
* Changes backup pool configurations.
@@ -265,8 +219,25 @@ public interface TargetPoolApi {
@POST
@Path("/targetPools/{targetPool}/setBackup")
@OAuthScopes(COMPUTE_SCOPE)
- @Fallback(NullOnNotFoundOr404.class)
@MapBinder(BindToJsonPayload.class)
@Nullable
- Operation setBackup(@PathParam("targetPool") String targetPool, @PayloadParam("target") String target);
+ Operation setBackup(@PathParam("targetPool") String targetPool, @PayloadParam("target") URI target);
+
+ /**
+ * Changes backup pool configurations.
+ *
+ * @param targetPool the name of the target pool.
+ * @param target the URL of target pool for which you want to use as backup.
+ *
+ * @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
+ * you, and look for the status field.
+ */
+ @Named("TargetPools:setBackup")
+ @POST
+ @Path("/targetPools/{targetPool}/setBackup")
+ @OAuthScopes(COMPUTE_SCOPE)
+ @MapBinder(BindToJsonPayload.class)
+ @Nullable
+ Operation setBackup(@PathParam("targetPool") String targetPool, @QueryParam("failoverRatio") Float failoverRatio, @PayloadParam("target") URI target);
+
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseDiskTypes.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseDiskTypes.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseDiskTypes.java
index e697399..891519d 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseDiskTypes.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseDiskTypes.java
@@ -55,7 +55,7 @@ public class ParseDiskTypes extends ParseJson<ListPage<DiskType>> {
@Override
public IterableWithMarker<DiskType> apply(Object input) {
- return api.getDiskTypeApiForProject(project)
+ return api.getDiskTypeApi(project)
.listAtMarkerInZone(zone, input.toString(), options);
}
};
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/ForwardingRuleCreationOptions.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/ForwardingRuleCreationOptions.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/ForwardingRuleCreationOptions.java
new file mode 100644
index 0000000..166566a
--- /dev/null
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/ForwardingRuleCreationOptions.java
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecomputeengine.options;
+
+import java.net.URI;
+
+import org.jclouds.googlecomputeengine.domain.ForwardingRule.IPProtocolOption;
+
+/**
+ * Options for creating a Forwarding Rule
+ */
+public class ForwardingRuleCreationOptions{
+
+ private String description;
+ private String ipAddress;
+ private IPProtocolOption ipProtocol;
+ private String portRange;
+ private URI target;
+
+ /**
+ * An optional textual description of the TargetPool.
+ * @return description, provided by the client.
+ */
+ public String getDescription(){
+ return description;
+ }
+
+ /**
+ * The external IP address that this forwarding rule is serving on behalf of
+ * @return ipAddress
+ */
+ public String getIPAddress(){
+ return ipAddress;
+ }
+
+ /**
+ * The IP protocol to which this rule applies
+ * @return ipProtocol
+ */
+ public IPProtocolOption getIPProtocol(){
+ return ipProtocol;
+ }
+
+ /**
+ * If IPProtocol is TCP or UDP, packets addressed to ports in the specified range
+ * will be forwarded to backend. By default, this is empty and all ports are allowed.
+ * @return portRange
+ */
+ public String getPortRange(){
+ return portRange;
+ }
+
+ /**
+ * The URL of the target resource to receive the matched traffic.
+ * The target resource must live in the same region as this forwarding rule.
+ * @return target
+ */
+ public URI getTarget(){
+ return target;
+ }
+
+ /**
+ * @see ForwardingRuleCreationOptions#getDescription()
+ */
+ public ForwardingRuleCreationOptions description(String description){
+ this.description = description;
+ return this;
+ }
+
+ /**
+ * @see ForwardingRuleCreationOptions#getIPAddress()
+ */
+ public ForwardingRuleCreationOptions ipAddress(String ipAddress){
+ this.ipAddress = ipAddress;
+ return this;
+ }
+
+ /**
+ * @see ForwardingRuleCreationOptions#getIPProtocol()
+ */
+ public ForwardingRuleCreationOptions ipProtocol(IPProtocolOption ipProtocol){
+ this.ipProtocol = ipProtocol;
+ return this;
+ }
+
+ /**
+ * @see ForwardingRuleCreationOptions#getPortRange()
+ */
+ public ForwardingRuleCreationOptions portRange(String portRange){
+ this.portRange = portRange;
+ return this;
+ }
+
+ /**
+ * @see ForwardingRuleCreationOptions#getTarget()
+ */
+ public ForwardingRuleCreationOptions target(URI target){
+ this.target = target;
+ return this;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/HttpHealthCheckCreationOptions.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/HttpHealthCheckCreationOptions.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/HttpHealthCheckCreationOptions.java
new file mode 100644
index 0000000..3f16f96
--- /dev/null
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/HttpHealthCheckCreationOptions.java
@@ -0,0 +1,163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecomputeengine.options;
+
+/**
+ * Options for creating a Health Check
+ */
+public class HttpHealthCheckCreationOptions {
+
+ private String host;
+ private String requestPath;
+ private Integer port;
+ private Integer checkIntervalSec;
+ private Integer timeoutSec;
+ private Integer unhealthyThreshold;
+ private Integer healthyThreshold;
+ private String description;
+
+ /**
+ * The value of the host header in the HTTP health check request.
+ * @return host
+ */
+ public String getHost(){
+ return host;
+ }
+
+ /**
+ * The request path of the HTTP health check request. The default value is /.
+ * @return requestPath
+ */
+ public String getRequestPath(){
+ return requestPath;
+ }
+
+ /**
+ * The TCP port number for the HTTP health check request. The default value is 80.
+ * @return port
+ */
+ public Integer getPort(){
+ return port;
+ }
+
+ /**
+ * How often (in seconds) to send a health check. The default value is 5 seconds.
+ * @return checkIntervalSec
+ */
+ public Integer getCheckIntervalSec(){
+ return checkIntervalSec;
+ }
+
+ /**
+ * How long (in seconds) to wait before claiming failure. The default value is 5 seconds.
+ * @return timeoutSec
+ */
+ public Integer getTimeoutSec(){
+ return timeoutSec;
+ }
+
+ /**
+ * A so-far healthy VM will be marked unhealthy after this many consecutive failures.
+ * The default value is 2.
+ * @return unhealthyThreashold
+ */
+ public Integer getUnhealthyThreshold(){
+ return unhealthyThreshold;
+ }
+
+ /**
+ * An unhealthy VM will be marked healthy after this many consecutive successes.
+ * The default value is 2.
+ * @return healthyThreashold
+ */
+ public Integer getHealthyThreshold(){
+ return healthyThreshold;
+ }
+
+ /**
+ * An optional textual description of the TargetPool.
+ * @return description, provided by the client.
+ */
+ public String getDescription(){
+ return description;
+ }
+
+ /**
+ * @see HttpHealthCheckCreationOptions#getHost()
+ */
+ public HttpHealthCheckCreationOptions host(String host){
+ this.host = host;
+ return this;
+ }
+
+ /**
+ * @see HttpHealthCheckCreationOptions#getRequestPath()
+ */
+ public HttpHealthCheckCreationOptions requestPath(String requestPath){
+ this.requestPath = requestPath;
+ return this;
+ }
+
+ /**
+ * @see HttpHealthCheckCreationOptions#getPort()
+ */
+ public HttpHealthCheckCreationOptions port(Integer port){
+ this.port = port;
+ return this;
+ }
+
+ /**
+ * @see HttpHealthCheckCreationOptions#getCheckIntervalSec()
+ */
+ public HttpHealthCheckCreationOptions checkIntervalSec(Integer checkIntervalSec){
+ this.checkIntervalSec = checkIntervalSec;
+ return this;
+ }
+
+ /**
+ * @see HttpHealthCheckCreationOptions#getTimeoutSec()
+ */
+ public HttpHealthCheckCreationOptions timeoutSec(Integer timeoutSec){
+ this.timeoutSec = timeoutSec;
+ return this;
+ }
+
+ /**
+ * @see HttpHealthCheckCreationOptions#getUnhealthyThreshold()
+ */
+ public HttpHealthCheckCreationOptions unhealthyThreshold(Integer unhealthyThreshold){
+ this.unhealthyThreshold = unhealthyThreshold;
+ return this;
+ }
+
+ /**
+ * @see HttpHealthCheckCreationOptions#getHealthyThreshold()
+ */
+ public HttpHealthCheckCreationOptions healthyThreshold(Integer healthyThreshold){
+ this.healthyThreshold = healthyThreshold;
+ return this;
+ }
+
+ /**
+ * @see HttpHealthCheckCreationOptions#getDescription()
+ */
+ public HttpHealthCheckCreationOptions description(String description){
+ this.description = description;
+ return this;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/TargetPoolCreationOptions.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/TargetPoolCreationOptions.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/TargetPoolCreationOptions.java
new file mode 100644
index 0000000..e80d721
--- /dev/null
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/TargetPoolCreationOptions.java
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecomputeengine.options;
+
+import java.net.URI;
+import java.util.Set;
+
+/**
+ * Options for creating a Target Pool
+ *
+ */
+public class TargetPoolCreationOptions{
+
+ /**
+ * Session affinity determines the hash method that
+ * Google Compute Engine uses to distribute traffic.
+ * @see <a href="https://cloud.google.com/compute/docs/reference/latest/targetPools#resource"/>
+ */
+ public enum SessionAffinityValue {
+ CLIENT_IP,
+ CLIENT_IP_PROTO,
+ NONE
+ }
+
+ private Set<URI> healthChecks;
+ private Set<URI> instances;
+ private SessionAffinityValue sessionAffinity;
+ private Float failoverRatio;
+ private URI backupPool;
+ private String description;
+
+ /**
+ * The set of HealthChecks
+ *
+ * @return a set of HealthCheck URIs
+ */
+ public Set<URI> getHealthChecks(){
+ return healthChecks;
+ }
+
+ /**
+ * A Set of resource URIs to the member VMs serving this pool.
+ * They must live in zones contained in the same region as this pool.
+ *
+ * @return set of instance URIs
+ */
+ public Set<URI> getInstances(){
+ return instances;
+ }
+
+ /**
+ * Defines the session affinity option.
+ * Session affinity determines the hash method that Google Compute Engine uses to distribute traffic.
+ * @return
+ */
+ public SessionAffinityValue getSessionAffinity(){
+ return sessionAffinity;
+ }
+
+ /**
+ * This field is applicable only when the target pool is serving a forwarding rule as the primary pool
+ * (e.g. not as a backup pool to some other target pool).
+ * The value of the a float between [0, 1].
+ * If set, backupPool must also be set.
+ * @return failoverRatio, a float between [0, 1]
+ */
+ public Float getFailoverRatio(){
+ return failoverRatio;
+ }
+
+ /**
+ * This field is applicable only when the target pool is serving a forwarding rule as the primary pool
+ * (e.g. not as a backup pool to some other target pool). Must be a fully-qualified URL to a target pool that is in the same region as the primary target pool.
+ * If set, failoverRatio must also be set
+ * @return backupPool, Fully-qualified URI to a target pool in the same region as primary target pool
+ */
+ public URI getBackupPool(){
+ return backupPool;
+ }
+
+ /**
+ * An optional textual description of the TargetPool.
+ * @return description, provided by the client.
+ */
+ public String getDescription(){
+ return description;
+ }
+
+ /**
+ * @see TargetPoolCreationOptions#getHealthChecks()
+ */
+ public TargetPoolCreationOptions healthChecks(Set<URI> healthChecks){
+ this.healthChecks = healthChecks;
+ return this;
+ }
+
+ /**
+ * @see TargetPoolCreationOptions#getInstances()
+ */
+ public TargetPoolCreationOptions instances(Set<URI> instances){
+ this.instances = instances;
+ return this;
+ }
+
+ /**
+ * @see TargetPoolCreationOptions#getSessionAffinity()
+ */
+ public TargetPoolCreationOptions sessionAffinity(SessionAffinityValue sessionAffinity){
+ this.sessionAffinity = sessionAffinity;
+ return this;
+ }
+
+ /**
+ * @see TargetPoolCreationOptions#getFailoverRatio()
+ */
+ public TargetPoolCreationOptions failoverRatio(float failoverRatio){
+ this.failoverRatio = failoverRatio;
+ return this;
+ }
+
+ /**
+ * @see TargetPoolCreationOptions#getBackupPool()
+ */
+ public TargetPoolCreationOptions backupPool(URI backupPool){
+ this.backupPool = backupPool;
+ return this;
+ }
+
+ /**
+ * @see TargetPoolCreationOptions#getDescription()
+ */
+ public TargetPoolCreationOptions description(String description){
+ this.description = description;
+ return this;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/ForwardingRuleCreationBinderTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/ForwardingRuleCreationBinderTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/ForwardingRuleCreationBinderTest.java
new file mode 100644
index 0000000..65c32f4
--- /dev/null
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/ForwardingRuleCreationBinderTest.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecomputeengine.binders;
+
+import static org.testng.Assert.assertEquals;
+
+import java.net.URI;
+import java.util.Map;
+
+import org.jclouds.googlecomputeengine.domain.ForwardingRule.IPProtocolOption;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest;
+import org.jclouds.googlecomputeengine.options.ForwardingRuleCreationOptions;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.json.Json;
+import org.jclouds.json.internal.GsonWrapper;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.gson.Gson;
+
+
+/**
+ * Tests behavior of {@code BindToJsonPayload}
+ */
+@Test(groups = "unit", testName = "ForwardingRuleCreationBinderTest")
+public class ForwardingRuleCreationBinderTest extends BaseGoogleComputeEngineExpectTest<Object>{
+
+ private static String DESCRIPTION = "This is a test!";
+ private static String IP_ADDRESS = "1.2.1.1.1";
+ private static String PORT_RANGE = "1.2.3.4.1";
+ private static URI TARGET = URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/"
+ + "europe-west1/targetPools/test-target-pool");
+
+ Json json = new GsonWrapper(new Gson());
+
+ @Test
+ public void testMap() throws SecurityException, NoSuchMethodException {
+ ForwardingRuleCreationBinder binder = new ForwardingRuleCreationBinder(json);
+ ForwardingRuleCreationOptions forwardingRuleCreationOptions = new ForwardingRuleCreationOptions()
+ .description(DESCRIPTION)
+ .ipAddress(IP_ADDRESS)
+ .ipProtocol(IPProtocolOption.SCTP)
+ .portRange(PORT_RANGE)
+ .target(TARGET);
+
+ HttpRequest request = HttpRequest.builder().method("GET").endpoint("http://momma").build();
+ Map<String, Object> postParams = ImmutableMap.of("name", "testForwardingRuleName", "options", forwardingRuleCreationOptions);
+
+ binder.bindToRequest(request, postParams);
+
+ assertEquals(request.getPayload().getRawContent(),
+ "{\""
+ + "name\":\"testForwardingRuleName\","
+ + "\"description\":\"" + DESCRIPTION + "\","
+ + "\"IPAddress\":\"" + IP_ADDRESS + "\","
+ + "\"IPProtocol\":\"SCTP\","
+ + "\"portRange\":\"" + PORT_RANGE + "\","
+ + "\"target\":\"" + TARGET + "\""
+ + "}");
+ assertEquals(request.getPayload().getContentMetadata().getContentType(), "application/json");
+
+ }
+
+ @Test(expectedExceptions = NullPointerException.class)
+ public void testNullIsBad() {
+ ForwardingRuleCreationBinder binder = new ForwardingRuleCreationBinder(json);
+ binder.bindToRequest(HttpRequest.builder().method("GET").endpoint("http://momma").build(), null);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/HttpHealthCheckCreationBinderTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/HttpHealthCheckCreationBinderTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/HttpHealthCheckCreationBinderTest.java
new file mode 100644
index 0000000..1dec9dc
--- /dev/null
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/HttpHealthCheckCreationBinderTest.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecomputeengine.binders;
+
+import static org.testng.Assert.assertEquals;
+
+import java.util.Map;
+
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest;
+import org.jclouds.googlecomputeengine.options.HttpHealthCheckCreationOptions;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.json.Json;
+import org.jclouds.json.internal.GsonWrapper;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.gson.Gson;
+
+
+/**
+ * Tests behavior of {@code BindToJsonPayload}
+ */
+@Test(groups = "unit", testName = "HttpHealthCheckCreationBinderTest")
+public class HttpHealthCheckCreationBinderTest extends BaseGoogleComputeEngineExpectTest<Object>{
+
+ private String NAME = "testHttpHealthCheck";
+ private Integer TIMEOUTSEC = 3;
+ private Integer UNHEALTHYTHRESHOLD = 5;
+ private Integer HEALTHYTHRESHOLD = 4;
+ private static String DESCRIPTION = "This is a test!";
+
+ Json json = new GsonWrapper(new Gson());
+
+ @Test
+ public void testMap() throws SecurityException, NoSuchMethodException {
+ HttpHealthCheckCreationBinder binder = new HttpHealthCheckCreationBinder(json);
+ HttpHealthCheckCreationOptions httpHealthCheckCreationOptions = new HttpHealthCheckCreationOptions()
+ .timeoutSec(TIMEOUTSEC)
+ .unhealthyThreshold(UNHEALTHYTHRESHOLD)
+ .healthyThreshold(HEALTHYTHRESHOLD)
+ .description(DESCRIPTION);
+
+ HttpRequest request = HttpRequest.builder().method("GET").endpoint("http://momma").build();
+ Map<String, Object> postParams = ImmutableMap.of("name", NAME, "options", httpHealthCheckCreationOptions);
+
+ binder.bindToRequest(request, postParams);
+
+ assertEquals(request.getPayload().getRawContent(),
+ "{\""
+ + "name\":\"" + NAME + "\","
+ + "\"timeoutSec\":" + TIMEOUTSEC + ","
+ + "\"unhealthyThreshold\":" + UNHEALTHYTHRESHOLD + ","
+ + "\"healthyThreshold\":" + HEALTHYTHRESHOLD + ","
+ + "\"description\":\"" + DESCRIPTION + "\""
+ + "}");
+ assertEquals(request.getPayload().getContentMetadata().getContentType(), "application/json");
+
+ }
+
+ @Test(expectedExceptions = NullPointerException.class)
+ public void testNullIsBad() {
+ DiskCreationBinder binder = new DiskCreationBinder(json);
+ binder.bindToRequest(HttpRequest.builder().method("GET").endpoint("http://momma").build(), null);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/TargetPoolAddInstanceBinderTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/TargetPoolAddInstanceBinderTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/TargetPoolAddInstanceBinderTest.java
new file mode 100644
index 0000000..2ecfe5b
--- /dev/null
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/TargetPoolAddInstanceBinderTest.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecomputeengine.binders;
+
+import static org.testng.Assert.assertEquals;
+
+import java.net.URI;
+import java.util.Set;
+import java.util.Map;
+
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.json.Json;
+import org.jclouds.json.internal.GsonWrapper;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.gson.Gson;
+
+
+/**
+ * Tests behavior of {@code BindToJsonPayload}
+ */
+@Test(groups = "unit", testName = "TargetPoolAddInstanceBinderTest")
+public class TargetPoolAddInstanceBinderTest extends BaseGoogleComputeEngineExpectTest<Object>{
+
+ private static final Set<URI> FAKE_INSTANCES = ImmutableSet.of(
+ URI.create("https://www.googleapis.com/compute/v1/" +
+ "projects/project/zones/us-central1-a/instances/instance-1"),
+ URI.create("https://www.googleapis.com/compute/v1/" +
+ "projects/project/zones/us-central1-a/instances/instance-2"));
+
+ Json json = new GsonWrapper(new Gson());
+
+ @Test
+ public void testMap() throws SecurityException, NoSuchMethodException {
+ TargetPoolChangeInstancesBinder binder = new TargetPoolChangeInstancesBinder(json);
+ HttpRequest request = HttpRequest.builder().method("GET").endpoint("http://momma").build();
+ Map<String, Object> postParams = ImmutableMap.of("instances", (Object) FAKE_INSTANCES);
+
+ binder.bindToRequest(request, postParams);
+
+ assertEquals(request.getPayload().getRawContent(),
+ "{"
+ + "\"instances\":["
+ + "{\"instance\":\"https://www.googleapis.com/compute/v1/projects/project/zones/us-central1-a/instances/instance-2\"},"
+ + "{\"instance\":\"https://www.googleapis.com/compute/v1/projects/project/zones/us-central1-a/instances/instance-1\"}"
+ + "]"
+ + "}");
+ assertEquals(request.getPayload().getContentMetadata().getContentType(), "application/json");
+
+ }
+
+ @Test(expectedExceptions = NullPointerException.class)
+ public void testNullIsBad() {
+ DiskCreationBinder binder = new DiskCreationBinder(json);
+ binder.bindToRequest(HttpRequest.builder().method("GET").endpoint("http://momma").build(), null);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/bbf953be/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/TargetPoolCreationBinderTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/TargetPoolCreationBinderTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/TargetPoolCreationBinderTest.java
new file mode 100644
index 0000000..4367712
--- /dev/null
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/TargetPoolCreationBinderTest.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecomputeengine.binders;
+
+import static org.testng.Assert.assertEquals;
+
+import java.net.URI;
+import java.util.Set;
+import java.util.Map;
+
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest;
+import org.jclouds.googlecomputeengine.options.TargetPoolCreationOptions;
+import org.jclouds.googlecomputeengine.options.TargetPoolCreationOptions.SessionAffinityValue;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.json.Json;
+import org.jclouds.json.internal.GsonWrapper;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.gson.Gson;
+
+
+/**
+ * Tests behavior of {@code BindToJsonPayload}
+ */
+@Test(groups = "unit", testName = "TargetPoolCreationBinderTest")
+public class TargetPoolCreationBinderTest extends BaseGoogleComputeEngineExpectTest<Object>{
+
+ private static final Set<URI> FAKE_HEALTH_CHECKS = ImmutableSet.of(URI.create("https://www.googleapis.com/compute/v1/projects/" +
+ "debian-cloud/global/images/backports-debian-7-wheezy-v20141017"));
+ private static SessionAffinityValue SESSION_AFFINITY = SessionAffinityValue.CLIENT_IP_PROTO;
+ private static float FAILOVER_RATIO = (float) 0.4;
+ private static String DESCRIPTION = "This is a test!";
+
+ Json json = new GsonWrapper(new Gson());
+
+ @Test
+ public void testMap() throws SecurityException, NoSuchMethodException {
+ TargetPoolCreationBinder binder = new TargetPoolCreationBinder(json);
+ TargetPoolCreationOptions targetPoolCreationOptions = new TargetPoolCreationOptions()
+ .healthChecks(FAKE_HEALTH_CHECKS)
+ .sessionAffinity(SESSION_AFFINITY)
+ .failoverRatio(FAILOVER_RATIO)
+ .description(DESCRIPTION);
+
+ HttpRequest request = HttpRequest.builder().method("GET").endpoint("http://momma").build();
+ Map<String, Object> postParams = ImmutableMap.of("name", "testTargetPoolName", "options", targetPoolCreationOptions);
+
+ binder.bindToRequest(request, postParams);
+
+ assertEquals(request.getPayload().getRawContent(),
+ "{\""
+ + "name\":\"testTargetPoolName\","
+ + "\"healthChecks\":[\"" + FAKE_HEALTH_CHECKS.toArray()[0] + "\"],"
+ + "\"sessionAffinity\":\"CLIENT_IP_PROTO\","
+ + "\"failoverRatio\":0.4,"
+ + "\"description\":\"This is a test!\""
+ + "}");
+ assertEquals(request.getPayload().getContentMetadata().getContentType(), "application/json");
+
+ }
+
+ @Test(expectedExceptions = NullPointerException.class)
+ public void testNullIsBad() {
+ DiskCreationBinder binder = new DiskCreationBinder(json);
+ binder.bindToRequest(HttpRequest.builder().method("GET").endpoint("http://momma").build(), null);
+ }
+
+}
[6/6] git commit: initial commit to support GCE LB
Posted by ad...@apache.org.
initial commit to support GCE LB
add support targetPools, forwardingRules and httpHealthChecks API
add expectedTests and LiveTests for the above API
Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/commit/ed9fc5c5
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/tree/ed9fc5c5
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/diff/ed9fc5c5
Branch: refs/heads/master
Commit: ed9fc5c593d5fe0b80d3b85b5b2e4f0ff6bdf724
Parents: b8670b1
Author: Andrea Turli <an...@gmail.com>
Authored: Mon Jan 6 23:18:44 2014 +0100
Committer: Adrian Cole <ac...@twitter.com>
Committed: Thu Oct 30 18:54:43 2014 -0700
----------------------------------------------------------------------
.../GoogleComputeEngineApi.java | 70 +++--
.../compute/GoogleComputeEngineService.java | 6 +-
.../GoogleComputeEngineServiceAdapter.java | 37 +--
...GoogleComputeEngineServiceContextModule.java | 4 +-
...ogleComputeEngineSecurityGroupExtension.java | 34 +--
.../functions/NetworkToSecurityGroup.java | 2 +-
.../compute/loaders/FindNetworkOrCreate.java | 2 +-
...desWithGroupEncodedIntoNameThenAddToSet.java | 7 +-
...eNodeCredentialsButOverrideFromTemplate.java | 2 +-
.../config/GoogleComputeEngineParserModule.java | 47 ++--
.../domain/AbstractDisk.java | 2 -
.../googlecomputeengine/domain/Address.java | 11 +-
.../googlecomputeengine/domain/Disk.java | 2 -
.../googlecomputeengine/domain/Firewall.java | 3 -
.../domain/ForwardingRule.java | 198 ++++++++++++++
.../domain/HttpHealthCheck.java | 235 ++++++++++++++++
.../googlecomputeengine/domain/Image.java | 2 -
.../googlecomputeengine/domain/Instance.java | 2 -
.../googlecomputeengine/domain/MachineType.java | 2 -
.../googlecomputeengine/domain/Network.java | 2 -
.../googlecomputeengine/domain/Operation.java | 2 -
.../googlecomputeengine/domain/Project.java | 2 -
.../googlecomputeengine/domain/Quota.java | 2 -
.../googlecomputeengine/domain/Region.java | 2 -
.../googlecomputeengine/domain/Resource.java | 25 +-
.../googlecomputeengine/domain/Route.java | 2 -
.../googlecomputeengine/domain/Snapshot.java | 6 +-
.../googlecomputeengine/domain/TargetPool.java | 237 ++++++++++++++++
.../googlecomputeengine/domain/Zone.java | 2 -
.../features/AddressApi.java | 2 -
.../googlecomputeengine/features/DiskApi.java | 2 -
.../features/FirewallApi.java | 3 -
.../features/ForwardingRuleApi.java | 197 ++++++++++++++
.../features/GlobalOperationApi.java | 2 -
.../features/HttpHealthCheckApi.java | 160 +++++++++++
.../googlecomputeengine/features/ImageApi.java | 3 -
.../features/InstanceApi.java | 2 -
.../features/MachineTypeApi.java | 2 -
.../features/NetworkApi.java | 2 -
.../features/ProjectApi.java | 2 -
.../googlecomputeengine/features/RegionApi.java | 2 -
.../features/RegionOperationApi.java | 4 +-
.../googlecomputeengine/features/RouteApi.java | 2 -
.../features/SnapshotApi.java | 2 -
.../features/TargetPoolApi.java | 272 +++++++++++++++++++
.../googlecomputeengine/features/ZoneApi.java | 2 -
.../features/ZoneOperationApi.java | 2 -
.../functions/CreateNetworkIfNeeded.java | 12 +-
.../functions/internal/ParseAddresses.java | 2 +-
.../functions/internal/ParseDisks.java | 2 +-
.../functions/internal/ParseFirewalls.java | 2 +-
.../internal/ParseForwardingRules.java | 65 +++++
.../internal/ParseGlobalOperations.java | 2 +-
.../internal/ParseHttpHealthChecks.java | 64 +++++
.../functions/internal/ParseImages.java | 2 +-
.../functions/internal/ParseInstances.java | 2 +-
.../functions/internal/ParseMachineTypes.java | 2 +-
.../functions/internal/ParseNetworks.java | 2 +-
.../internal/ParseRegionOperations.java | 2 +-
.../functions/internal/ParseRegions.java | 2 +-
.../functions/internal/ParseRoutes.java | 2 +-
.../functions/internal/ParseSnapshots.java | 2 +-
.../functions/internal/ParseTargetPools.java | 66 +++++
.../functions/internal/ParseZoneOperations.java | 2 +-
.../functions/internal/ParseZones.java | 2 +-
.../options/FirewallOptions.java | 2 +-
.../options/ListOptions.java | 17 +-
.../options/RouteOptions.java | 2 +-
.../GlobalOperationDonePredicate.java | 2 +-
.../RegionOperationDonePredicate.java | 2 +-
.../predicates/ZoneOperationDonePredicate.java | 2 +-
.../PageSystemExpectTest.java | 4 +-
.../GoogleComputeEngineServiceLiveTest.java | 2 +-
.../functions/NetworkToSecurityGroupTest.java | 2 +-
.../loaders/FindNetworkOrCreateTest.java | 10 +-
.../features/AddressApiExpectTest.java | 14 +-
.../features/AddressApiLiveTest.java | 2 +-
.../features/DiskApiExpectTest.java | 22 +-
.../features/DiskApiLiveTest.java | 2 +-
.../features/FirewallApiExpectTest.java | 18 +-
.../features/FirewallApiLiveTest.java | 8 +-
.../features/ForwardingRuleApiExpectTest.java | 167 ++++++++++++
.../features/ForwardingRuleApiLiveTest.java | 85 ++++++
.../features/GlobalOperationApiExpectTest.java | 14 +-
.../features/GlobalOperationApiLiveTest.java | 4 +-
.../features/HttpHealthCheckApiExpectTest.java | 177 ++++++++++++
.../features/HttpHealthCheckApiLiveTest.java | 60 ++++
.../features/ImageApiExpectTest.java | 16 +-
.../features/ImageApiLiveTest.java | 6 +-
.../features/InstanceApiExpectTest.java | 38 +--
.../features/InstanceApiLiveTest.java | 24 +-
.../features/MachineTypeApiExpectTest.java | 8 +-
.../features/MachineTypeApiLiveTest.java | 2 +-
.../features/NetworkApiExpectTest.java | 14 +-
.../features/NetworkApiLiveTest.java | 2 +-
.../features/RegionApiExpectTest.java | 8 +-
.../features/RegionApiLiveTest.java | 2 +-
.../features/RegionOperationApiExpectTest.java | 14 +-
.../features/RegionOperationApiLiveTest.java | 6 +-
.../features/RouteApiExpectTest.java | 14 +-
.../features/RouteApiLiveTest.java | 6 +-
.../features/SnapshotApiExpectTest.java | 8 +-
.../features/SnapshotApiLiveTest.java | 4 +-
.../features/TargetPoolApiExpectTest.java | 198 ++++++++++++++
.../features/TargetPoolApiLiveTest.java | 61 +++++
.../features/ZoneApiExpectTest.java | 8 +-
.../features/ZoneApiLiveTest.java | 2 +-
.../features/ZoneOperationApiExpectTest.java | 14 +-
.../features/ZoneOperationApiLiveTest.java | 6 +-
.../functions/CreateNetworkIfNeededTest.java | 16 +-
.../BaseGoogleComputeEngineApiLiveTest.java | 9 +-
.../parse/ParseForwardingRuleListTest.java | 59 ++++
.../parse/ParseForwardingRuleTest.java | 51 ++++
.../parse/ParseHttpHealthCheckListTest.java | 82 ++++++
.../parse/ParseHttpHealthCheckTest.java | 53 ++++
.../parse/ParseRegionOperationTest.java | 55 ++++
.../parse/ParseTargetPoolListTest.java | 54 ++++
.../parse/ParseTargetPoolTest.java | 48 ++++
.../src/test/resources/forwardingrule_get.json | 12 +
.../test/resources/forwardingrule_insert.json | 4 +
.../src/test/resources/forwardingrule_list.json | 19 ++
.../src/test/resources/httphealthcheck_get.json | 7 +
.../test/resources/httphealthcheck_insert.json | 1 +
.../test/resources/httphealthcheck_list.json | 32 +++
.../test/resources/targetpool_addinstance.json | 1 +
.../src/test/resources/targetpool_get.json | 9 +
.../src/test/resources/targetpool_insert.json | 3 +
.../src/test/resources/targetpool_list.json | 17 ++
128 files changed, 3101 insertions(+), 358 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/GoogleComputeEngineApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/GoogleComputeEngineApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/GoogleComputeEngineApi.java
index ab184a7..bbf2bda 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/GoogleComputeEngineApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/GoogleComputeEngineApi.java
@@ -16,16 +16,14 @@
*/
package org.jclouds.googlecomputeengine;
-import java.io.Closeable;
-
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-
+import com.google.common.annotations.Beta;
import org.jclouds.googlecomputeengine.features.AddressApi;
import org.jclouds.googlecomputeengine.features.DiskApi;
import org.jclouds.googlecomputeengine.features.DiskTypeApi;
import org.jclouds.googlecomputeengine.features.FirewallApi;
+import org.jclouds.googlecomputeengine.features.ForwardingRuleApi;
import org.jclouds.googlecomputeengine.features.GlobalOperationApi;
+import org.jclouds.googlecomputeengine.features.HttpHealthCheckApi;
import org.jclouds.googlecomputeengine.features.ImageApi;
import org.jclouds.googlecomputeengine.features.InstanceApi;
import org.jclouds.googlecomputeengine.features.MachineTypeApi;
@@ -35,11 +33,14 @@ import org.jclouds.googlecomputeengine.features.RegionApi;
import org.jclouds.googlecomputeengine.features.RegionOperationApi;
import org.jclouds.googlecomputeengine.features.RouteApi;
import org.jclouds.googlecomputeengine.features.SnapshotApi;
+import org.jclouds.googlecomputeengine.features.TargetPoolApi;
import org.jclouds.googlecomputeengine.features.ZoneApi;
import org.jclouds.googlecomputeengine.features.ZoneOperationApi;
import org.jclouds.rest.annotations.Delegate;
-import com.google.common.annotations.Beta;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import java.io.Closeable;
/**
@@ -58,7 +59,7 @@ public interface GoogleComputeEngineApi extends Closeable {
*/
@Delegate
@Path("/projects/{project}")
- AddressApi getAddressApiForProject(@PathParam("project") String projectName);
+ AddressApi getAddressApi(@PathParam("project") String projectName);
/**
* Provides access to Disk features
@@ -67,7 +68,7 @@ public interface GoogleComputeEngineApi extends Closeable {
*/
@Delegate
@Path("/projects/{project}")
- DiskApi getDiskApiForProject(@PathParam("project") String projectName);
+ DiskApi getDiskApi(@PathParam("project") String projectName);
/**
* Provides access to DiskType features
@@ -85,7 +86,17 @@ public interface GoogleComputeEngineApi extends Closeable {
*/
@Delegate
@Path("/projects/{project}")
- FirewallApi getFirewallApiForProject(@PathParam("project") String projectName);
+ FirewallApi getFirewallApi(@PathParam("project") String projectName);
+
+ /**
+ * Provides access to ForwardingRule features
+ *
+ * @param projectName the name of the project
+ * @param region the name of the region scoping this request.
+ */
+ @Delegate
+ @Path("/projects/{project}/regions/{region}")
+ ForwardingRuleApi getForwardingRuleApi(@PathParam("project") String projectName, @PathParam("region") String region);
/**
* Provides access to Global Operation features
@@ -94,7 +105,16 @@ public interface GoogleComputeEngineApi extends Closeable {
*/
@Delegate
@Path("/projects/{project}")
- GlobalOperationApi getGlobalOperationApiForProject(@PathParam("project") String projectName);
+ GlobalOperationApi getGlobalOperationApi(@PathParam("project") String projectName);
+
+ /**
+ * Provides access to HttpHealthCheck features
+ *
+ * @param projectName the name of the project
+ */
+ @Delegate
+ @Path("/projects/{project}/global/httpHealthChecks")
+ HttpHealthCheckApi getHttpHealthCheckApi(@PathParam("project") String projectName);
/**
* Provides access to Image features
@@ -103,7 +123,7 @@ public interface GoogleComputeEngineApi extends Closeable {
*/
@Delegate
@Path("/projects/{project}")
- ImageApi getImageApiForProject(@PathParam("project") String projectName);
+ ImageApi getImageApi(@PathParam("project") String projectName);
/**
* Provides access to Instance features
@@ -112,7 +132,7 @@ public interface GoogleComputeEngineApi extends Closeable {
*/
@Delegate
@Path("/projects/{project}")
- InstanceApi getInstanceApiForProject(@PathParam("project") String projectName);
+ InstanceApi getInstanceApi(@PathParam("project") String projectName);
/**
* Provides access to MachineType features
@@ -121,7 +141,7 @@ public interface GoogleComputeEngineApi extends Closeable {
*/
@Delegate
@Path("/projects/{project}")
- MachineTypeApi getMachineTypeApiForProject(@PathParam("project") String projectName);
+ MachineTypeApi getMachineTypeApi(@PathParam("project") String projectName);
/**
* Provides access to Network features
@@ -130,7 +150,7 @@ public interface GoogleComputeEngineApi extends Closeable {
*/
@Delegate
@Path("/projects/{project}")
- NetworkApi getNetworkApiForProject(@PathParam("project") String projectName);
+ NetworkApi getNetworkApi(@PathParam("project") String projectName);
/**
* Provides access to Project features
@@ -145,7 +165,7 @@ public interface GoogleComputeEngineApi extends Closeable {
*/
@Delegate
@Path("/projects/{project}")
- RegionApi getRegionApiForProject(@PathParam("project") String projectName);
+ RegionApi getRegionApi(@PathParam("project") String projectName);
/**
* Provides access to Region Operation features
@@ -154,7 +174,7 @@ public interface GoogleComputeEngineApi extends Closeable {
*/
@Delegate
@Path("/projects/{project}")
- RegionOperationApi getRegionOperationApiForProject(@PathParam("project") String projectName);
+ RegionOperationApi getRegionOperationApi(@PathParam("project") String projectName);
/**
* Provides access to Route features
@@ -163,7 +183,7 @@ public interface GoogleComputeEngineApi extends Closeable {
*/
@Delegate
@Path("/projects/{project}")
- RouteApi getRouteApiForProject(@PathParam("project") String projectName);
+ RouteApi getRouteApi(@PathParam("project") String projectName);
/**
* Provides access to Snapshot features
@@ -172,7 +192,17 @@ public interface GoogleComputeEngineApi extends Closeable {
*/
@Delegate
@Path("/projects/{project}")
- SnapshotApi getSnapshotApiForProject(@PathParam("project") String projectName);
+ SnapshotApi getSnapshotApi(@PathParam("project") String projectName);
+
+ /**
+ * Provides access to TargetPool features
+ *
+ * @param projectName the name of the project
+ * @param region the name of the region scoping this request.
+ */
+ @Delegate
+ @Path("/projects/{project}/regions/{region}")
+ TargetPoolApi getTargetPoolApi(@PathParam("project") String projectName, @PathParam("region") String region);
/**
* Provides access to Zone features
@@ -181,7 +211,7 @@ public interface GoogleComputeEngineApi extends Closeable {
*/
@Delegate
@Path("/projects/{project}")
- ZoneApi getZoneApiForProject(@PathParam("project") String projectName);
+ ZoneApi getZoneApi(@PathParam("project") String projectName);
/**
* Provides access to Zone Operation features
@@ -190,6 +220,6 @@ public interface GoogleComputeEngineApi extends Closeable {
*/
@Delegate
@Path("/projects/{project}")
- ZoneOperationApi getZoneOperationApiForProject(@PathParam("project") String projectName);
+ ZoneOperationApi getZoneOperationApi(@PathParam("project") String projectName);
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineService.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineService.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineService.java
index 6702e7c..da9bbb1 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineService.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineService.java
@@ -152,8 +152,8 @@ public class GoogleComputeEngineService extends BaseComputeService {
protected void cleanUpNetworksAndFirewallsForGroup(final String groupName) {
String resourceName = namingConvention.create().sharedNameForGroup(groupName);
- final Network network = api.getNetworkApiForProject(project.get()).get(resourceName);
- FirewallApi firewallApi = api.getFirewallApiForProject(project.get());
+ final Network network = api.getNetworkApi(project.get()).get(resourceName);
+ FirewallApi firewallApi = api.getFirewallApi(project.get());
Predicate<Firewall> firewallBelongsToNetwork = new Predicate<Firewall>() {
@Override
public boolean apply(Firewall input) {
@@ -177,7 +177,7 @@ public class GoogleComputeEngineService extends BaseComputeService {
}
}
- AtomicReference<Operation> operation = Atomics.newReference(api.getNetworkApiForProject(project.get()).delete(resourceName));
+ AtomicReference<Operation> operation = Atomics.newReference(api.getNetworkApi(project.get()).delete(resourceName));
retry(operationDonePredicate, operationCompleteCheckTimeout, operationCompleteCheckInterval,
MILLISECONDS).apply(operation);
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
index 7abdb4f..58aa2f4 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
@@ -179,7 +179,7 @@ public class GoogleComputeEngineServiceAdapter implements ComputeServiceAdapter<
instanceTemplate.metadata(metadataBuilder.build());
instanceTemplate.serviceAccounts(options.getServiceAccounts());
- final InstanceApi instanceApi = api.getInstanceApiForProject(userProject.get());
+ final InstanceApi instanceApi = api.getInstanceApi(userProject.get());
final String zone = template.getLocation().getId();
Operation operation = instanceApi.createInZone(name, zone, instanceTemplate);
@@ -242,7 +242,7 @@ public class GoogleComputeEngineServiceAdapter implements ComputeServiceAdapter<
String diskName = instanceName + "-" + GCE_BOOT_DISK_SUFFIX;
DiskCreationOptions diskCreationOptions = new DiskCreationOptions().sourceImage(imageUri);
- Operation diskOperation = api.getDiskApiForProject(userProject.get())
+ Operation diskOperation = api.getDiskApi(userProject.get())
.createInZone(diskName,
diskSize,
template.getLocation().getId(),
@@ -250,7 +250,7 @@ public class GoogleComputeEngineServiceAdapter implements ComputeServiceAdapter<
waitOperationDone(diskOperation);
- return api.getDiskApiForProject(userProject.get()).getInZone(template.getLocation().getId(),
+ return api.getDiskApi(userProject.get()).getInZone(template.getLocation().getId(),
diskName);
}
@@ -259,7 +259,7 @@ public class GoogleComputeEngineServiceAdapter implements ComputeServiceAdapter<
ImmutableSet.Builder<MachineTypeInZone> builder = ImmutableSet.builder();
for (final Location zone : zones.get().values()) {
- builder.addAll(api.getMachineTypeApiForProject(userProject.get())
+ builder.addAll(api.getMachineTypeApi(userProject.get())
.listInZone(zone.getId())
.concat()
.filter(new Predicate<MachineType>() {
@@ -283,30 +283,31 @@ public class GoogleComputeEngineServiceAdapter implements ComputeServiceAdapter<
@Override
public Iterable<Image> listImages() {
return ImmutableSet.<Image>builder()
- .addAll(api.getImageApiForProject(userProject.get()).list().concat())
- .addAll(api.getImageApiForProject(DEBIAN_PROJECT).list().concat())
- .addAll(api.getImageApiForProject(CENTOS_PROJECT).list().concat())
+ .addAll(api.getImageApi(userProject.get()).list().concat())
+ .addAll(api.getImageApi(DEBIAN_PROJECT).list().concat())
+ .addAll(api.getImageApi(CENTOS_PROJECT).list().concat())
.build();
}
- @Override
+ @SuppressWarnings("deprecation")
+@Override
public Image getImage(String id) {
- return Objects.firstNonNull(api.getImageApiForProject(userProject.get()).get(id),
- Objects.firstNonNull(api.getImageApiForProject(DEBIAN_PROJECT).get(id),
- api.getImageApiForProject(CENTOS_PROJECT).get(id)));
+ return Objects.firstNonNull(api.getImageApi(userProject.get()).get(id),
+ Objects.firstNonNull(api.getImageApi(DEBIAN_PROJECT).get(id),
+ api.getImageApi(CENTOS_PROJECT).get(id)));
}
@Override
public Iterable<Zone> listLocations() {
- return api.getZoneApiForProject(userProject.get()).list().concat();
+ return api.getZoneApi(userProject.get()).list().concat();
}
@Override
public InstanceInZone getNode(String name) {
SlashEncodedIds slashEncodedIds = SlashEncodedIds.fromSlashEncoded(name);
- Instance instance = api.getInstanceApiForProject(userProject.get()).getInZone(slashEncodedIds.getFirstId(),
+ Instance instance = api.getInstanceApi(userProject.get()).getInZone(slashEncodedIds.getFirstId(),
slashEncodedIds.getSecondId());
return instance == null ? null : new InstanceInZone(instance, slashEncodedIds.getFirstId());
@@ -317,7 +318,7 @@ public class GoogleComputeEngineServiceAdapter implements ComputeServiceAdapter<
return FluentIterable.from(zones.get().values()).transformAndConcat(new Function<Location, ImmutableSet<InstanceInZone>>() {
@Override
public ImmutableSet<InstanceInZone> apply(final Location input) {
- return api.getInstanceApiForProject(userProject.get()).listInZone(input.getId()).concat()
+ return api.getInstanceApi(userProject.get()).listInZone(input.getId()).concat()
.transform(new Function<Instance, InstanceInZone>() {
@Override
@@ -345,7 +346,7 @@ public class GoogleComputeEngineServiceAdapter implements ComputeServiceAdapter<
SlashEncodedIds slashEncodedIds = SlashEncodedIds.fromSlashEncoded(name);
String diskName = null;
try {
- Instance instance = api.getInstanceApiForProject(userProject.get()).getInZone(slashEncodedIds.getFirstId(),
+ Instance instance = api.getInstanceApi(userProject.get()).getInZone(slashEncodedIds.getFirstId(),
slashEncodedIds.getSecondId());
if (instance.getMetadata().getItems().get(GCE_DELETE_BOOT_DISK_METADATA_KEY).equals("true")) {
Optional<AttachedDisk> disk = tryFind(instance.getDisks(), new Predicate<AttachedDisk>() {
@@ -362,11 +363,11 @@ public class GoogleComputeEngineServiceAdapter implements ComputeServiceAdapter<
} catch (Exception e) {
// TODO: what exception actually gets thrown here if the instance doesn't really exist?
}
- waitOperationDone(api.getInstanceApiForProject(userProject.get()).deleteInZone(slashEncodedIds.getFirstId(),
+ waitOperationDone(api.getInstanceApi(userProject.get()).deleteInZone(slashEncodedIds.getFirstId(),
slashEncodedIds.getSecondId()));
if (diskName != null) {
- waitOperationDone(api.getDiskApiForProject(userProject.get()).deleteInZone(slashEncodedIds.getFirstId(),
+ waitOperationDone(api.getDiskApi(userProject.get()).deleteInZone(slashEncodedIds.getFirstId(),
diskName));
}
@@ -376,7 +377,7 @@ public class GoogleComputeEngineServiceAdapter implements ComputeServiceAdapter<
public void rebootNode(final String name) {
SlashEncodedIds slashEncodedIds = SlashEncodedIds.fromSlashEncoded(name);
- waitOperationDone(api.getInstanceApiForProject(userProject.get()).resetInZone(slashEncodedIds.getFirstId(),
+ waitOperationDone(api.getInstanceApi(userProject.get()).resetInZone(slashEncodedIds.getFirstId(),
slashEncodedIds.getSecondId()));
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java
index 730c515..c542b9a 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java
@@ -212,7 +212,7 @@ public class GoogleComputeEngineServiceContextModule
new Supplier<Map<URI, ? extends Location>>() {
@Override
public Map<URI, ? extends Location> get() {
- return uniqueIndex(transform(api.getZoneApiForProject(userProject.get()).list().concat(), zoneToLocation),
+ return uniqueIndex(transform(api.getZoneApi(userProject.get()).list().concat(), zoneToLocation),
new Function<Location, URI>() {
@Override
public URI apply(Location input) {
@@ -236,7 +236,7 @@ public class GoogleComputeEngineServiceContextModule
new Supplier<Map<URI, Region>>() {
@Override
public Map<URI, Region> get() {
- return uniqueIndex(api.getRegionApiForProject(userProject.get()).list().concat(),
+ return uniqueIndex(api.getRegionApi(userProject.get()).list().concat(),
new Function<Region, URI>() {
@Override
public URI apply(Region input) {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/extensions/GoogleComputeEngineSecurityGroupExtension.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/extensions/GoogleComputeEngineSecurityGroupExtension.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/extensions/GoogleComputeEngineSecurityGroupExtension.java
index b986e37..2adb7c7 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/extensions/GoogleComputeEngineSecurityGroupExtension.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/extensions/GoogleComputeEngineSecurityGroupExtension.java
@@ -100,7 +100,7 @@ public class GoogleComputeEngineSecurityGroupExtension implements SecurityGroupE
@Override
public Set<SecurityGroup> listSecurityGroups() {
- return api.getNetworkApiForProject(userProject.get()).list().concat().transform(groupConverter).toSet();
+ return api.getNetworkApi(userProject.get()).list().concat().transform(groupConverter).toSet();
}
@Override
@@ -112,7 +112,7 @@ public class GoogleComputeEngineSecurityGroupExtension implements SecurityGroupE
public Set<SecurityGroup> listSecurityGroupsForNode(String id) {
SlashEncodedIds slashEncodedIds = SlashEncodedIds.fromSlashEncoded(id);
- Instance instance = api.getInstanceApiForProject(userProject.get()).getInZone(slashEncodedIds.getFirstId(),
+ Instance instance = api.getInstanceApi(userProject.get()).getInZone(slashEncodedIds.getFirstId(),
slashEncodedIds.getSecondId());
if (instance == null) {
@@ -124,7 +124,7 @@ public class GoogleComputeEngineSecurityGroupExtension implements SecurityGroupE
for (NetworkInterface nwInterface : instance.getNetworkInterfaces()) {
String networkUrl = nwInterface.getNetwork().getPath();
- Network nw = api.getNetworkApiForProject(userProject.get()).get(networkUrl.substring(networkUrl.lastIndexOf('/') + 1));
+ Network nw = api.getNetworkApi(userProject.get()).get(networkUrl.substring(networkUrl.lastIndexOf('/') + 1));
SecurityGroup grp = groupForTagsInNetwork(nw, instance.getTags().getItems());
if (grp != null) {
@@ -138,7 +138,7 @@ public class GoogleComputeEngineSecurityGroupExtension implements SecurityGroupE
@Override
public SecurityGroup getSecurityGroupById(String id) {
checkNotNull(id, "id");
- Network network = api.getNetworkApiForProject(userProject.get()).get(id);
+ Network network = api.getNetworkApi(userProject.get()).get(id);
if (network == null) {
return null;
@@ -165,16 +165,16 @@ public class GoogleComputeEngineSecurityGroupExtension implements SecurityGroupE
@Override
public boolean removeSecurityGroup(String id) {
checkNotNull(id, "id");
- if (api.getNetworkApiForProject(userProject.get()).get(id) == null) {
+ if (api.getNetworkApi(userProject.get()).get(id) == null) {
return false;
}
ListOptions options = new ListOptions.Builder().filter("network eq .*/" + id);
- FluentIterable<Firewall> fws = api.getFirewallApiForProject(userProject.get()).list(options).concat();
+ FluentIterable<Firewall> fws = api.getFirewallApi(userProject.get()).list(options).concat();
for (Firewall fw : fws) {
- AtomicReference<Operation> operation = Atomics.newReference(api.getFirewallApiForProject(userProject.get())
+ AtomicReference<Operation> operation = Atomics.newReference(api.getFirewallApi(userProject.get())
.delete(fw.getName()));
retry(operationDonePredicate, operationCompleteCheckTimeout, operationCompleteCheckInterval,
@@ -184,12 +184,12 @@ public class GoogleComputeEngineSecurityGroupExtension implements SecurityGroupE
}
AtomicReference<Operation> operation = Atomics.newReference(
- api.getNetworkApiForProject(userProject.get()).delete(id));
+ api.getNetworkApi(userProject.get()).delete(id));
retry(operationDonePredicate, operationCompleteCheckTimeout, operationCompleteCheckInterval,
MILLISECONDS).apply(operation);
- checkState(!operation.get().getHttpError().isPresent(), "Could not create network, operation failed" + operation);
+ checkState(!operation.get().getHttpError().isPresent(), "Could not insert network, operation failed" + operation);
return true;
}
@@ -199,11 +199,11 @@ public class GoogleComputeEngineSecurityGroupExtension implements SecurityGroupE
checkNotNull(group, "group");
checkNotNull(ipPermission, "ipPermission");
- checkNotNull(api.getNetworkApiForProject(userProject.get()).get(group.getId()) == null, "network for group is null");
+ checkNotNull(api.getNetworkApi(userProject.get()).get(group.getId()) == null, "network for group is null");
ListOptions options = new ListOptions.Builder().filter("network eq .*/" + group.getName());
- if (api.getFirewallApiForProject(userProject.get()).list(options).concat().anyMatch(providesIpPermission(ipPermission))) {
+ if (api.getFirewallApi(userProject.get()).list(options).concat().anyMatch(providesIpPermission(ipPermission))) {
// Permission already exists.
return group;
}
@@ -229,7 +229,7 @@ public class GoogleComputeEngineSecurityGroupExtension implements SecurityGroupE
}
fwOptions.addAllowedRule(ruleBuilder.build());
- AtomicReference<Operation> operation = Atomics.newReference(api.getFirewallApiForProject(userProject
+ AtomicReference<Operation> operation = Atomics.newReference(api.getFirewallApi(userProject
.get()).createInNetwork(
uniqueFwName,
group.getUri(),
@@ -238,7 +238,7 @@ public class GoogleComputeEngineSecurityGroupExtension implements SecurityGroupE
retry(operationDonePredicate, operationCompleteCheckTimeout, operationCompleteCheckInterval,
MILLISECONDS).apply(operation);
- checkState(!operation.get().getHttpError().isPresent(), "Could not create firewall, operation failed" + operation);
+ checkState(!operation.get().getHttpError().isPresent(), "Could not insert firewall, operation failed" + operation);
return getSecurityGroupById(group.getId());
}
@@ -264,15 +264,15 @@ public class GoogleComputeEngineSecurityGroupExtension implements SecurityGroupE
checkNotNull(group, "group");
checkNotNull(ipPermission, "ipPermission");
- checkNotNull(api.getNetworkApiForProject(userProject.get()).get(group.getId()) == null, "network for group is null");
+ checkNotNull(api.getNetworkApi(userProject.get()).get(group.getId()) == null, "network for group is null");
ListOptions options = new ListOptions.Builder().filter("network eq .*/" + group.getName());
- FluentIterable<Firewall> fws = api.getFirewallApiForProject(userProject.get()).list(options).concat();
+ FluentIterable<Firewall> fws = api.getFirewallApi(userProject.get()).list(options).concat();
for (Firewall fw : fws) {
if (equalsIpPermission(ipPermission).apply(fw)) {
- AtomicReference<Operation> operation = Atomics.newReference(api.getFirewallApiForProject(userProject.get())
+ AtomicReference<Operation> operation = Atomics.newReference(api.getFirewallApi(userProject.get())
.delete(fw.getName()));
retry(operationDonePredicate, operationCompleteCheckTimeout, operationCompleteCheckInterval,
@@ -328,7 +328,7 @@ public class GoogleComputeEngineSecurityGroupExtension implements SecurityGroupE
private SecurityGroup groupForTagsInNetwork(Network nw, final Set <String> tags) {
ListOptions opts = new Builder().filter("network eq .*/" + nw.getName());
- Set<Firewall> fws = api.getFirewallApiForProject(userProject.get()).list(opts).concat()
+ Set<Firewall> fws = api.getFirewallApi(userProject.get()).list(opts).concat()
.filter(new Predicate<Firewall>() {
@Override
public boolean apply(final Firewall input) {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/NetworkToSecurityGroup.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/NetworkToSecurityGroup.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/NetworkToSecurityGroup.java
index 1a9be54..790f233 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/NetworkToSecurityGroup.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/NetworkToSecurityGroup.java
@@ -70,7 +70,7 @@ public class NetworkToSecurityGroup implements Function<Network, SecurityGroup>
ListOptions options = new ListOptions.Builder().filter("network eq .*/" + network.getName());
- for (Firewall fw : api.getFirewallApiForProject(project.get()).list(options).concat()) {
+ for (Firewall fw : api.getFirewallApi(project.get()).list(options).concat()) {
permBuilder.addAll(firewallToPerms.apply(fw));
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/loaders/FindNetworkOrCreate.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/loaders/FindNetworkOrCreate.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/loaders/FindNetworkOrCreate.java
index 2c84787..a849178 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/loaders/FindNetworkOrCreate.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/loaders/FindNetworkOrCreate.java
@@ -52,7 +52,7 @@ public class FindNetworkOrCreate extends CacheLoader<NetworkAndAddressRange, Net
@Override
public Network load(NetworkAndAddressRange in) {
- Network network = api.getNetworkApiForProject(userProject.get()).get(in.getName());
+ Network network = api.getNetworkApi(userProject.get()).get(in.getName());
if (network != null) {
return network;
} else {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/CreateNodesWithGroupEncodedIntoNameThenAddToSet.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/CreateNodesWithGroupEncodedIntoNameThenAddToSet.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/CreateNodesWithGroupEncodedIntoNameThenAddToSet.java
index b653ac1..622bc84 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/CreateNodesWithGroupEncodedIntoNameThenAddToSet.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/CreateNodesWithGroupEncodedIntoNameThenAddToSet.java
@@ -118,7 +118,7 @@ public class CreateNodesWithGroupEncodedIntoNameThenAddToSet extends
.getOptions());
assert template.getOptions().equals(templateOptions) : "options didn't clone properly";
- // get or create the network and create a firewall with the users configuration
+ // get or insert the network and insert a firewall with the users configuration
Network network = getOrCreateNetwork(templateOptions, sharedResourceName);
getOrCreateFirewalls(templateOptions, network, firewallTagNamingConvention.get(group));
templateOptions.network(network.getSelfLink());
@@ -149,9 +149,10 @@ public class CreateNodesWithGroupEncodedIntoNameThenAddToSet extends
FirewallTagNamingConvention naming) {
String projectName = userProject.get();
- FirewallApi firewallApi = api.getFirewallApiForProject(projectName);
+ FirewallApi firewallApi = api.getFirewallApi(projectName);
Set<AtomicReference<Operation>> operations = Sets.newLinkedHashSet();
+
for (Integer port : templateOptions.getInboundPorts()) {
String name = naming.name(port);
Firewall firewall = firewallApi.get(name);
@@ -176,7 +177,7 @@ public class CreateNodesWithGroupEncodedIntoNameThenAddToSet extends
retry(operationDonePredicate, operationCompleteCheckTimeout, operationCompleteCheckInterval,
MILLISECONDS).apply(operation);
checkState(!operation.get().getHttpError().isPresent(),
- "Could not create firewall, operation failed" + operation);
+ "Could not insert firewall, operation failed" + operation);
}
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/UseNodeCredentialsButOverrideFromTemplate.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/UseNodeCredentialsButOverrideFromTemplate.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/UseNodeCredentialsButOverrideFromTemplate.java
index ff75a03..a908910 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/UseNodeCredentialsButOverrideFromTemplate.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/UseNodeCredentialsButOverrideFromTemplate.java
@@ -28,7 +28,7 @@ import com.google.inject.Inject;
import com.google.inject.Singleton;
/**
- * GCE needs the credentials to create the node so the node credentials already take the Image credentials into account,
+ * GCE needs the credentials to insert the node so the node credentials already take the Image credentials into account,
* as such only overriding the TemplateOptions credentials is required.
*/
@Singleton
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/config/GoogleComputeEngineParserModule.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/config/GoogleComputeEngineParserModule.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/config/GoogleComputeEngineParserModule.java
index 580c906..f92b3fa 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/config/GoogleComputeEngineParserModule.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/config/GoogleComputeEngineParserModule.java
@@ -16,30 +16,6 @@
*/
package org.jclouds.googlecomputeengine.config;
-import static org.jclouds.googlecomputeengine.domain.Firewall.Rule;
-
-import java.beans.ConstructorProperties;
-import java.lang.reflect.Type;
-import java.net.URI;
-import java.util.Date;
-import java.util.Map;
-import java.util.Set;
-
-import javax.inject.Singleton;
-
-import org.jclouds.googlecomputeengine.domain.Firewall;
-import org.jclouds.googlecomputeengine.domain.Instance;
-import org.jclouds.googlecomputeengine.domain.InstanceTemplate;
-import org.jclouds.googlecomputeengine.domain.Metadata;
-import org.jclouds.googlecomputeengine.domain.Operation;
-import org.jclouds.googlecomputeengine.domain.Project;
-import org.jclouds.googlecomputeengine.domain.Quota;
-import org.jclouds.googlecomputeengine.options.FirewallOptions;
-import org.jclouds.googlecomputeengine.options.RouteOptions;
-import org.jclouds.json.config.GsonModule;
-import org.jclouds.net.domain.IpProtocol;
-import org.jclouds.oauth.v2.config.OAuthParserModule;
-
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Range;
import com.google.gson.JsonArray;
@@ -54,6 +30,29 @@ import com.google.gson.JsonSerializer;
import com.google.gson.TypeAdapterFactory;
import com.google.inject.AbstractModule;
import com.google.inject.Provides;
+import org.jclouds.googlecomputeengine.domain.Firewall;
+import org.jclouds.googlecomputeengine.domain.Instance;
+import org.jclouds.googlecomputeengine.domain.InstanceTemplate;
+import org.jclouds.googlecomputeengine.domain.Metadata;
+import org.jclouds.googlecomputeengine.domain.Operation;
+import org.jclouds.googlecomputeengine.domain.Project;
+import org.jclouds.googlecomputeengine.domain.Quota;
+import org.jclouds.googlecomputeengine.options.FirewallOptions;
+import org.jclouds.googlecomputeengine.options.RouteOptions;
+import org.jclouds.json.config.GsonModule;
+import org.jclouds.net.domain.IpProtocol;
+import org.jclouds.oauth.v2.config.OAuthParserModule;
+
+
+import javax.inject.Singleton;
+import java.beans.ConstructorProperties;
+import java.lang.reflect.Type;
+import java.net.URI;
+import java.util.Date;
+import java.util.Map;
+import java.util.Set;
+
+import static org.jclouds.googlecomputeengine.domain.Firewall.Rule;
public class GoogleComputeEngineParserModule extends AbstractModule {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/AbstractDisk.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/AbstractDisk.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/AbstractDisk.java
index 4bf6479..e4b7986 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/AbstractDisk.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/AbstractDisk.java
@@ -26,8 +26,6 @@ import com.google.common.base.Objects;
/**
* A persistent disk resource
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/disks"/>
*/
@Beta
public abstract class AbstractDisk extends Resource {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Address.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Address.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Address.java
index 85fda1f..9b0d083 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Address.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Address.java
@@ -16,10 +16,6 @@
*/
package org.jclouds.googlecomputeengine.domain;
-import static com.google.common.base.Objects.equal;
-import static com.google.common.base.Optional.fromNullable;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import java.beans.ConstructorProperties;
import java.net.URI;
import java.util.Date;
@@ -28,10 +24,12 @@ import com.google.common.annotations.Beta;
import com.google.common.base.Objects;
import com.google.common.base.Optional;
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Optional.fromNullable;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Represents an Address resource.
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/addresses"/>
*/
@Beta
public final class Address extends Resource {
@@ -100,6 +98,7 @@ public final class Address extends Resource {
/**
* {@inheritDoc}
*/
+ @SuppressWarnings("deprecation")
@Override
protected Objects.ToStringHelper string() {
return super.string()
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Disk.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Disk.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Disk.java
index d3896c1..0494f43 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Disk.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Disk.java
@@ -32,8 +32,6 @@ import com.google.common.base.Optional;
/**
* A persistent disk resource
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/disks"/>
*/
@Beta
public final class Disk extends AbstractDisk {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Firewall.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Firewall.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Firewall.java
index 545c206..6197ff7 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Firewall.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Firewall.java
@@ -38,9 +38,6 @@ import com.google.common.collect.TreeRangeSet;
/**
* Represents a network firewall
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/firewalls"/>
- * @see <a href="https://developers.google.com/compute/docs/networking#firewalls"/>
*/
@Beta
public final class Firewall extends Resource {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/ForwardingRule.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/ForwardingRule.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/ForwardingRule.java
new file mode 100644
index 0000000..6bafba8
--- /dev/null
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/ForwardingRule.java
@@ -0,0 +1,198 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecomputeengine.domain;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Optional;
+
+import java.beans.ConstructorProperties;
+import java.net.URI;
+import java.util.Date;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Optional.fromNullable;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.jclouds.javax.annotation.Nullable;
+
+@Beta
+public class ForwardingRule extends Resource {
+
+ private final URI region;
+ private final Optional<String> ipAddress;
+ private final Optional<String> ipProtocol;
+ private final Optional<String> portRange;
+ private final URI target;
+
+ @ConstructorProperties({
+ "id", "creationTimestamp", "selfLink", "name", "description", "region", "IPAddress", "IPProtocol",
+ "portRange", "target"
+ })
+ private ForwardingRule(String id, Date creationTimestamp, URI selfLink, String name, String description,
+ URI region, @Nullable String ipAddress, @Nullable String ipProtocol, @Nullable String portRange,
+ URI target) {
+ super(Kind.FORWARDING_RULE, id, creationTimestamp, selfLink, name, description);
+ this.region = checkNotNull(region, "region of %s", name);
+ this.ipAddress = fromNullable(ipAddress);
+ this.ipProtocol = fromNullable(ipProtocol);
+ this.portRange = fromNullable(portRange);
+ this.target = checkNotNull(target, "target of %s", name);
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * @return URL of the region where the forwarding rule resides.
+ */
+ public URI getRegion() {
+ return region;
+ }
+
+ /**
+ * @return the external IP address that this forwarding rule is serving on behalf of. If this is a reserved
+ * address, the address must live in the same region as the forwarding rule. By default,
+ * this field is empty and an ephemeral IP is assigned to the ForwardingRule.
+ */
+ public Optional<String> getIpAddress() {
+ return ipAddress;
+ }
+
+ /**
+ * @return the IP protocol to which this rule applies. If left empty, the default value used is TCP.
+ */
+ public Optional<String> getIpProtocol() {
+ return ipProtocol;
+ }
+
+ /**
+ * @return If IPProtocol is TCP or UDP, packets addressed to ports in the specified range will be forwarded to
+ * backend. By default, this is empty and all ports are allowed.
+ */
+ public Optional<String> getPortRange() {
+ return portRange;
+ }
+
+ /**
+ * @return the URL of the target resource to receive the matched traffic. The target resource must live in the
+ * same region as this forwarding rule.
+ */
+ public URI getTarget() {
+ return target;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ ForwardingRule that = ForwardingRule.class.cast(obj);
+ return equal(this.kind, that.kind)
+ && equal(this.name, that.name)
+ && equal(this.region, that.region);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected MoreObjects.ToStringHelper string() {
+ return super.string()
+ .omitNullValues()
+ .add("region", region)
+ .add("ipAddress", ipAddress.orNull())
+ .add("ipProtocol", ipProtocol.orNull())
+ .add("portRange", portRange.orNull())
+ .add("target", target);
+ }
+
+ public Builder toBuilder() {
+ return new Builder().fromForwardingRule(this);
+ }
+
+ public static final class Builder extends Resource.Builder<Builder> {
+ private URI region;
+ private String ipAddress;
+ private String ipProtocol;
+ private String portRange;
+ private URI target;
+
+ /**
+ * @see ForwardingRule#getRegion()
+ */
+ public Builder region(URI region) {
+ this.region = region;
+ return this;
+ }
+
+ /**
+ * @see org.jclouds.googlecomputeengine.domain.ForwardingRule#getIpAddress()
+ */
+ public Builder ipAddress(String ipAddress) {
+ this.ipAddress = ipAddress;
+ return this;
+ }
+
+ /**
+ * @see org.jclouds.googlecomputeengine.domain.ForwardingRule#getIpProtocol()
+ */
+ public Builder ipProtocol(String ipProtocol) {
+ this.ipProtocol = ipProtocol;
+ return this;
+ }
+
+ /**
+ * @see org.jclouds.googlecomputeengine.domain.ForwardingRule#getPortRange()
+ */
+ public Builder portRange(String portRange) {
+ this.portRange = portRange;
+ return this;
+ }
+
+ /**
+ * @see org.jclouds.googlecomputeengine.domain.ForwardingRule#getTarget()
+ */
+ public Builder target(URI target) {
+ this.target = target;
+ return this;
+ }
+
+ @Override
+ protected Builder self() {
+ return this;
+ }
+
+ public ForwardingRule build() {
+ return new ForwardingRule(super.id, super.creationTimestamp, super.selfLink, super.name, super.description,
+ region, ipAddress, ipProtocol, portRange, target);
+ }
+
+ public Builder fromForwardingRule(ForwardingRule in) {
+ return super.fromResource(in)
+ .region(in.getRegion())
+ .ipAddress(in.getIpAddress().orNull())
+ .ipProtocol(in.getIpProtocol().orNull())
+ .portRange(in.getPortRange().orNull())
+ .target(in.getTarget());
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/HttpHealthCheck.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/HttpHealthCheck.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/HttpHealthCheck.java
new file mode 100644
index 0000000..92d39b8
--- /dev/null
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/HttpHealthCheck.java
@@ -0,0 +1,235 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecomputeengine.domain;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Optional;
+
+import java.beans.ConstructorProperties;
+import java.net.URI;
+import java.util.Date;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Optional.fromNullable;
+
+import org.jclouds.javax.annotation.Nullable;
+
+@Beta
+public class HttpHealthCheck extends Resource {
+ private final Optional<String> host;
+ private final Optional<String> requestPath;
+ private final Optional<Integer> port;
+ private final Optional<Integer> checkIntervalSec;
+ private final Optional<Integer> timeoutSec;
+ private final Optional<Integer> unhealthyThreshold;
+ private final Optional<Integer> healthyThreshold;
+
+ @ConstructorProperties({
+ "id", "creationTimestamp", "selfLink", "name", "description", "host", "requestPath", "port",
+ "checkIntervalSec", "timeoutSec", "unhealthyThreshold", "healthyThreshold"
+ })
+ private HttpHealthCheck(String id, Date creationTimestamp, URI selfLink, String name, String description,
+ @Nullable String host, @Nullable String requestPath, int port, int checkIntervalSec,
+ int timeoutSec, int unhealthyThreshold, int healthyThreshold) {
+ super(Kind.HTTP_HEALTH_CHECK, id, creationTimestamp, selfLink, name, description);
+ this.host = fromNullable(host);
+ this.requestPath = fromNullable(requestPath);
+ this.port = fromNullable(port);
+ this.checkIntervalSec = fromNullable(checkIntervalSec);
+ this.timeoutSec = fromNullable(timeoutSec);
+ this.unhealthyThreshold = fromNullable(unhealthyThreshold);
+ this.healthyThreshold = fromNullable(healthyThreshold);
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * @return the value of the host header in the HTTP health check request. If left empty (default value),
+ * the public IP on behalf of which this health check is performed will be used.
+ */
+ public Optional<String> getHost() {
+ return host;
+ }
+
+ /**
+ * @return the request path of the HTTP health check request. The default value is /.
+ */
+ public Optional<String> getRequestPath() {
+ return requestPath;
+ }
+
+ /**
+ * @return the TCP port number for the HTTP health check request. The default value is 80.
+ */
+ public Optional<Integer> getPort() {
+ return port;
+ }
+
+ /**
+ * @return how often (in seconds) to send a health check. The default value is 5 seconds.
+ */
+ public Optional<Integer> getCheckIntervalSec() {
+ return checkIntervalSec;
+ }
+
+ /**
+ * @return how long (in seconds) to wait before claiming failure. The default value is 5 seconds.
+ */
+ public Optional<Integer> getTimeoutSec() {
+ return timeoutSec;
+ }
+
+ /**
+ * @return a so-far healthy VM will be marked unhealthy after this many consecutive failures.
+ * The default value is 2.
+ */
+ public Optional<Integer> getUnhealthyThreshold() {
+ return unhealthyThreshold;
+ }
+
+ /**
+ * @return an unhealthy VM will be marked healthy after this many consecutive successes. The default value is 2.
+ */
+ public Optional<Integer> getHealthyThreshold() {
+ return healthyThreshold;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ HttpHealthCheck that = HttpHealthCheck.class.cast(obj);
+ return equal(this.kind, that.kind)
+ && equal(this.name, that.name)
+ && equal(this.host, that.host);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected MoreObjects.ToStringHelper string() {
+ return super.string()
+ .omitNullValues()
+ .add("host", host.orNull())
+ .add("requestPath", requestPath.orNull())
+ .add("port", port.orNull())
+ .add("checkIntervalSec", checkIntervalSec.orNull())
+ .add("timeoutSec", timeoutSec.orNull())
+ .add("unhealthyThreshold", unhealthyThreshold.orNull())
+ .add("healthyThreshold", healthyThreshold.orNull());
+ }
+
+ public Builder toBuilder() {
+ return new Builder().fromHttpHealthCheck(this);
+ }
+
+ public static final class Builder extends Resource.Builder<Builder> {
+ private String host;
+ private String requestPath;
+ private int port;
+ private int checkIntervalSec;
+ private int timeoutSec;
+ private int unhealthyThreshold;
+ private int healthyThreshold;
+
+ /**
+ * @see HttpHealthCheck#getHost()
+ */
+ public Builder host(String host) {
+ this.host = host;
+ return this;
+ }
+
+ /**
+ * @see org.jclouds.googlecomputeengine.domain.HttpHealthCheck#getRequestPath()
+ */
+ public Builder requestPath(String requestPath) {
+ this.requestPath = requestPath;
+ return this;
+ }
+
+ /**
+ * @see org.jclouds.googlecomputeengine.domain.HttpHealthCheck#getPort()
+ */
+ public Builder port(int port) {
+ this.port = port;
+ return this;
+ }
+
+ /**
+ * @see org.jclouds.googlecomputeengine.domain.HttpHealthCheck#getCheckIntervalSec()
+ */
+ public Builder checkIntervalSec(int checkIntervalSec) {
+ this.checkIntervalSec = checkIntervalSec;
+ return this;
+ }
+
+ /**
+ * @see org.jclouds.googlecomputeengine.domain.HttpHealthCheck#getTimeoutSec()
+ */
+ public Builder timeoutSec(int timeoutSec) {
+ this.timeoutSec = timeoutSec;
+ return this;
+ }
+
+ /**
+ * @see HttpHealthCheck#getUnhealthyThreshold()
+ */
+ public Builder unhealthyThreshold(int unhealthyThreshold) {
+ this.unhealthyThreshold = unhealthyThreshold;
+ return this;
+ }
+
+ /**
+ * @see HttpHealthCheck#getHealthyThreshold()
+ */
+ public Builder healthyThreshold(int healthyThreshold) {
+ this.healthyThreshold = healthyThreshold;
+ return this;
+ }
+
+ @Override
+ protected Builder self() {
+ return this;
+ }
+
+ public HttpHealthCheck build() {
+ return new HttpHealthCheck(super.id, super.creationTimestamp, super.selfLink, super.name,
+ super.description, host, requestPath, port, checkIntervalSec, timeoutSec, unhealthyThreshold,
+ healthyThreshold);
+ }
+
+ public Builder fromHttpHealthCheck(HttpHealthCheck in) {
+ return super.fromResource(in)
+ .host(in.getHost().orNull())
+ .requestPath(in.getRequestPath().orNull())
+ .port(in.getPort().orNull())
+ .checkIntervalSec(in.getCheckIntervalSec().orNull())
+ .timeoutSec(in.getTimeoutSec().orNull())
+ .unhealthyThreshold(in.getUnhealthyThreshold().orNull())
+ .healthyThreshold(in.getHealthyThreshold().orNull());
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Image.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Image.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Image.java
index 44fc552..ddd315a 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Image.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Image.java
@@ -31,8 +31,6 @@ import com.google.common.base.Optional;
/**
* Represents a disk image to use on an instance.
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/images"/>
*/
@Beta
public final class Image extends Resource {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Instance.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Instance.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Instance.java
index 4b219f5..1dc8cd7 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Instance.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Instance.java
@@ -37,8 +37,6 @@ import com.google.common.collect.ImmutableSet;
/**
* Represents a virtual machine.
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/instances"/>
*/
@Beta
public class Instance extends Resource {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/MachineType.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/MachineType.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/MachineType.java
index d847bcb..72b1340 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/MachineType.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/MachineType.java
@@ -35,8 +35,6 @@ import com.google.common.collect.ImmutableList;
/**
* Represents a machine type used to host an instance.
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/machineTypes"/>
*/
@Beta
public final class MachineType extends Resource {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Network.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Network.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Network.java
index a3c4bb0..e306e73 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Network.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Network.java
@@ -30,8 +30,6 @@ import com.google.common.base.Optional;
/**
* Represents a network used to enable instance communication.
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/networks"/>
*/
@Beta
public final class Network extends Resource {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Operation.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Operation.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Operation.java
index f32c62d..3c9b685 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Operation.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Operation.java
@@ -36,8 +36,6 @@ import com.google.common.collect.ImmutableList;
/**
* Describes an operation being executed on some Resource
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/operations"/>
*/
@Beta
public class Operation extends Resource {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Project.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Project.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Project.java
index 2081e12..c0f4c8d 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Project.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Project.java
@@ -30,8 +30,6 @@ import com.google.common.collect.ImmutableSet;
/**
* A Project resource is the root collection and settings resource for all Google Compute Engine resources.
- *
- * @see <a href="https://developers.google.com/compute/docs/projects"/>
*/
@Beta
public class Project extends Resource {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Quota.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Quota.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Quota.java
index b1f4e04..08ce247 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Quota.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Quota.java
@@ -26,8 +26,6 @@ import com.google.common.base.Objects.ToStringHelper;
/**
* Quotas assigned to a given project or region.
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/projects#resource"/>
*/
@Beta
public class Quota {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Region.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Region.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Region.java
index bd55e41..60f055c 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Region.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Region.java
@@ -31,8 +31,6 @@ import com.google.common.collect.ImmutableSet;
/**
* Represents a region resource.
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/regions"/>
*/
@Beta
public final class Region extends Resource {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Resource.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Resource.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Resource.java
index e5c76cc..c321788 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Resource.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Resource.java
@@ -16,18 +16,10 @@
*/
package org.jclouds.googlecomputeengine.domain;
-import static com.google.common.base.Objects.ToStringHelper;
import static com.google.common.base.Objects.equal;
-import static com.google.common.base.Objects.toStringHelper;
import static com.google.common.base.Optional.fromNullable;
import static com.google.common.base.Preconditions.checkNotNull;
-import java.beans.ConstructorProperties;
-import java.net.URI;
-import java.util.Date;
-
-import org.jclouds.javax.annotation.Nullable;
-
import com.google.common.annotations.Beta;
import com.google.common.base.CaseFormat;
import com.google.common.base.Joiner;
@@ -36,6 +28,12 @@ import com.google.common.base.Optional;
import com.google.common.base.Splitter;
import com.google.common.collect.Iterables;
+import org.jclouds.javax.annotation.Nullable;
+
+import java.beans.ConstructorProperties;
+import java.net.URI;
+import java.util.Date;
+
/**
* Base class for Google Compute Engine resources.
*/
@@ -51,6 +49,10 @@ public class Resource {
DISK_TYPE_LIST,
FIREWALL,
FIREWALL_LIST,
+ FORWARDING_RULE,
+ FORWARDING_RULE_LIST,
+ HTTP_HEALTH_CHECK,
+ HTTP_HEALTH_CHECK_LIST,
IMAGE,
IMAGE_LIST,
OPERATION,
@@ -68,6 +70,8 @@ public class Resource {
ROUTE_LIST,
SNAPSHOT,
SNAPSHOT_LIST,
+ TARGET_POOL,
+ TARGET_POOL_LIST,
ZONE,
ZONE_LIST;
@@ -171,8 +175,9 @@ public class Resource {
&& equal(this.name, that.name);
}
- protected ToStringHelper string() {
- return toStringHelper(this)
+ @SuppressWarnings("deprecation")
+ protected Objects.ToStringHelper string() {
+ return Objects.toStringHelper(this)
.omitNullValues()
.add("kind", kind)
.add("id", id)
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Route.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Route.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Route.java
index 2176670..5143a5a 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Route.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Route.java
@@ -35,8 +35,6 @@ import com.google.common.collect.ImmutableSet;
/**
* Represents a route resource.
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/routes"/>
*/
@Beta
public final class Route extends Resource {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Snapshot.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Snapshot.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Snapshot.java
index 71bebfe..0942c1e 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Snapshot.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Snapshot.java
@@ -29,8 +29,6 @@ import com.google.common.base.Optional;
/**
* A Persistent Disk Snapshot resource.
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/snapshots"/>
*/
@Beta
public final class Snapshot extends AbstractDisk {
@@ -50,7 +48,7 @@ public final class Snapshot extends AbstractDisk {
}
/**
- * @return The source disk used to create this snapshot. Once the source disk
+ * @return The source disk used to insert this snapshot. Once the source disk
* has been deleted from the system, this field will be cleared, and will
* not be set even if a disk with the same name has been re-created (output only).
*/
@@ -59,7 +57,7 @@ public final class Snapshot extends AbstractDisk {
}
/**
- * @return The ID value of the disk used to create this snapshot. This value
+ * @return The ID value of the disk used to insert this snapshot. This value
* may be used to determine whether the snapshot was taken from the current
* or a previous instance of a given disk name.
*/
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/TargetPool.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/TargetPool.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/TargetPool.java
new file mode 100644
index 0000000..ff0c770
--- /dev/null
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/TargetPool.java
@@ -0,0 +1,237 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecomputeengine.domain;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableSet;
+
+import java.beans.ConstructorProperties;
+import java.net.URI;
+import java.util.Date;
+import java.util.Set;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Optional.fromNullable;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.jclouds.javax.annotation.Nullable;
+
+/**
+ * Represents an TargetPool resource.
+ */
+@Beta
+public final class TargetPool extends Resource {
+
+ private final URI region;
+ private final Set<URI> healthChecks;
+ private final Set<URI> instances;
+ private final Optional<String> sessionAffinity;
+ private final float failoverRatio;
+ private final Optional<String> backupPool;
+
+ @ConstructorProperties({
+ "id", "creationTimestamp", "selfLink", "name", "description", "region", "healthChecks", "instances",
+ "sessionAffinity", "failoverRatio", "backupPool"
+ })
+ private TargetPool(String id, Date creationTimestamp, URI selfLink, String name, String description,
+ URI region, Set<URI> healthChecks, Set<URI> instances, @Nullable String sessionAffinity,
+ float failoverRatio, @Nullable String backupPool) {
+ super(Kind.TARGET_POOL, id, creationTimestamp, selfLink, name, description);
+ this.region = checkNotNull(region, "region of %s", name);
+ this.healthChecks = healthChecks == null ? ImmutableSet.<URI>of() : healthChecks;
+ this.instances = instances == null ? ImmutableSet.<URI>of() : instances;
+ this.sessionAffinity = fromNullable(sessionAffinity);
+ this.failoverRatio = failoverRatio;
+ this.backupPool = fromNullable(backupPool);
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * @return URL of the region where the forwarding pool resides.
+ */
+ public URI getRegion() {
+ return region;
+ }
+
+ /**
+ * @return The A URL to one HttpHealthCheck resource. A member VM in this pool is considered healthy if and only if
+ * the specified health checks pass. An empty list means all member virtual machines will be considered healthy at
+ * all times but the health status of this target pool will be marked as unhealthy to indicate that no health checks
+ * are being performed.
+ */
+ public Set<URI> getHealthChecks() {
+ return healthChecks;
+ }
+
+ /**
+ * @return A list of resource URLs to the member VMs serving this pool. They must live in zones contained in the same
+ * region as this pool.
+ */
+ public Set<URI> getInstances() {
+ return instances;
+ }
+
+ /**
+ * @return the session affinity option, determines the hash method that Google Compute Engine uses to
+ * distribute traffic.
+ */
+ public Optional<String> getSessionAffinity() {
+ return sessionAffinity;
+ }
+
+ /**
+ * This field is applicable only when the target pool is serving a forwarding rule as the primary pool.
+ * The value of the a float between [0, 1]. If set, backupPool must also be set. Together,
+ * they define the fallback behavior of the primary target pool. If the ratio of the healthy VMs in the primary
+ * pool is at or below this number, traffic arriving at the load-balanced IP will be directed to the backup pool.
+ * In case where failoverRatio is not set or all the VMs in the backup pool are unhealthy,
+ * the traffic will be directed back to the primary pool in the force mode, where traffic will be spread to the
+ * healthy VMs with the best effort, or to all VMs when no VM is healthy.
+ * @return the failover ratio
+ */
+ public float getFailoverRatio() {
+ return failoverRatio;
+ }
+
+ /**
+ * This field is applicable only when the target pool is serving a forwarding rule as the primary pool.
+ * Must be a fully-qualified URL to a target pool that is in the same region as the primary target pool.
+ * If set, failoverRatio must also be set. Together, they define the fallback behavior of the primary target pool.
+ * If the ratio of the healthy VMs in the primary pool is at or below this number,
+ * traffic arriving at the load-balanced IP will be directed to the backup pool. In case where failoverRatio is
+ * not set or all the VMs in the backup pool are unhealthy, the traffic will be directed back to the primary pool
+ * in the force mode, where traffic will be spread to the healthy VMs with the best effort,
+ * or to all VMs when no VM is healthy.
+ * @return the backup pool
+ */
+ public Optional<String> getBackupPool() {
+ return backupPool;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ TargetPool that = TargetPool.class.cast(obj);
+ return equal(this.kind, that.kind)
+ && equal(this.name, that.name)
+ && equal(this.region, that.region);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected MoreObjects.ToStringHelper string() {
+ return super.string()
+ .omitNullValues()
+ .add("region", region)
+ .add("healthChecks", healthChecks)
+ .add("instances", instances)
+ .add("sessionAffinity", sessionAffinity.orNull())
+ .add("failoverRatio", failoverRatio)
+ .add("backupPool", backupPool.orNull());
+ }
+
+ public Builder toBuilder() {
+ return new Builder().fromTargetPool(this);
+ }
+
+ public static final class Builder extends Resource.Builder<Builder> {
+ private URI region;
+ private ImmutableSet.Builder<URI> healthChecks = ImmutableSet.builder();
+ private ImmutableSet.Builder<URI> instances = ImmutableSet.builder();
+ private String sessionAffinity;
+ private float failoverRatio;
+ private String backupPool;
+
+ /**
+ * @see TargetPool#getRegion()
+ */
+ public Builder region(URI region) {
+ this.region = region;
+ return this;
+ }
+
+ /**
+ * @see TargetPool#getHealthChecks()
+ */
+ public Builder healthChecks(Set<URI> healthChecks) {
+ this.healthChecks.addAll(healthChecks);
+ return this;
+ }
+
+ /**
+ * @see TargetPool#getInstances()
+ */
+ public Builder instances(Set<URI> instances) {
+ this.instances.addAll(instances);
+ return this;
+ }
+
+ /**
+ * @see TargetPool#getSessionAffinity()
+ */
+ public Builder sessionAffinity(String sessionAffinity) {
+ this.sessionAffinity = sessionAffinity;
+ return this;
+ }
+
+ /**
+ * @see TargetPool#getFailoverRatio()
+ */
+ public Builder failoverRatio(float failoverRatio) {
+ this.failoverRatio = failoverRatio;
+ return this;
+ }
+
+ public Builder backupPool(String backupPool) {
+ this.backupPool = backupPool;
+ return this;
+ }
+
+ @Override
+ protected Builder self() {
+ return this;
+ }
+
+ public TargetPool build() {
+ return new TargetPool(super.id, super.creationTimestamp, super.selfLink, super.name,
+ super.description, region, healthChecks.build(), instances.build(),
+ sessionAffinity, failoverRatio, backupPool);
+ }
+
+ public Builder fromTargetPool(TargetPool in) {
+ return super.fromResource(in)
+ .region(in.getRegion())
+ .healthChecks(in.getHealthChecks())
+ .instances(in.getInstances())
+ .sessionAffinity(in.getSessionAffinity().orNull())
+ .failoverRatio(in.getFailoverRatio())
+ .backupPool(in.getBackupPool().orNull());
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Zone.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Zone.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Zone.java
index 0f43daf..0d03c80 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Zone.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Zone.java
@@ -35,8 +35,6 @@ import com.google.common.collect.ImmutableSet;
/**
* Represents a zone resource.
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/zones"/>
*/
@Beta
public final class Zone extends Resource {
[3/6] initial commit to support GCE LB
Posted by ad...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionOperationApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionOperationApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionOperationApiExpectTest.java
index bfd7a9b..a47c62b 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionOperationApiExpectTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionOperationApiExpectTest.java
@@ -84,7 +84,7 @@ public class RegionOperationApiExpectTest extends BaseGoogleComputeEngineApiExpe
public void testGetOperationResponseIs2xx() throws Exception {
RegionOperationApi regionOperationApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, GET_OPERATION_REQUEST, GET_OPERATION_RESPONSE).getRegionOperationApiForProject("myproject");
+ TOKEN_RESPONSE, GET_OPERATION_REQUEST, GET_OPERATION_RESPONSE).getRegionOperationApi("myproject");
assertEquals(regionOperationApi.getInRegion("us-central1", "operation-1354084865060-4cf88735faeb8-bbbb12cb"),
expected());
@@ -95,7 +95,7 @@ public class RegionOperationApiExpectTest extends BaseGoogleComputeEngineApiExpe
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
RegionOperationApi regionOperationApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, GET_OPERATION_REQUEST, operationResponse).getRegionOperationApiForProject("myproject");
+ TOKEN_RESPONSE, GET_OPERATION_REQUEST, operationResponse).getRegionOperationApi("myproject");
assertNull(regionOperationApi.getInRegion("us-central1", "operation-1354084865060-4cf88735faeb8-bbbb12cb"));
}
@@ -110,7 +110,7 @@ public class RegionOperationApiExpectTest extends BaseGoogleComputeEngineApiExpe
HttpResponse operationResponse = HttpResponse.builder().statusCode(204).build();
RegionOperationApi regionOperationApi = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, delete, operationResponse).getRegionOperationApiForProject("myproject");
+ TOKEN_RESPONSE, delete, operationResponse).getRegionOperationApi("myproject");
regionOperationApi.deleteInRegion("us-central1", "operation-1352178598164-4cdcc9d031510-4aa46279");
}
@@ -125,7 +125,7 @@ public class RegionOperationApiExpectTest extends BaseGoogleComputeEngineApiExpe
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
RegionOperationApi regionOperationApi = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, delete, operationResponse).getRegionOperationApiForProject("myproject");
+ TOKEN_RESPONSE, delete, operationResponse).getRegionOperationApi("myproject");
regionOperationApi.deleteInRegion("us-central1", "operation-1352178598164-4cdcc9d031510-4aa46279");
}
@@ -142,7 +142,7 @@ public class RegionOperationApiExpectTest extends BaseGoogleComputeEngineApiExpe
.payload(payloadFromResource("/region_operation_list.json")).build();
RegionOperationApi regionOperationApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, get, operationResponse).getRegionOperationApiForProject("myproject");
+ TOKEN_RESPONSE, get, operationResponse).getRegionOperationApi("myproject");
assertEquals(regionOperationApi.listFirstPageInRegion("us-central1").toString(),
expectedList().toString());
@@ -165,7 +165,7 @@ public class RegionOperationApiExpectTest extends BaseGoogleComputeEngineApiExpe
.payload(payloadFromResource("/region_operation_list.json")).build();
RegionOperationApi regionOperationApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, get, operationResponse).getRegionOperationApiForProject("myproject");
+ TOKEN_RESPONSE, get, operationResponse).getRegionOperationApi("myproject");
assertEquals(regionOperationApi.listAtMarkerInRegion("us-central1", "CglPUEVSQVRJT04SOzU5MDQyMTQ4Nzg1Mi5vcGVyYXRpb24tMTM1Mj" +
"I0NDI1ODAzMC00Y2RkYmU2YTJkNmIwLWVkMzIyMzQz",
@@ -184,7 +184,7 @@ public class RegionOperationApiExpectTest extends BaseGoogleComputeEngineApiExpe
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
RegionOperationApi regionOperationApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, get, operationResponse).getRegionOperationApiForProject("myproject");
+ TOKEN_RESPONSE, get, operationResponse).getRegionOperationApi("myproject");
assertTrue(regionOperationApi.listInRegion("us-central1").concat().isEmpty());
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionOperationApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionOperationApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionOperationApiLiveTest.java
index 118d879..a698aee 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionOperationApiLiveTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionOperationApiLiveTest.java
@@ -38,16 +38,16 @@ public class RegionOperationApiLiveTest extends BaseGoogleComputeEngineApiLiveTe
private Operation deleteOperation;
private RegionOperationApi api() {
- return api.getRegionOperationApiForProject(userProject.get());
+ return api.getRegionOperationApi(userProject.get());
}
private AddressApi addressApi() {
- return api.getAddressApiForProject(userProject.get());
+ return api.getAddressApi(userProject.get());
}
@Test(groups = "live")
public void testCreateOperations() {
- //create some operations by adding and deleting metadata items
+ //insert some operations by adding and deleting metadata items
// this will make sure there is stuff to listFirstPage
addOperation = assertRegionOperationDoneSucessfully(addressApi().createInRegion(DEFAULT_REGION_NAME,
ADDRESS_NAME), 20);
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RouteApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RouteApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RouteApiExpectTest.java
index 6e9fa6e..0d64d14 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RouteApiExpectTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RouteApiExpectTest.java
@@ -50,7 +50,7 @@ public class RouteApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
.payload(payloadFromResource("/route_get.json")).build();
RouteApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, get, operationResponse).getRouteApiForProject("myproject");
+ TOKEN_RESPONSE, get, operationResponse).getRouteApi("myproject");
assertEquals(api.get("default-route-c99ebfbed0e1f375"),
new ParseRouteTest().expected());
@@ -67,7 +67,7 @@ public class RouteApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
RouteApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, get, operationResponse).getRouteApiForProject("myproject");
+ TOKEN_RESPONSE, get, operationResponse).getRouteApi("myproject");
assertNull(api.get("default-route-c99ebfbed0e1f375"));
}
@@ -88,7 +88,7 @@ public class RouteApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
RouteApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
TOKEN_RESPONSE, insert,
- insertRouteResponse).getRouteApiForProject("myproject");
+ insertRouteResponse).getRouteApi("myproject");
assertEquals(api.createInNetwork("default-route-c99ebfbed0e1f375",
URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/networks/default"),
@@ -114,7 +114,7 @@ public class RouteApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
.payload(payloadFromResource("/global_operation.json")).build();
RouteApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, delete, deleteResponse).getRouteApiForProject("myproject");
+ TOKEN_RESPONSE, delete, deleteResponse).getRouteApi("myproject");
assertEquals(api.delete("default-route-c99ebfbed0e1f375"),
new ParseOperationTest().expected());
@@ -132,7 +132,7 @@ public class RouteApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
HttpResponse deleteResponse = HttpResponse.builder().statusCode(404).build();
RouteApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, delete, deleteResponse).getRouteApiForProject("myproject");
+ TOKEN_RESPONSE, delete, deleteResponse).getRouteApi("myproject");
assertNull(api.delete("default-route-c99ebfbed0e1f375"));
}
@@ -150,7 +150,7 @@ public class RouteApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
.payload(payloadFromResource("/route_list.json")).build();
RouteApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, list, operationResponse).getRouteApiForProject("myproject");
+ TOKEN_RESPONSE, list, operationResponse).getRouteApi("myproject");
assertEquals(api.listFirstPage().toString(),
new ParseRouteListTest().expected().toString());
@@ -168,7 +168,7 @@ public class RouteApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
RouteApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, list, operationResponse).getRouteApiForProject("myproject");
+ TOKEN_RESPONSE, list, operationResponse).getRouteApi("myproject");
assertTrue(api.list().concat().isEmpty());
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RouteApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RouteApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RouteApiLiveTest.java
index 8269ec8..a57a8c3 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RouteApiLiveTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RouteApiLiveTest.java
@@ -41,12 +41,12 @@ public class RouteApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
public static final int TIME_WAIT = 30;
private RouteApi api() {
- return api.getRouteApiForProject(userProject.get());
+ return api.getRouteApi(userProject.get());
}
@Test(groups = "live")
public void testInsertRoute() {
- assertGlobalOperationDoneSucessfully(api.getNetworkApiForProject(userProject.get()).createInIPv4Range
+ assertGlobalOperationDoneSucessfully(api.getNetworkApi(userProject.get()).createInIPv4Range
(ROUTE_NETWORK_NAME, IPV4_RANGE), TIME_WAIT);
assertGlobalOperationDoneSucessfully(api().createInNetwork(ROUTE_NAME,
getNetworkUrl(userProject.get(), ROUTE_NETWORK_NAME),
@@ -84,7 +84,7 @@ public class RouteApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
@Test(groups = "live", dependsOnMethods = "testListRoute")
public void testDeleteRoute() {
assertGlobalOperationDoneSucessfully(api().delete(ROUTE_NAME), TIME_WAIT);
- assertGlobalOperationDoneSucessfully(api.getNetworkApiForProject(userProject.get())
+ assertGlobalOperationDoneSucessfully(api.getNetworkApi(userProject.get())
.delete(ROUTE_NETWORK_NAME), TIME_WAIT);
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiExpectTest.java
index 4caedc5..9fcfde3 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiExpectTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiExpectTest.java
@@ -57,7 +57,7 @@ public class SnapshotApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
.payload(payloadFromResource("/snapshot_get.json")).build();
SnapshotApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, GET_SNAPSHOT_REQ, operationResponse).getSnapshotApiForProject("myproject");
+ TOKEN_RESPONSE, GET_SNAPSHOT_REQ, operationResponse).getSnapshotApi("myproject");
assertEquals(api.get("test-snap"),
new ParseSnapshotTest().expected());
@@ -68,7 +68,7 @@ public class SnapshotApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
SnapshotApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, GET_SNAPSHOT_REQ, operationResponse).getSnapshotApiForProject("myproject");
+ TOKEN_RESPONSE, GET_SNAPSHOT_REQ, operationResponse).getSnapshotApi("myproject");
assertNull(api.get("test-snap"));
}
@@ -76,7 +76,7 @@ public class SnapshotApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
public void testListSnapshotNoOptionsResponseIs2xx() throws Exception {
SnapshotApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, LIST_SNAPSHOTS_REQ, LIST_SNAPSHOTS_RESPONSE).getSnapshotApiForProject("myproject");
+ TOKEN_RESPONSE, LIST_SNAPSHOTS_REQ, LIST_SNAPSHOTS_RESPONSE).getSnapshotApi("myproject");
assertEquals(api.listFirstPage().toString(),
new ParseSnapshotListTest().expected().toString());
@@ -87,7 +87,7 @@ public class SnapshotApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
SnapshotApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, LIST_SNAPSHOTS_REQ, operationResponse).getSnapshotApiForProject("myproject");
+ TOKEN_RESPONSE, LIST_SNAPSHOTS_REQ, operationResponse).getSnapshotApi("myproject");
assertTrue(api.list().concat().isEmpty());
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiLiveTest.java
index 3f833a9..cb8d330 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiLiveTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiLiveTest.java
@@ -38,11 +38,11 @@ public class SnapshotApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
private Disk disk;
private SnapshotApi api() {
- return api.getSnapshotApiForProject(userProject.get());
+ return api.getSnapshotApi(userProject.get());
}
private DiskApi diskApi() {
- return api.getDiskApiForProject(userProject.get());
+ return api.getDiskApi(userProject.get());
}
@Test(groups = "live")
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiExpectTest.java
new file mode 100644
index 0000000..e8545f2
--- /dev/null
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiExpectTest.java
@@ -0,0 +1,198 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecomputeengine.features;
+
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiExpectTest;
+import org.jclouds.googlecomputeengine.parse.ParseRegionOperationTest;
+import org.jclouds.googlecomputeengine.parse.ParseTargetPoolListTest;
+import org.jclouds.googlecomputeengine.parse.ParseTargetPoolTest;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.testng.annotations.Test;
+
+import javax.ws.rs.core.MediaType;
+
+import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE;
+import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_SCOPE;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.AssertJUnit.assertNull;
+
+@Test(groups = "unit")
+public class TargetPoolApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
+
+ public void testGetTargetPoolResponseIs2xx() throws Exception {
+ HttpRequest get = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools/test")
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN).build();
+
+ HttpResponse operationResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/targetpool_get.json")).build();
+
+ TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
+ TOKEN_RESPONSE, get, operationResponse).getTargetPoolApi("myproject", "us-central1");
+
+ assertEquals(api.get("test"),
+ new ParseTargetPoolTest().expected());
+ }
+
+ public void testGetTargetPoolResponseIs4xx() throws Exception {
+ HttpRequest get = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools/test")
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN).build();
+
+ HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
+
+ TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
+ TOKEN_RESPONSE, get, operationResponse).getTargetPoolApi("myproject", "us-central1");
+
+ assertNull(api.get("test"));
+ }
+
+ public void testInsertTargetPoolResponseIs2xx() {
+ HttpRequest insert = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools")
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN)
+ .payload(payloadFromResourceWithContentType("/targetpool_insert.json", MediaType.APPLICATION_JSON))
+ .build();
+
+ HttpResponse insertTargetPoolResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/region_operation.json")).build();
+
+ TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
+ TOKEN_RESPONSE, insert,
+ insertTargetPoolResponse).getTargetPoolApi("myproject", "us-central1");
+ assertEquals(api.create("test"), new ParseRegionOperationTest().expected());
+ }
+
+ public void testDeleteTargetPoolResponseIs2xx() {
+ HttpRequest delete = HttpRequest
+ .builder()
+ .method("DELETE")
+ .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools/test-targetPool")
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN).build();
+
+ HttpResponse deleteResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/region_operation.json")).build();
+
+ TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
+ TOKEN_RESPONSE, delete, deleteResponse).getTargetPoolApi("myproject", "us-central1");
+
+ assertEquals(api.delete("test-targetPool"),
+ new ParseRegionOperationTest().expected());
+ }
+
+ public void testDeleteTargetPoolResponseIs4xx() {
+ HttpRequest delete = HttpRequest
+ .builder()
+ .method("DELETE")
+ .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools/test-targetPool")
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN).build();
+
+ HttpResponse deleteResponse = HttpResponse.builder().statusCode(404).build();
+
+ TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
+ TOKEN_RESPONSE, delete, deleteResponse).getTargetPoolApi("myproject", "us-central1");
+
+ assertNull(api.delete("test-targetPool"));
+ }
+
+ public void testListTargetPoolsResponseIs2xx() {
+ HttpRequest list = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools")
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN).build();
+
+ HttpResponse operationResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/targetpool_list.json")).build();
+
+ TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
+ TOKEN_RESPONSE, list, operationResponse).getTargetPoolApi("myproject", "us-central1");
+
+ assertEquals(api.list().toString(),
+ new ParseTargetPoolListTest().expected().toString());
+ }
+
+ public void testListTargetPoolsResponseIs4xx() {
+ HttpRequest list = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools")
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN).build();
+
+ HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
+
+ TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
+ TOKEN_RESPONSE, list, operationResponse).getTargetPoolApi("myproject", "us-central1");
+
+ assertTrue(api.list().concat().isEmpty());
+ }
+
+ public void testAddInstanceResponseIs2xx() throws Exception {
+ HttpRequest addInstance = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools/test/addInstance")
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN)
+ .payload(payloadFromResourceWithContentType("/targetpool_addinstance.json", MediaType.APPLICATION_JSON))
+ .build();
+
+ HttpResponse operationResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/region_operation.json")).build();
+
+ TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
+ TOKEN_RESPONSE, addInstance, operationResponse).getTargetPoolApi("myproject", "us-central1");
+
+ assertEquals(api.addInstance("test",
+ "https://www.googleapis.com/compute/v1/projects/myproject/zones/europe-west1-a/instances/test"),
+ new ParseRegionOperationTest().expected());
+ }
+
+ public void testAddInstanceResponseIs4xx() throws Exception {
+ HttpRequest addInstance = HttpRequest
+ .builder()
+ .method("POST")
+ .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools/test/addInstance")
+ .addHeader("Accept", "application/json")
+ .addHeader("Authorization", "Bearer " + TOKEN)
+ .payload(payloadFromResourceWithContentType("/targetpool_addinstance.json", MediaType.APPLICATION_JSON))
+ .build();
+
+ HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
+
+ TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
+ TOKEN_RESPONSE, addInstance, operationResponse).getTargetPoolApi("myproject", "us-central1");
+
+ assertNull(api.addInstance("test", "https://www.googleapis" +
+ ".com/compute/v1/projects/myproject/zones/europe-west1-a/instances/test"));
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiLiveTest.java
new file mode 100644
index 0000000..5126b65
--- /dev/null
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiLiveTest.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecomputeengine.features;
+
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.googlecomputeengine.domain.TargetPool;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiLiveTest;
+import org.jclouds.googlecomputeengine.options.ListOptions;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+public class TargetPoolApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
+
+ private static final String TARGETPOOL_NAME = "targetpool-api-live-test";
+ private static final int TIME_WAIT = 30;
+
+ private TargetPoolApi api() {
+ return api.getTargetPoolApi(userProject.get(), DEFAULT_REGION_NAME);
+ }
+
+ @Test(groups = "live")
+ public void testInsertTargetPool() {
+ assertRegionOperationDoneSucessfully(api().create(TARGETPOOL_NAME), TIME_WAIT);
+ }
+
+ @Test(groups = "live", dependsOnMethods = "testInsertTargetPool")
+ public void testGetTargetPool() {
+ TargetPool targetPool = api().get(TARGETPOOL_NAME);
+ assertNotNull(targetPool);
+ assertEquals(targetPool.getName(), TARGETPOOL_NAME);
+ }
+
+ @Test(groups = "live", dependsOnMethods = "testGetTargetPool")
+ public void testListTargetPool() {
+
+ IterableWithMarker<TargetPool> targetPool = api().list(new ListOptions.Builder()
+ .filter("name eq " + TARGETPOOL_NAME));
+ assertEquals(targetPool.toList().size(), 1);
+ }
+
+ @Test(groups = "live", dependsOnMethods = "testListTargetPool")
+ public void testDeleteTargetPool() {
+ assertRegionOperationDoneSucessfully(api().delete(TARGETPOOL_NAME), TIME_WAIT);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneApiExpectTest.java
index 0a26bd6..19036dd 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneApiExpectTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneApiExpectTest.java
@@ -60,7 +60,7 @@ public class ZoneApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
.payload(payloadFromResource("/zone_get.json")).build();
ZoneApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, GET_ZONE_REQ, operationResponse).getZoneApiForProject("myproject");
+ TOKEN_RESPONSE, GET_ZONE_REQ, operationResponse).getZoneApi("myproject");
assertEquals(api.get("us-central1-a"),
new ParseZoneTest().expected());
@@ -71,7 +71,7 @@ public class ZoneApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
ZoneApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, GET_ZONE_REQ, operationResponse).getZoneApiForProject("myproject");
+ TOKEN_RESPONSE, GET_ZONE_REQ, operationResponse).getZoneApi("myproject");
assertNull(api.get("us-central1-a"));
}
@@ -79,7 +79,7 @@ public class ZoneApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
public void testListZoneNoOptionsResponseIs2xx() throws Exception {
ZoneApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, LIST_ZONES_REQ, LIST_ZONES_RESPONSE).getZoneApiForProject("myproject");
+ TOKEN_RESPONSE, LIST_ZONES_REQ, LIST_ZONES_RESPONSE).getZoneApi("myproject");
assertEquals(api.listFirstPage().toString(),
new ParseZoneListTest().expected().toString());
@@ -90,7 +90,7 @@ public class ZoneApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
ZoneApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, LIST_ZONES_REQ, operationResponse).getZoneApiForProject("myproject");
+ TOKEN_RESPONSE, LIST_ZONES_REQ, operationResponse).getZoneApi("myproject");
assertTrue(api.list().concat().isEmpty());
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneApiLiveTest.java
index 934e93a..a6b56d4 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneApiLiveTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneApiLiveTest.java
@@ -39,7 +39,7 @@ public class ZoneApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
private Zone zone;
private ZoneApi api() {
- return api.getZoneApiForProject(userProject.get());
+ return api.getZoneApi(userProject.get());
}
@Test(groups = "live")
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneOperationApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneOperationApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneOperationApiExpectTest.java
index c3698bf..8866770 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneOperationApiExpectTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneOperationApiExpectTest.java
@@ -81,7 +81,7 @@ public class ZoneOperationApiExpectTest extends BaseGoogleComputeEngineApiExpect
public void testGetOperationResponseIs2xx() throws Exception {
ZoneOperationApi zoneOperationApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, GET_ZONE_OPERATION_REQUEST, GET_ZONE_OPERATION_RESPONSE).getZoneOperationApiForProject("myproject");
+ TOKEN_RESPONSE, GET_ZONE_OPERATION_REQUEST, GET_ZONE_OPERATION_RESPONSE).getZoneOperationApi("myproject");
assertEquals(zoneOperationApi.getInZone("us-central1-a", "operation-1354084865060-4cf88735faeb8-bbbb12cb"),
expected());
@@ -92,7 +92,7 @@ public class ZoneOperationApiExpectTest extends BaseGoogleComputeEngineApiExpect
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
ZoneOperationApi zoneOperationApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, GET_ZONE_OPERATION_REQUEST, operationResponse).getZoneOperationApiForProject("myproject");
+ TOKEN_RESPONSE, GET_ZONE_OPERATION_REQUEST, operationResponse).getZoneOperationApi("myproject");
assertNull(zoneOperationApi.getInZone("us-central1-a", "operation-1354084865060-4cf88735faeb8-bbbb12cb"));
}
@@ -107,7 +107,7 @@ public class ZoneOperationApiExpectTest extends BaseGoogleComputeEngineApiExpect
HttpResponse operationResponse = HttpResponse.builder().statusCode(204).build();
ZoneOperationApi zoneOperationApi = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, delete, operationResponse).getZoneOperationApiForProject("myproject");
+ TOKEN_RESPONSE, delete, operationResponse).getZoneOperationApi("myproject");
zoneOperationApi.deleteInZone("us-central1-a", "operation-1352178598164-4cdcc9d031510-4aa46279");
}
@@ -122,7 +122,7 @@ public class ZoneOperationApiExpectTest extends BaseGoogleComputeEngineApiExpect
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
ZoneOperationApi zoneOperationApi = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, delete, operationResponse).getZoneOperationApiForProject("myproject");
+ TOKEN_RESPONSE, delete, operationResponse).getZoneOperationApi("myproject");
zoneOperationApi.deleteInZone("us-central1-a", "operation-1352178598164-4cdcc9d031510-4aa46279");
}
@@ -139,7 +139,7 @@ public class ZoneOperationApiExpectTest extends BaseGoogleComputeEngineApiExpect
.payload(payloadFromResource("/zone_operation_list.json")).build();
ZoneOperationApi zoneOperationApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, get, operationResponse).getZoneOperationApiForProject("myproject");
+ TOKEN_RESPONSE, get, operationResponse).getZoneOperationApi("myproject");
assertEquals(zoneOperationApi.listFirstPageInZone("us-central1-a").toString(),
expectedList().toString());
@@ -162,7 +162,7 @@ public class ZoneOperationApiExpectTest extends BaseGoogleComputeEngineApiExpect
.payload(payloadFromResource("/zone_operation_list.json")).build();
ZoneOperationApi zoneOperationApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, get, operationResponse).getZoneOperationApiForProject("myproject");
+ TOKEN_RESPONSE, get, operationResponse).getZoneOperationApi("myproject");
assertEquals(zoneOperationApi.listAtMarkerInZone("us-central1-a",
"CglPUEVSQVRJT04SOzU5MDQyMTQ4Nzg1Mi5vcGVyYXRpb24tMTM1Mj" +
@@ -182,7 +182,7 @@ public class ZoneOperationApiExpectTest extends BaseGoogleComputeEngineApiExpect
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
ZoneOperationApi zoneOperationApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, get, operationResponse).getZoneOperationApiForProject("myproject");
+ TOKEN_RESPONSE, get, operationResponse).getZoneOperationApi("myproject");
assertTrue(zoneOperationApi.listInZone("us-central1-a").concat().isEmpty());
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneOperationApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneOperationApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneOperationApiLiveTest.java
index 4d30272..9dd5c93 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneOperationApiLiveTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneOperationApiLiveTest.java
@@ -39,16 +39,16 @@ public class ZoneOperationApiLiveTest extends BaseGoogleComputeEngineApiLiveTest
private Operation deleteOperation;
private ZoneOperationApi api() {
- return api.getZoneOperationApiForProject(userProject.get());
+ return api.getZoneOperationApi(userProject.get());
}
private DiskApi diskApi() {
- return api.getDiskApiForProject(userProject.get());
+ return api.getDiskApi(userProject.get());
}
@Test(groups = "live")
public void testCreateOperations() {
- //create some operations by creating and deleting a disk
+ //insert some operations by creating and deleting a disk
// this will make sure there is stuff to listFirstPage
addOperation = assertZoneOperationDoneSucessfully(diskApi().createInZone(DISK_NAME, 1, DEFAULT_ZONE_NAME), TIME_WAIT);
deleteOperation = assertZoneOperationDoneSucessfully(diskApi().deleteInZone(DEFAULT_ZONE_NAME, DISK_NAME), TIME_WAIT);
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/functions/CreateNetworkIfNeededTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/functions/CreateNetworkIfNeededTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/functions/CreateNetworkIfNeededTest.java
index 292f9d4..e77f35a 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/functions/CreateNetworkIfNeededTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/functions/CreateNetworkIfNeededTest.java
@@ -59,16 +59,16 @@ public class CreateNetworkIfNeededTest {
}
};
- expect(api.getNetworkApiForProject(userProject.get())).andReturn(nwApi).atLeastOnce();
- expect(api.getGlobalOperationApiForProject(userProject.get())).andReturn(globalApi).atLeastOnce();
+ expect(api.getNetworkApi(userProject.get())).andReturn(nwApi).atLeastOnce();
+ expect(api.getGlobalOperationApi(userProject.get())).andReturn(globalApi).atLeastOnce();
expect(nwApi.createInIPv4Range("this-network", "0.0.0.0/0"))
.andReturn(createOp);
- expect(globalApi.get("create-op")).andReturn(createOp);
+ expect(globalApi.get("insert-op")).andReturn(createOp);
expect(nwApi.get("this-network")).andReturn(null);
expect(nwApi.get("this-network")).andReturn(network);
- expect(createOp.getName()).andReturn("create-op");
+ expect(createOp.getName()).andReturn("insert-op");
expect(createOp.getStatus()).andReturn(Operation.Status.DONE);
expect(createOp.getHttpError()).andReturn(fromNullable((HttpResponse)null));
replay(api, nwApi, createOp, globalApi);
@@ -104,16 +104,16 @@ public class CreateNetworkIfNeededTest {
}
};
- expect(api.getNetworkApiForProject(userProject.get())).andReturn(nwApi).atLeastOnce();
- expect(api.getGlobalOperationApiForProject(userProject.get())).andReturn(globalApi).atLeastOnce();
+ expect(api.getNetworkApi(userProject.get())).andReturn(nwApi).atLeastOnce();
+ expect(api.getGlobalOperationApi(userProject.get())).andReturn(globalApi).atLeastOnce();
expect(nwApi.createInIPv4RangeWithGateway("this-network", "0.0.0.0/0", "1.2.3.4"))
.andReturn(createOp);
- expect(globalApi.get("create-op")).andReturn(createOp);
+ expect(globalApi.get("insert-op")).andReturn(createOp);
expect(nwApi.get("this-network")).andReturn(null);
expect(nwApi.get("this-network")).andReturn(network);
- expect(createOp.getName()).andReturn("create-op");
+ expect(createOp.getName()).andReturn("insert-op");
expect(createOp.getStatus()).andReturn(Operation.Status.DONE);
expect(createOp.getHttpError()).andReturn(fromNullable((HttpResponse)null));
replay(api, nwApi, createOp, globalApi);
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiLiveTest.java
index bb4e136..972f591 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiLiveTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiLiveTest.java
@@ -17,6 +17,7 @@
package org.jclouds.googlecomputeengine.internal;
import static java.util.concurrent.TimeUnit.SECONDS;
+import static org.jclouds.oauth.v2.OAuthTestUtils.setCredential;
import static org.jclouds.util.Predicates2.retry;
import static org.testng.Assert.assertEquals;
import static org.testng.AssertJUnit.assertTrue;
@@ -70,11 +71,17 @@ public class BaseGoogleComputeEngineApiLiveTest extends BaseApiLiveTest<GoogleCo
protected Predicate<AtomicReference<Operation>> regionOperationDonePredicate;
protected Predicate<AtomicReference<Operation>> zoneOperationDonePredicate;
-
public BaseGoogleComputeEngineApiLiveTest() {
provider = "google-compute-engine";
}
+ @Override
+ protected Properties setupProperties() {
+ Properties props = super.setupProperties();
+ setCredential(props, provider + ".credential");
+ return props;
+ }
+
protected GoogleComputeEngineApi create(Properties props, Iterable<Module> modules) {
Injector injector = newBuilder().modules(modules).overrides(props).buildInjector();
userProject = injector.getInstance(Key.get(new TypeLiteral<Supplier<String>>() {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseForwardingRuleListTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseForwardingRuleListTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseForwardingRuleListTest.java
new file mode 100644
index 0000000..8b6a0ee
--- /dev/null
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseForwardingRuleListTest.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecomputeengine.parse;
+
+import com.google.common.collect.ImmutableSet;
+import org.jclouds.date.internal.SimpleDateFormatDateService;
+import org.jclouds.googlecomputeengine.domain.ForwardingRule;
+import org.jclouds.googlecomputeengine.domain.ListPage;
+import org.jclouds.googlecomputeengine.domain.Resource;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
+import org.testng.annotations.Test;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+import java.net.URI;
+
+@Test(groups = "unit")
+public class ParseForwardingRuleListTest extends BaseGoogleComputeEngineParseTest<ListPage<ForwardingRule>> {
+
+ @Override
+ public String resource() {
+ return "/forwardingrule_list.json";
+ }
+
+ @Override
+ @Consumes(MediaType.APPLICATION_JSON)
+ public ListPage<ForwardingRule> expected() {
+ return ListPage.<ForwardingRule>builder()
+ .kind(Resource.Kind.FORWARDING_RULE_LIST)
+ .items(ImmutableSet.of(ForwardingRule.builder()
+ .id("6732523704970219884")
+ .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2014-01-08T06:51:10.809-08:00"))
+ .selfLink(URI.create("https://www.googleapis" +
+ ".com/compute/v1/projects/myproject/regions/europe-west1/forwardingRules/test-forwarding-rule"))
+ .name("test-forwarding-rule")
+ .region(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/europe-west1"))
+ .ipAddress("23.251.129.77")
+ .ipProtocol("TCP")
+ .target(URI.create("https://www.googleapis" +
+ ".com/compute/v1/projects/myproject/regions/europe-west1/targetPools/test-target-pool"))
+ .portRange("1-65535")
+ .build())
+ ).build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseForwardingRuleTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseForwardingRuleTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseForwardingRuleTest.java
new file mode 100644
index 0000000..712e0ee
--- /dev/null
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseForwardingRuleTest.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecomputeengine.parse;
+
+import org.jclouds.date.internal.SimpleDateFormatDateService;
+import org.jclouds.googlecomputeengine.domain.ForwardingRule;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
+import org.testng.annotations.Test;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+import java.net.URI;
+
+@Test(groups = "unit")
+public class ParseForwardingRuleTest extends BaseGoogleComputeEngineParseTest<ForwardingRule> {
+
+ @Override
+ public String resource() {
+ return "/forwardingrule_get.json";
+ }
+
+ @Override
+ @Consumes(MediaType.APPLICATION_JSON)
+ public ForwardingRule expected() {
+ return ForwardingRule.builder()
+ .id("6732523704970219884")
+ .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2014-01-08T06:51:10.809-08:00"))
+ .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/europe-west1/forwardingRules/test-forwarding-rule"))
+ .name("test-forwarding-rule")
+ .region(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/europe-west1"))
+ .target(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/europe-west1/targetPools/test-target-pool"))
+ .ipAddress("23.251.129.77")
+ .ipProtocol("TCP")
+ .portRange("1-65535")
+ .build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHttpHealthCheckListTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHttpHealthCheckListTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHttpHealthCheckListTest.java
new file mode 100644
index 0000000..f726320
--- /dev/null
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHttpHealthCheckListTest.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecomputeengine.parse;
+
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.date.internal.SimpleDateFormatDateService;
+import org.jclouds.googlecomputeengine.domain.HttpHealthCheck;
+import org.jclouds.googlecomputeengine.domain.ListPage;
+import org.jclouds.googlecomputeengine.domain.Resource;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+@Test(groups = "unit")
+public class ParseHttpHealthCheckListTest extends BaseGoogleComputeEngineParseTest<ListPage<HttpHealthCheck>> {
+
+ @Override
+ public String resource() {
+ return "/httphealthcheck_list.json";
+ }
+
+ @Override
+ @Consumes(MediaType.APPLICATION_JSON)
+ public ListPage<HttpHealthCheck> expected() {
+ return ListPage.<HttpHealthCheck>builder()
+ .kind(Resource.Kind.HTTP_HEALTH_CHECK_LIST)
+ .items(ImmutableSet.of(HttpHealthCheck.builder()
+ .id("2761502483700014319")
+ .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2014-01-14T05:55:54.910-08:00"))
+ .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/jclouds-gce/global/httpHealthChecks/http-health-check-api-live-test"))
+ .name("http-health-check-api-live-test")
+ .port(0)
+ .checkIntervalSec(0)
+ .timeoutSec(0)
+ .unhealthyThreshold(0)
+ .healthyThreshold(0)
+ .build(),
+ HttpHealthCheck.builder()
+ .id("1035854271083519643")
+ .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2014-01-08T14:38:29.363-08:00"))
+ .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/jclouds-gce/global/httpHealthChecks/myname-andrea-kmzmi1bh-http-health-check"))
+ .name("myname-andrea-kmzmi1bh-http-health-check")
+ .port(0)
+ .checkIntervalSec(0)
+ .timeoutSec(5)
+ .unhealthyThreshold(2)
+ .healthyThreshold(0)
+ .build(),
+ HttpHealthCheck.builder()
+ .id("7006563292274658743")
+ .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2014-01-08T14:48:03.276-08:00"))
+ .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/jclouds-gce/global/httpHealthChecks/myname-andrea-zk7gadwq-http-health-check"))
+ .name("myname-andrea-zk7gadwq-http-health-check")
+ .port(0)
+ .checkIntervalSec(0)
+ .timeoutSec(5)
+ .unhealthyThreshold(2)
+ .healthyThreshold(0)
+ .build()
+ ))
+ .build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHttpHealthCheckTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHttpHealthCheckTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHttpHealthCheckTest.java
new file mode 100644
index 0000000..d492544
--- /dev/null
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHttpHealthCheckTest.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecomputeengine.parse;
+
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.date.internal.SimpleDateFormatDateService;
+import org.jclouds.googlecomputeengine.domain.HttpHealthCheck;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit")
+public class ParseHttpHealthCheckTest extends BaseGoogleComputeEngineParseTest<HttpHealthCheck> {
+
+ @Override
+ public String resource() {
+ return "/httphealthcheck_get.json";
+ }
+
+ @Override
+ @Consumes(MediaType.APPLICATION_JSON)
+ public HttpHealthCheck expected() {
+ return HttpHealthCheck.builder()
+ .id("2761502483700014319")
+ .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2014-01-14T05:55:54.910-08:00"))
+ .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/jclouds-gce/global/httpHealthChecks/http-health-check-api-live-test"))
+ .name("http-health-check-api-live-test")
+ .port(0)
+ .checkIntervalSec(0)
+ .timeoutSec(0)
+ .unhealthyThreshold(0)
+ .healthyThreshold(0)
+ .build();
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionOperationTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionOperationTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionOperationTest.java
new file mode 100644
index 0000000..b0f59cf
--- /dev/null
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionOperationTest.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecomputeengine.parse;
+
+import org.jclouds.date.internal.SimpleDateFormatDateService;
+import org.jclouds.googlecomputeengine.domain.Operation;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
+import org.testng.annotations.Test;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+import java.net.URI;
+
+@Test(groups = "unit")
+public class ParseRegionOperationTest extends BaseGoogleComputeEngineParseTest<Operation> {
+
+ @Override
+ public String resource() {
+ return "/region_operation.json";
+ }
+
+ @Override
+ @Consumes(MediaType.APPLICATION_JSON)
+ public Operation expected() {
+ SimpleDateFormatDateService dateService = new SimpleDateFormatDateService();
+ return Operation.builder().id("13053095055850848306")
+ .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/operations/operation-1354084865060-4cf88735faeb8-bbbb12cb"))
+ .name("operation-1354084865060-4cf88735faeb8-bbbb12cb")
+ .targetLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/addresses/test-address"))
+ .targetId("13053094017547040099")
+ .status(Operation.Status.DONE)
+ .user("user@developer.gserviceaccount.com")
+ .progress(100)
+ .insertTime(dateService.iso8601DateParse("2012-11-28T06:41:05.060"))
+ .startTime(dateService.iso8601DateParse("2012-11-28T06:41:05.142"))
+ .endTime(dateService.iso8601DateParse("2012-11-28T06:41:06.142"))
+ .operationType("insert")
+ .region(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1"))
+ .build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolListTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolListTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolListTest.java
new file mode 100644
index 0000000..0bf743f
--- /dev/null
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolListTest.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecomputeengine.parse;
+
+import com.google.common.collect.ImmutableSet;
+import org.jclouds.date.internal.SimpleDateFormatDateService;
+import org.jclouds.googlecomputeengine.domain.ListPage;
+import org.jclouds.googlecomputeengine.domain.Resource;
+import org.jclouds.googlecomputeengine.domain.TargetPool;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
+import org.testng.annotations.Test;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+import java.net.URI;
+
+@Test(groups = "unit")
+public class ParseTargetPoolListTest extends BaseGoogleComputeEngineParseTest<ListPage<TargetPool>> {
+
+ @Override
+ public String resource() {
+ return "/targetpool_list.json";
+ }
+
+ @Override
+ @Consumes(MediaType.APPLICATION_JSON)
+ public ListPage<TargetPool> expected() {
+ return ListPage.<TargetPool>builder()
+ .kind(Resource.Kind.TARGET_POOL_LIST)
+ .items(ImmutableSet.of(TargetPool.builder()
+ .id("5199309593612841404")
+ .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2014-01-07T05:25:27.783-08:00"))
+ .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools/test-targetpool"))
+ .name("test-targetpool")
+ .region(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1"))
+ .sessionAffinity("NONE")
+ .build())
+ ).build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolTest.java
new file mode 100644
index 0000000..faf7a77
--- /dev/null
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolTest.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecomputeengine.parse;
+
+import org.jclouds.date.internal.SimpleDateFormatDateService;
+import org.jclouds.googlecomputeengine.domain.TargetPool;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
+import org.testng.annotations.Test;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+import java.net.URI;
+
+@Test(groups = "unit")
+public class ParseTargetPoolTest extends BaseGoogleComputeEngineParseTest<TargetPool> {
+
+ @Override
+ public String resource() {
+ return "/targetpool_get.json";
+ }
+
+ @Override
+ @Consumes(MediaType.APPLICATION_JSON)
+ public TargetPool expected() {
+ return TargetPool.builder()
+ .id("5199309593612841404")
+ .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2014-01-07T05:25:27.783-08:00"))
+ .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools/test-targetpool"))
+ .name("test-targetpool")
+ .sessionAffinity("NONE")
+ .region(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1"))
+ .build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/resources/forwardingrule_get.json
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/resources/forwardingrule_get.json b/google-compute-engine/src/test/resources/forwardingrule_get.json
new file mode 100644
index 0000000..c3e29e5
--- /dev/null
+++ b/google-compute-engine/src/test/resources/forwardingrule_get.json
@@ -0,0 +1,12 @@
+{
+"kind": "compute#forwardingRule",
+"id": "6732523704970219884",
+"creationTimestamp": "2014-01-08T06:51:10.809-08:00",
+"name": "test-forwarding-rule",
+"region": "https://www.googleapis.com/compute/v1/projects/myproject/regions/europe-west1",
+"IPAddress": "23.251.129.77",
+"IPProtocol": "TCP",
+"portRange": "1-65535",
+"target": "https://www.googleapis.com/compute/v1/projects/myproject/regions/europe-west1/targetPools/test-target-pool",
+"selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/regions/europe-west1/forwardingRules/test-forwarding-rule"
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/resources/forwardingrule_insert.json
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/resources/forwardingrule_insert.json b/google-compute-engine/src/test/resources/forwardingrule_insert.json
new file mode 100644
index 0000000..62c6090
--- /dev/null
+++ b/google-compute-engine/src/test/resources/forwardingrule_insert.json
@@ -0,0 +1,4 @@
+{
+"name": "test-forwarding-rule",
+"target": "https://www.googleapis.com/compute/v1/projects/myproject/regions/europe-west1/targetPools/test-target-pool"
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/resources/forwardingrule_list.json
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/resources/forwardingrule_list.json b/google-compute-engine/src/test/resources/forwardingrule_list.json
new file mode 100644
index 0000000..59f1204
--- /dev/null
+++ b/google-compute-engine/src/test/resources/forwardingrule_list.json
@@ -0,0 +1,19 @@
+{
+"kind": "compute#forwardingRuleList",
+"selfLink": "https://content.googleapis.com/compute/v1/projects/myproject/regions/europe-west1/forwardingRules",
+"id": "projects/myproject/regions/europe-west1/forwardingRules",
+"items": [
+{
+"kind": "compute#forwardingRule",
+"id": "6732523704970219884",
+"creationTimestamp": "2014-01-08T06:51:10.809-08:00",
+"name": "test-forwarding-rule",
+"region": "https://www.googleapis.com/compute/v1/projects/myproject/regions/europe-west1",
+"IPAddress": "23.251.129.77",
+"IPProtocol": "TCP",
+"portRange": "1-65535",
+"target": "https://www.googleapis.com/compute/v1/projects/myproject/regions/europe-west1/targetPools/test-target-pool",
+"selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/regions/europe-west1/forwardingRules/test-forwarding-rule"
+}
+]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/resources/httphealthcheck_get.json
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/resources/httphealthcheck_get.json b/google-compute-engine/src/test/resources/httphealthcheck_get.json
new file mode 100644
index 0000000..4a7cd84
--- /dev/null
+++ b/google-compute-engine/src/test/resources/httphealthcheck_get.json
@@ -0,0 +1,7 @@
+{
+ "kind": "compute#httpHealthCheck",
+ "selfLink": "https://www.googleapis.com/compute/v1/projects/jclouds-gce/global/httpHealthChecks/http-health-check-api-live-test",
+ "id": "2761502483700014319",
+ "creationTimestamp": "2014-01-14T05:55:54.910-08:00",
+ "name": "http-health-check-api-live-test"
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/resources/httphealthcheck_insert.json
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/resources/httphealthcheck_insert.json b/google-compute-engine/src/test/resources/httphealthcheck_insert.json
new file mode 100644
index 0000000..0564f1d
--- /dev/null
+++ b/google-compute-engine/src/test/resources/httphealthcheck_insert.json
@@ -0,0 +1 @@
+{"name":"http-health-check","timeoutSec":0,"unhealthyThreshold":0}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/resources/httphealthcheck_list.json
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/resources/httphealthcheck_list.json b/google-compute-engine/src/test/resources/httphealthcheck_list.json
new file mode 100644
index 0000000..4436a26
--- /dev/null
+++ b/google-compute-engine/src/test/resources/httphealthcheck_list.json
@@ -0,0 +1,32 @@
+{
+ "kind": "compute#httpHealthCheckList",
+ "selfLink": "https://www.googleapis.com/compute/v1/projects/jclouds-gce/global/httpHealthChecks",
+ "id": "projects/jclouds-gce/global/httpHealthChecks",
+ "items": [
+ {
+ "kind": "compute#httpHealthCheck",
+ "selfLink": "https://www.googleapis.com/compute/v1/projects/jclouds-gce/global/httpHealthChecks/http-health-check-api-live-test",
+ "id": "2761502483700014319",
+ "creationTimestamp": "2014-01-14T05:55:54.910-08:00",
+ "name": "http-health-check-api-live-test"
+ },
+ {
+ "kind": "compute#httpHealthCheck",
+ "selfLink": "https://www.googleapis.com/compute/v1/projects/jclouds-gce/global/httpHealthChecks/myname-andrea-kmzmi1bh-http-health-check",
+ "id": "1035854271083519643",
+ "creationTimestamp": "2014-01-08T14:38:29.363-08:00",
+ "name": "myname-andrea-kmzmi1bh-http-health-check",
+ "timeoutSec": 5,
+ "unhealthyThreshold": 2
+ },
+ {
+ "kind": "compute#httpHealthCheck",
+ "selfLink": "https://www.googleapis.com/compute/v1/projects/jclouds-gce/global/httpHealthChecks/myname-andrea-zk7gadwq-http-health-check",
+ "id": "7006563292274658743",
+ "creationTimestamp": "2014-01-08T14:48:03.276-08:00",
+ "name": "myname-andrea-zk7gadwq-http-health-check",
+ "timeoutSec": 5,
+ "unhealthyThreshold": 2
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/resources/targetpool_addinstance.json
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/resources/targetpool_addinstance.json b/google-compute-engine/src/test/resources/targetpool_addinstance.json
new file mode 100644
index 0000000..63fc50f
--- /dev/null
+++ b/google-compute-engine/src/test/resources/targetpool_addinstance.json
@@ -0,0 +1 @@
+{"instance":"https://www.googleapis.com/compute/v1/projects/myproject/zones/europe-west1-a/instances/test"}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/resources/targetpool_get.json
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/resources/targetpool_get.json b/google-compute-engine/src/test/resources/targetpool_get.json
new file mode 100644
index 0000000..6ff1696
--- /dev/null
+++ b/google-compute-engine/src/test/resources/targetpool_get.json
@@ -0,0 +1,9 @@
+{
+ "kind": "compute#targetPool",
+ "id": "5199309593612841404",
+ "creationTimestamp": "2014-01-07T05:25:27.783-08:00",
+ "name": "test-targetpool",
+ "region": "https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1",
+ "sessionAffinity": "NONE",
+ "selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools/test-targetpool"
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/resources/targetpool_insert.json
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/resources/targetpool_insert.json b/google-compute-engine/src/test/resources/targetpool_insert.json
new file mode 100644
index 0000000..cdbc2f7
--- /dev/null
+++ b/google-compute-engine/src/test/resources/targetpool_insert.json
@@ -0,0 +1,3 @@
+{
+ "name": "test"
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/resources/targetpool_list.json
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/resources/targetpool_list.json b/google-compute-engine/src/test/resources/targetpool_list.json
new file mode 100644
index 0000000..dd65458
--- /dev/null
+++ b/google-compute-engine/src/test/resources/targetpool_list.json
@@ -0,0 +1,17 @@
+{
+ "kind": "compute#targetPoolList",
+ "selfLink": "https://content.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools",
+ "id": "projects/myproject/regions/us-central1/targetPools",
+ "items": [
+ {
+
+ "kind": "compute#targetPool",
+ "id": "5199309593612841404",
+ "creationTimestamp": "2014-01-07T05:25:27.783-08:00",
+ "name": "test-targetpool",
+ "region": "https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1",
+ "sessionAffinity": "NONE",
+ "selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools/test-targetpool"
+ }
+ ]
+}
\ No newline at end of file