mirror of https://github.com/apache/jclouds.git
added CreationTimestamp to HttpHealthCheck and TargetPool + refactor Warning
This commit is contained in:
parent
dd5c4c5c6b
commit
f81e44ceb2
|
@ -17,6 +17,7 @@
|
|||
package org.jclouds.googlecomputeengine.domain;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Date;
|
||||
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.json.SerializedNames;
|
||||
|
@ -30,6 +31,8 @@ public abstract class HttpHealthCheck {
|
|||
|
||||
public abstract URI selfLink();
|
||||
|
||||
public abstract Date creationTimestamp();
|
||||
|
||||
public abstract String name();
|
||||
|
||||
@Nullable public abstract String description();
|
||||
|
@ -58,12 +61,12 @@ public abstract class HttpHealthCheck {
|
|||
@Nullable public abstract Integer healthyThreshold();
|
||||
|
||||
@SerializedNames(
|
||||
{ "id", "selfLink", "name", "description", "host", "requestPath", "port", "checkIntervalSec", "timeoutSec",
|
||||
{ "id", "selfLink", "creationTimestamp", "name", "description", "host", "requestPath", "port", "checkIntervalSec", "timeoutSec",
|
||||
"unhealthyThreshold", "healthyThreshold" })
|
||||
public static HttpHealthCheck create(String id, URI selfLink, String name, String description, String host,
|
||||
public static HttpHealthCheck create(String id, URI selfLink, Date creationTimestamp, String name, String description, String host,
|
||||
String requestPath, Integer port, Integer checkIntervalSec, Integer timeoutSec, Integer unhealthyThreshold,
|
||||
Integer healthyThreshold) {
|
||||
return new AutoValue_HttpHealthCheck(id, selfLink, name, description, host,
|
||||
return new AutoValue_HttpHealthCheck(id, selfLink, creationTimestamp, name, description, host,
|
||||
requestPath, port, checkIntervalSec, timeoutSec, unhealthyThreshold, healthyThreshold);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* 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 org.jclouds.json.SerializedNames;
|
||||
|
||||
import com.google.auto.value.AutoValue;
|
||||
|
||||
@AutoValue
|
||||
public abstract class KeyValuePair {
|
||||
|
||||
public abstract String key();
|
||||
|
||||
public abstract String value();
|
||||
|
||||
@SerializedNames({ "key", "value" })
|
||||
public static KeyValuePair create(String key, String value) {
|
||||
return new AutoValue_KeyValuePair(key, value);
|
||||
}
|
||||
|
||||
KeyValuePair(){
|
||||
}
|
||||
}
|
|
@ -33,25 +33,13 @@ import com.google.auto.value.AutoValue;
|
|||
@AutoValue
|
||||
public abstract class Metadata implements Cloneable {
|
||||
|
||||
@AutoValue
|
||||
public abstract static class Entry {
|
||||
abstract String key();
|
||||
|
||||
abstract String value();
|
||||
|
||||
@SerializedNames({ "key", "value" })
|
||||
public static Entry create(String key, String value) {
|
||||
return new AutoValue_Metadata_Entry(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
/** The fingerprint for the items - needed for updating them. */
|
||||
@Nullable public abstract String fingerprint();
|
||||
|
||||
/** Adds or replaces a metadata entry. */
|
||||
public Metadata put(String key, String value) {
|
||||
remove(key);
|
||||
items().add(Entry.create(key, value));
|
||||
items().add(KeyValuePair.create(key, value));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -77,9 +65,9 @@ public abstract class Metadata implements Cloneable {
|
|||
/** Copies the metadata into a new mutable map. */
|
||||
public Map<String, String> asMap() {
|
||||
Map<String, String> result = new LinkedHashMap<String, String>();
|
||||
ArrayList<Entry> items = items();
|
||||
ArrayList<KeyValuePair> items = items();
|
||||
for (int i = 0, length = items.size(); i < length; i++) {
|
||||
Entry item = items.get(i);
|
||||
KeyValuePair item = items.get(i);
|
||||
result.put(item.key(), item.value());
|
||||
}
|
||||
return result;
|
||||
|
@ -87,9 +75,9 @@ public abstract class Metadata implements Cloneable {
|
|||
|
||||
/** Returns the value with the supplied key, or null. */
|
||||
@Nullable public String get(String key) {
|
||||
ArrayList<Entry> items = items();
|
||||
ArrayList<KeyValuePair> items = items();
|
||||
for (int i = 0, length = items.size(); i < length; i++) {
|
||||
Entry item = items.get(i);
|
||||
KeyValuePair item = items.get(i);
|
||||
if (item.key().equals(key)) {
|
||||
return item.value();
|
||||
}
|
||||
|
@ -106,7 +94,7 @@ public abstract class Metadata implements Cloneable {
|
|||
}
|
||||
|
||||
/** Mutable list of metadata. */
|
||||
abstract ArrayList<Entry> items();
|
||||
abstract ArrayList<KeyValuePair> items();
|
||||
|
||||
public static Metadata create() {
|
||||
return Metadata.create(null, null);
|
||||
|
@ -117,14 +105,14 @@ public abstract class Metadata implements Cloneable {
|
|||
}
|
||||
|
||||
@SerializedNames({ "fingerprint", "items" })
|
||||
static Metadata create(String fingerprint, ArrayList<Entry> items) { // Dictates the type when created from json!
|
||||
return new AutoValue_Metadata(fingerprint, items != null ? items : new ArrayList<Entry>());
|
||||
static Metadata create(String fingerprint, ArrayList<KeyValuePair> items) { // Dictates the type when created from json!
|
||||
return new AutoValue_Metadata(fingerprint, items != null ? items : new ArrayList<KeyValuePair>());
|
||||
}
|
||||
|
||||
Metadata() {
|
||||
}
|
||||
|
||||
@Override public Metadata clone() {
|
||||
return Metadata.create(fingerprint(), new ArrayList<Entry>(items()));
|
||||
return Metadata.create(fingerprint(), new ArrayList<KeyValuePair>(items()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ import java.util.ArrayList;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.jclouds.googlecomputeengine.domain.Metadata.Entry;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.json.SerializedNames;
|
||||
|
||||
|
@ -68,38 +67,6 @@ public abstract class Operation {
|
|||
}
|
||||
}
|
||||
|
||||
@AutoValue
|
||||
public abstract static class Warning {
|
||||
|
||||
// TODO: combine this with Metadata.Entry
|
||||
@AutoValue
|
||||
public abstract static class Entry {
|
||||
abstract String key();
|
||||
|
||||
abstract String value();
|
||||
|
||||
@SerializedNames({ "key", "value" })
|
||||
public static Entry create(String key, String value) {
|
||||
return new AutoValue_Operation_Warning_Entry(key, value);
|
||||
}
|
||||
|
||||
Entry(){
|
||||
}
|
||||
}
|
||||
|
||||
public abstract String code();
|
||||
@Nullable public abstract String message();
|
||||
public abstract List<Entry> data();
|
||||
|
||||
@SerializedNames({"code", "message", "data"})
|
||||
public static Warning create(String code, String message, List<Entry> data){
|
||||
return new AutoValue_Operation_Warning(code, message, data);
|
||||
}
|
||||
|
||||
Warning() {
|
||||
}
|
||||
}
|
||||
|
||||
public static enum Status {
|
||||
PENDING,
|
||||
RUNNING,
|
||||
|
|
|
@ -30,24 +30,6 @@ import com.google.auto.value.AutoValue;
|
|||
@AutoValue
|
||||
public abstract class Route {
|
||||
|
||||
@AutoValue
|
||||
public abstract static class Warning {
|
||||
public abstract String code(); // TODO: enum
|
||||
|
||||
// TODO: create common Warning resource.
|
||||
@Nullable public abstract String message();
|
||||
|
||||
public abstract List<Metadata.Entry> data();
|
||||
|
||||
@SerializedNames({ "code", "message", "data" })
|
||||
public static Warning create(String code, String message, List<Metadata.Entry> data) {
|
||||
return new AutoValue_Route_Warning(code, message, copyOf(data));
|
||||
}
|
||||
|
||||
Warning() {
|
||||
}
|
||||
}
|
||||
|
||||
public abstract String id();
|
||||
|
||||
public abstract Date creationTimestamp();
|
||||
|
@ -88,14 +70,17 @@ public abstract class Route {
|
|||
/** Potential misconfigurations are detected for this route. */
|
||||
public abstract List<Warning> warnings();
|
||||
|
||||
/** The URL to a VpnTunnel that should handle matching packets. */
|
||||
@Nullable public abstract URI nextHopVpnTunnel();
|
||||
|
||||
@SerializedNames(
|
||||
{ "id", "creationTimestamp", "selfLink", "name", "description", "network", "tags", "destRange", "priority", "nextHopInstance",
|
||||
"nextHopIp", "nextHopNetwork", "nextHopGateway", "warnings" })
|
||||
"nextHopIp", "nextHopNetwork", "nextHopGateway", "warnings", "nextHopVpnTunnel" })
|
||||
public static Route create(String id, Date creationTimestamp, URI selfLink, String name, String description, URI network, List<String> tags,
|
||||
String destRange, int priority, URI nextHopInstance, String nextHopIp, URI nextHopNetwork, URI nextHopGateway,
|
||||
List<Warning> warnings) {
|
||||
List<Warning> warnings, URI nextHopVpnTunnel) {
|
||||
return new AutoValue_Route(id, creationTimestamp, selfLink, name, description, network, copyOf(tags), destRange, priority,
|
||||
nextHopInstance, nextHopIp, nextHopNetwork, nextHopGateway, copyOf(warnings));
|
||||
nextHopInstance, nextHopIp, nextHopNetwork, nextHopGateway, copyOf(warnings), nextHopVpnTunnel);
|
||||
}
|
||||
|
||||
Route() {
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.jclouds.googlecomputeengine.domain;
|
|||
import static org.jclouds.googlecloud.internal.NullSafeCopies.copyOf;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.jclouds.googlecomputeengine.options.TargetPoolCreationOptions.SessionAffinityValue;
|
||||
|
@ -34,6 +35,8 @@ public abstract class TargetPool {
|
|||
|
||||
public abstract URI selfLink();
|
||||
|
||||
public abstract Date creationTimestamp();
|
||||
|
||||
public abstract String name();
|
||||
|
||||
@Nullable public abstract String description();
|
||||
|
@ -83,12 +86,12 @@ public abstract class TargetPool {
|
|||
*/
|
||||
@Nullable public abstract URI backupPool();
|
||||
|
||||
@SerializedNames({ "id", "selfLink", "name", "description", "region", "healthChecks", "instances", "sessionAffinity",
|
||||
@SerializedNames({ "id", "selfLink", "creationTimestamp", "name", "description", "region", "healthChecks", "instances", "sessionAffinity",
|
||||
"failoverRatio", "backupPool" })
|
||||
public static TargetPool create(String id, URI selfLink, String name, String description, URI region,
|
||||
public static TargetPool create(String id, URI selfLink, Date creationTimestamp, String name, String description, URI region,
|
||||
List<URI> healthChecks, List<URI> instances, SessionAffinityValue sessionAffinity, Float failoverRatio,
|
||||
URI backupPool) {
|
||||
return new AutoValue_TargetPool(id, selfLink, name, description, region, copyOf(healthChecks), copyOf(instances),
|
||||
return new AutoValue_TargetPool(id, selfLink, creationTimestamp, name, description, region, copyOf(healthChecks), copyOf(instances),
|
||||
sessionAffinity, failoverRatio, backupPool);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* 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 java.util.List;
|
||||
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.json.SerializedNames;
|
||||
|
||||
import com.google.auto.value.AutoValue;
|
||||
|
||||
@AutoValue
|
||||
public abstract class Warning {
|
||||
|
||||
public abstract String code();
|
||||
@Nullable public abstract String message();
|
||||
public abstract List<KeyValuePair> data();
|
||||
|
||||
@SerializedNames({"code", "message", "data"})
|
||||
public static Warning create(String code, String message, List<KeyValuePair> data){
|
||||
return new AutoValue_Warning(code, message, data);
|
||||
}
|
||||
|
||||
Warning() {
|
||||
}
|
||||
}
|
|
@ -119,7 +119,7 @@ public interface InstanceApi {
|
|||
* you, and look for the status field.
|
||||
*/
|
||||
@Named("Instances:deleteAccessConfig")
|
||||
@DELETE
|
||||
@POST
|
||||
@Path("/{instance}/deleteAccessConfig")
|
||||
Operation deleteAccessConfigFromNic(@PathParam("instance") String instance,
|
||||
@QueryParam("accessConfig") String accessConfigName,
|
||||
|
|
|
@ -34,11 +34,11 @@ public abstract class HttpHealthCheckCreationOptions {
|
|||
@Nullable public abstract String description();
|
||||
|
||||
static final String DEFAULT_REQUEST_PATH = "/";
|
||||
static final Integer DEFAULT_PORT = 80;
|
||||
static final Integer DEFAULT_CHECK_INTERVAL_SEC = 5;
|
||||
static final Integer DEFAULT_TIMEOUT_SEC = 5;
|
||||
static final Integer DEFAULT_UNHEALTHY_THRESHOLD = 2;
|
||||
static final Integer DEFAULT_HEALTHY_THRESHOLD = 2;
|
||||
static final int DEFAULT_PORT = 80;
|
||||
static final int DEFAULT_CHECK_INTERVAL_SEC = 5;
|
||||
static final int DEFAULT_TIMEOUT_SEC = 5;
|
||||
static final int DEFAULT_UNHEALTHY_THRESHOLD = 2;
|
||||
static final int DEFAULT_HEALTHY_THRESHOLD = 2;
|
||||
|
||||
/*
|
||||
* Currently GCE is not setting the advertised defaults so we do so here.
|
||||
|
|
|
@ -37,6 +37,7 @@ public class RouteOptions {
|
|||
private URI nextHopGateway;
|
||||
private String description;
|
||||
private Integer priority;
|
||||
private URI nextHopVpnTunnel;
|
||||
|
||||
private ImmutableList.Builder<String> tags = ImmutableList.builder();
|
||||
|
||||
|
@ -115,6 +116,14 @@ public class RouteOptions {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.jclouds.googlecomputeengine.domain.Route#getNextHopVpnTunnel()
|
||||
*/
|
||||
public RouteOptions nextHopVpnTunnel(URI nextHopVpnTunnel){
|
||||
this.nextHopVpnTunnel = nextHopVpnTunnel;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.jclouds.googlecomputeengine.domain.Route#getNetwork()
|
||||
*/
|
||||
|
@ -175,6 +184,13 @@ public class RouteOptions {
|
|||
return nextHopGateway;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.jclouds.googlecomputeengine.domain.Route#getNextHopVpnTunnel()
|
||||
*/
|
||||
public URI getNextHopVpnTunnel() {
|
||||
return nextHopVpnTunnel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.jclouds.googlecomputeengine.domain.Route#getTags()
|
||||
*/
|
||||
|
|
|
@ -98,6 +98,16 @@ public class ForwardingRuleApiMockTest extends BaseGoogleComputeEngineApiMockTes
|
|||
stringFromResource("/forwardingrule_set_target.json"));
|
||||
}
|
||||
|
||||
public void setTarget_partialUrl() throws Exception {
|
||||
server.enqueue(jsonResponse("/region_operation.json"));
|
||||
|
||||
URI newTarget = URI.create("projects/project-id/regions/region/targetPools/target-pool");
|
||||
assertEquals(forwardingRuleApi().setTarget("testForwardingRule", newTarget), new ParseRegionOperationTest().expected(url("/projects")));
|
||||
|
||||
assertSent(server, "POST", "/projects/party/regions/us-central1/forwardingRules/testForwardingRule/setTarget",
|
||||
"{\"target\":\"projects/project-id/regions/region/targetPools/target-pool\"}");
|
||||
}
|
||||
|
||||
ForwardingRuleApi forwardingRuleApi() {
|
||||
return api().forwardingRulesInRegion("us-central1");
|
||||
}
|
||||
|
|
|
@ -32,8 +32,10 @@ import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
|
|||
import org.jclouds.googlecomputeengine.domain.Image;
|
||||
import org.jclouds.googlecomputeengine.domain.Instance;
|
||||
import org.jclouds.googlecomputeengine.domain.Instance.AttachedDisk;
|
||||
import org.jclouds.googlecomputeengine.domain.Instance.NetworkInterface.AccessConfig.Type;
|
||||
import org.jclouds.googlecomputeengine.domain.Instance.Scheduling;
|
||||
import org.jclouds.googlecomputeengine.domain.Instance.SerialPortOutput;
|
||||
import org.jclouds.googlecomputeengine.domain.Instance.NetworkInterface.AccessConfig;
|
||||
import org.jclouds.googlecomputeengine.domain.Metadata;
|
||||
import org.jclouds.googlecomputeengine.domain.NewInstance;
|
||||
import org.jclouds.googlecomputeengine.domain.AttachDisk;
|
||||
|
@ -122,6 +124,24 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
|
|||
assertInstanceEquals(instance, this.instance);
|
||||
}
|
||||
|
||||
@Test(groups = "live", dependsOnMethods = "testInsertInstance")
|
||||
public void testAddAccessConfig() {
|
||||
AccessConfig config = AccessConfig.create("test-config", Type.ONE_TO_ONE_NAT, null);
|
||||
assertOperationDoneSuccessfully(api().addAccessConfigToNic(INSTANCE_NAME, config, "nic0"));
|
||||
Instance instance = api().get(INSTANCE_NAME);
|
||||
assertNotNull(instance);
|
||||
assertEquals(instance.networkInterfaces().get(0).accessConfigs().get(0).name(), "test-config");
|
||||
}
|
||||
|
||||
@Test(groups = "live", dependsOnMethods = "testAddAccessConfig")
|
||||
public void testDeleteAccessConfig() {
|
||||
Instance instance = api().get(INSTANCE_NAME);
|
||||
assertOperationDoneSuccessfully(api().deleteAccessConfigFromNic(INSTANCE_NAME, "test-config", "nic0"));
|
||||
instance = api().get(INSTANCE_NAME);
|
||||
assertNotNull(instance);
|
||||
assertTrue(instance.networkInterfaces().get(0).accessConfigs().isEmpty());
|
||||
}
|
||||
|
||||
@Test(groups = "live", dependsOnMethods = "testInsertInstance")
|
||||
public void testGetSerialPortOutput() {
|
||||
SerialPortOutput output = api().getSerialPortOutput(INSTANCE_NAME);
|
||||
|
@ -258,7 +278,8 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
|
|||
assertOperationDoneSuccessfully(api().reset(INSTANCE_NAME));
|
||||
}
|
||||
|
||||
@Test(groups = "live", dependsOnMethods = {"testSetDiskAutoDelete", "testResetInstance", "testSetScheduling", "testGetInstance", "testGetSerialPortOutput"}, alwaysRun = true)
|
||||
@Test(groups = "live", dependsOnMethods = {"testSetDiskAutoDelete", "testResetInstance", "testSetScheduling",
|
||||
"testGetInstance", "testGetSerialPortOutput", "testDeleteAccessConfig"}, alwaysRun = true)
|
||||
public void testDeleteInstance() {
|
||||
assertOperationDoneSuccessfully(api().delete(INSTANCE_NAME));
|
||||
assertOperationDoneSuccessfully(diskApi().delete(DISK_NAME));
|
||||
|
|
|
@ -119,7 +119,7 @@ public class InstanceApiMockTest extends BaseGoogleComputeEngineApiMockTest {
|
|||
assertEquals(instanceApi().deleteAccessConfigFromNic("test-instance", "test-access", "test-network"),
|
||||
new ParseZoneOperationTest().expected(url("/projects")));
|
||||
|
||||
assertSent(server, "DELETE", "/projects/party/zones/us-central1-a/instances/test-instance/"
|
||||
assertSent(server, "POST", "/projects/party/zones/us-central1-a/instances/test-instance/"
|
||||
+ "deleteAccessConfig?accessConfig=test-access&networkInterface=test-network");
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ public class ParseHttpHealthCheckListTest extends BaseGoogleComputeEngineParseTe
|
|||
"1035854271083519643", // id
|
||||
URI.create(baseUrl + "/party-gce/global/httpHealthChecks/myname-andrea-kmzmi1bh-http-health-check"),
|
||||
// selfLink
|
||||
parse("2014-01-08T14:38:29.363-08:00"),
|
||||
"myname-andrea-kmzmi1bh-http-health-check", // name
|
||||
null, // description
|
||||
null, // host
|
||||
|
@ -64,6 +65,7 @@ public class ParseHttpHealthCheckListTest extends BaseGoogleComputeEngineParseTe
|
|||
"7006563292274658743", // id
|
||||
URI.create(baseUrl + "/party-gce/global/httpHealthChecks/myname-andrea-zk7gadwq-http-health-check"),
|
||||
// selfLink
|
||||
parse("2014-01-08T14:48:03.276-08:00"), // creationTimestamp
|
||||
"myname-andrea-zk7gadwq-http-health-check", // name
|
||||
null, // description
|
||||
null, // host
|
||||
|
|
|
@ -44,15 +44,16 @@ public class ParseHttpHealthCheckTest extends BaseGoogleComputeEngineParseTest<H
|
|||
return HttpHealthCheck.create( //
|
||||
"2761502483700014319", // id
|
||||
URI.create(baseUrl + "/party-gce/global/httpHealthChecks/http-health-check-api-live-test"), // selfLink
|
||||
parse("2014-01-14T05:55:54.910-08:00"), // creationTimestamp
|
||||
"http-health-check-api-live-test", // name
|
||||
null, // description
|
||||
"Test Health Check", // description
|
||||
null, // host
|
||||
null, // requestPath
|
||||
null, // port
|
||||
null, // checkIntervalSec
|
||||
null, // timeoutSec
|
||||
null, // unhealthyThreshold
|
||||
null // healthyThreshold
|
||||
"/", // requestPath
|
||||
80, // port
|
||||
5, // checkIntervalSec
|
||||
5, // timeoutSec
|
||||
2, // unhealthyThreshold
|
||||
2 // healthyThreshold
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,8 +22,9 @@ import java.net.URI;
|
|||
|
||||
import javax.ws.rs.Consumes;
|
||||
|
||||
import org.jclouds.googlecomputeengine.domain.KeyValuePair;
|
||||
import org.jclouds.googlecomputeengine.domain.Operation;
|
||||
import org.jclouds.googlecomputeengine.domain.Operation.Warning;
|
||||
import org.jclouds.googlecomputeengine.domain.Warning;
|
||||
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
@ -68,9 +69,8 @@ public class ParseOperationTest extends BaseGoogleComputeEngineParseTest<Operati
|
|||
"Invalid value for field 'resource.urlMaps': "
|
||||
+ "'projects/party/global/urlMaps/target-http-proxy-api-live-test-url-map-2'."
|
||||
+ " Resource was not found."))), // errors
|
||||
ImmutableList.of(Warning
|
||||
.create("NO_RESULTS_ON_PAGE", "This is an example warning",
|
||||
ImmutableList.of(Warning.Entry
|
||||
ImmutableList.of(Warning.create("NO_RESULTS_ON_PAGE", "This is an example warning",
|
||||
ImmutableList.of(KeyValuePair
|
||||
.create("scope", "There are no results for scope 'zones/asia-east1-b' on this page.")))), // warnings
|
||||
URI.create(baseUrl + "/party/regions/us-central1"), // region
|
||||
URI.create(baseUrl + "/party/zones/us-central1-a") // zone
|
||||
|
|
|
@ -59,7 +59,8 @@ public class ParseRouteListTest extends BaseGoogleComputeEngineParseTest<ListPag
|
|||
null, // nextHopIp
|
||||
null, // nextHopNetwork
|
||||
URI.create(baseUrl + "/party/global/gateways/default-internet-gateway"), // nextHopGateway
|
||||
null // warnings
|
||||
null, // warnings
|
||||
null // nextHopVpnTunnel
|
||||
);
|
||||
return ForwardingListPage.create( //
|
||||
ImmutableList.of(route1, route2), // items
|
||||
|
|
|
@ -22,9 +22,9 @@ import java.net.URI;
|
|||
|
||||
import javax.ws.rs.Consumes;
|
||||
|
||||
import org.jclouds.googlecomputeengine.domain.Metadata;
|
||||
import org.jclouds.googlecomputeengine.domain.KeyValuePair;
|
||||
import org.jclouds.googlecomputeengine.domain.Route;
|
||||
import org.jclouds.googlecomputeengine.domain.Route.Warning;
|
||||
import org.jclouds.googlecomputeengine.domain.Warning;
|
||||
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
@ -60,7 +60,8 @@ public class ParseRouteTest extends BaseGoogleComputeEngineParseTest<Route> {
|
|||
URI.create(baseUrl + "/party/global/networks/default"), // nextHopNetwork
|
||||
null, // nextHopGateway
|
||||
ImmutableList.of(Warning.create("NO_RESULTS_ON_PAGE", "This is an example warning", ImmutableList.of(
|
||||
Metadata.Entry.create("scope", "There are no results for scope 'zones/asia-east1-b' on this page.")))) // warnings
|
||||
KeyValuePair.create("scope", "There are no results for scope 'zones/asia-east1-b' on this page.")))), // warnings
|
||||
null // nextHopVpnTunnel
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ public class ParseTargetPoolTest extends BaseGoogleComputeEngineParseTest<Target
|
|||
return TargetPool.create( //
|
||||
"5199309593612841404", // id
|
||||
URI.create(baseUrl + "/party/regions/us-central1/targetPools/test-targetpool"), // selfLink
|
||||
parse("2014-01-07T05:25:27.783-08:00"), // creationTimestamp
|
||||
"test-targetpool", // name
|
||||
null, // description
|
||||
URI.create(baseUrl + "/party/regions/us-central1"), // region
|
||||
|
|
|
@ -1,7 +1,14 @@
|
|||
{
|
||||
"kind": "compute#httpHealthCheck",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/party-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/party-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",
|
||||
"description": "Test Health Check",
|
||||
"requestPath": "/",
|
||||
"port": 80,
|
||||
"checkIntervalSec": 5,
|
||||
"timeoutSec": 5,
|
||||
"unhealthyThreshold": 2,
|
||||
"healthyThreshold": 2
|
||||
}
|
|
@ -1,32 +1,39 @@
|
|||
{
|
||||
"kind": "compute#httpHealthCheckList",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/party-gce/global/httpHealthChecks",
|
||||
"id": "projects/party-gce/global/httpHealthChecks",
|
||||
"items": [
|
||||
{
|
||||
"kind": "compute#httpHealthCheck",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/party-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/party-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/party-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
|
||||
}
|
||||
]
|
||||
"kind": "compute#httpHealthCheckList",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/party-gce/global/httpHealthChecks",
|
||||
"id": "projects/party-gce/global/httpHealthChecks",
|
||||
"items": [
|
||||
{
|
||||
"kind": "compute#httpHealthCheck",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/party-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",
|
||||
"description": "Test Health Check",
|
||||
"requestPath": "/",
|
||||
"port": 80,
|
||||
"checkIntervalSec": 5,
|
||||
"timeoutSec": 5,
|
||||
"unhealthyThreshold": 2,
|
||||
"healthyThreshold": 2
|
||||
},
|
||||
{
|
||||
"kind": "compute#httpHealthCheck",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/party-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/party-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
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue