From 96f98c4fc49c89ce45a3e16b2d20e7ae8b7289ee Mon Sep 17 00:00:00 2001 From: Everett Toews Date: Sat, 26 Jan 2013 14:11:03 -0600 Subject: [PATCH] The Report API for Rackspace Cloud Load Balancers. --- .../CloudLoadBalancersApi.java | 10 +- .../CloudLoadBalancersAsyncApi.java | 8 + .../CloudLoadBalancersRestClientModule.java | 3 + .../domain/AccountUsage.java | 94 +++ .../domain/HistoricalUsage.java | 78 ++ .../domain/LoadBalancerInfo.java | 75 ++ .../domain/LoadBalancerStats.java | 96 +++ .../domain/LoadBalancerUsage.java | 157 ++++ .../cloudloadbalancers/domain/Protocol.java | 68 ++ .../features/ReportApi.java | 82 ++ .../features/ReportAsyncApi.java | 183 +++++ .../features/SSLTerminationApi.java | 2 +- .../functions/DateParser.java | 48 ++ .../functions/ParseAlgorithms.java | 71 ++ .../functions/ParseLoadBalancerUsages.java | 94 +++ .../features/ReportApiExpectTest.java | 186 +++++ .../features/ReportApiLiveTest.java | 110 +++ .../resources/report-algorithms-list.json | 19 + .../test/resources/report-billable-list.json | 64 ++ .../test/resources/report-historical-get.json | 750 ++++++++++++++++++ .../report-loadbalancerstats-get.json | 8 + .../report-loadbalancerusage-list.json | 380 +++++++++ .../test/resources/report-protocols-list.json | 84 ++ 23 files changed, 2668 insertions(+), 2 deletions(-) create mode 100644 apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/domain/AccountUsage.java create mode 100644 apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/domain/HistoricalUsage.java create mode 100644 apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/domain/LoadBalancerInfo.java create mode 100644 apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/domain/LoadBalancerStats.java create mode 100644 apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/domain/LoadBalancerUsage.java create mode 100644 apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/domain/Protocol.java create mode 100644 apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/features/ReportApi.java create mode 100644 apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/features/ReportAsyncApi.java create mode 100644 apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/functions/DateParser.java create mode 100644 apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/functions/ParseAlgorithms.java create mode 100644 apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/functions/ParseLoadBalancerUsages.java create mode 100644 apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/features/ReportApiExpectTest.java create mode 100644 apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/features/ReportApiLiveTest.java create mode 100644 apis/rackspace-cloudloadbalancers/src/test/resources/report-algorithms-list.json create mode 100644 apis/rackspace-cloudloadbalancers/src/test/resources/report-billable-list.json create mode 100644 apis/rackspace-cloudloadbalancers/src/test/resources/report-historical-get.json create mode 100644 apis/rackspace-cloudloadbalancers/src/test/resources/report-loadbalancerstats-get.json create mode 100644 apis/rackspace-cloudloadbalancers/src/test/resources/report-loadbalancerusage-list.json create mode 100644 apis/rackspace-cloudloadbalancers/src/test/resources/report-protocols-list.json diff --git a/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/CloudLoadBalancersApi.java b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/CloudLoadBalancersApi.java index cd43c862a6..ba36b209cf 100644 --- a/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/CloudLoadBalancersApi.java +++ b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/CloudLoadBalancersApi.java @@ -32,6 +32,7 @@ import org.jclouds.rackspace.cloudloadbalancers.features.ErrorPageApi; import org.jclouds.rackspace.cloudloadbalancers.features.HealthMonitorApi; import org.jclouds.rackspace.cloudloadbalancers.features.LoadBalancerApi; import org.jclouds.rackspace.cloudloadbalancers.features.NodeApi; +import org.jclouds.rackspace.cloudloadbalancers.features.ReportApi; import org.jclouds.rackspace.cloudloadbalancers.features.SSLTerminationApi; import org.jclouds.rackspace.cloudloadbalancers.features.SessionPersistenceApi; import org.jclouds.rackspace.cloudloadbalancers.features.VirtualIPApi; @@ -56,7 +57,7 @@ public interface CloudLoadBalancersApi { Set getConfiguredZones(); /** - * Provides synchronous access to LoadBalancer features. + * Provides synchronous access to Load Balancer features. */ @Delegate LoadBalancerApi getLoadBalancerApiForZone( @@ -133,4 +134,11 @@ public interface CloudLoadBalancersApi { @Path("/loadbalancers/{lbId}") ErrorPageApi getErrorPageApiForZoneAndLoadBalancer( @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone, @PathParam("lbId") int lbId); + + /** + * Provides synchronous access to Report features. + */ + @Delegate + ReportApi getReportApiForZone( + @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone); } diff --git a/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/CloudLoadBalancersAsyncApi.java b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/CloudLoadBalancersAsyncApi.java index 82a488923c..46a9f58940 100644 --- a/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/CloudLoadBalancersAsyncApi.java +++ b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/CloudLoadBalancersAsyncApi.java @@ -33,6 +33,7 @@ import org.jclouds.rackspace.cloudloadbalancers.features.ErrorPageAsyncApi; import org.jclouds.rackspace.cloudloadbalancers.features.HealthMonitorAsyncApi; import org.jclouds.rackspace.cloudloadbalancers.features.LoadBalancerAsyncApi; import org.jclouds.rackspace.cloudloadbalancers.features.NodeAsyncApi; +import org.jclouds.rackspace.cloudloadbalancers.features.ReportAsyncApi; import org.jclouds.rackspace.cloudloadbalancers.features.SSLTerminationAsyncApi; import org.jclouds.rackspace.cloudloadbalancers.features.SessionPersistenceAsyncApi; import org.jclouds.rackspace.cloudloadbalancers.features.VirtualIPAsyncApi; @@ -134,4 +135,11 @@ public interface CloudLoadBalancersAsyncApi { @Path("/loadbalancers/{lbId}") ErrorPageAsyncApi getErrorPageApiForZoneAndLoadBalancer( @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone, @PathParam("lbId") int lbId); + + /** + * Provides asynchronous access to Report features. + */ + @Delegate + ReportAsyncApi getReportApiForZone( + @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone); } diff --git a/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/config/CloudLoadBalancersRestClientModule.java b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/config/CloudLoadBalancersRestClientModule.java index d9be64f71b..946f822689 100644 --- a/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/config/CloudLoadBalancersRestClientModule.java +++ b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/config/CloudLoadBalancersRestClientModule.java @@ -42,6 +42,8 @@ import org.jclouds.rackspace.cloudloadbalancers.features.LoadBalancerAsyncApi; import org.jclouds.rackspace.cloudloadbalancers.features.LoadBalancerApi; import org.jclouds.rackspace.cloudloadbalancers.features.NodeAsyncApi; import org.jclouds.rackspace.cloudloadbalancers.features.NodeApi; +import org.jclouds.rackspace.cloudloadbalancers.features.ReportApi; +import org.jclouds.rackspace.cloudloadbalancers.features.ReportAsyncApi; import org.jclouds.rackspace.cloudloadbalancers.features.SSLTerminationApi; import org.jclouds.rackspace.cloudloadbalancers.features.SSLTerminationAsyncApi; import org.jclouds.rackspace.cloudloadbalancers.features.SessionPersistenceApi; @@ -76,6 +78,7 @@ public class CloudLoadBalancersRestClientModule extends .put(ContentCachingApi.class, ContentCachingAsyncApi.class) .put(SSLTerminationApi.class, SSLTerminationAsyncApi.class) .put(ErrorPageApi.class, ErrorPageAsyncApi.class) + .put(ReportApi.class, ReportAsyncApi.class) .build(); public CloudLoadBalancersRestClientModule() { diff --git a/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/domain/AccountUsage.java b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/domain/AccountUsage.java new file mode 100644 index 0000000000..c3c3e9c754 --- /dev/null +++ b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/domain/AccountUsage.java @@ -0,0 +1,94 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.rackspace.cloudloadbalancers.domain; + +import static com.google.common.base.Preconditions.checkNotNull; + +import java.beans.ConstructorProperties; +import java.util.Date; + +import com.google.common.base.Objects; +import com.google.common.base.Optional; + +/** + * @author Everett Toews + */ +public final class AccountUsage { + private int numPublicVIPs; + private int numServiceNetVIPs; + private int numLoadBalancers; + private Date startTime; + private Optional endTime; + + @ConstructorProperties({ "numPublicVips", "numServicenetVips", "numLoadBalancers", "startTime", "endTime" }) + protected AccountUsage(int numPublicVIPs, int numServiceNetVIPs, int numLoadBalancers, Date startTime, Date endTime) { + this.numPublicVIPs = numPublicVIPs; + this.numServiceNetVIPs = numServiceNetVIPs; + this.numLoadBalancers = numLoadBalancers; + this.startTime = checkNotNull(startTime, "startTime"); + this.endTime = Optional.fromNullable(endTime); + } + + public int getNumPublicVIPs() { + return numPublicVIPs; + } + + public int getNumServiceNetVIPs() { + return numServiceNetVIPs; + } + + public int getNumLoadBalancers() { + return numLoadBalancers; + } + + public Date getStartTime() { + return startTime; + } + + public Optional getEndTime() { + return endTime; + } + + @Override + public int hashCode() { + return Objects.hashCode(numPublicVIPs, numServiceNetVIPs, numLoadBalancers, startTime, endTime); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null || getClass() != obj.getClass()) + return false; + AccountUsage that = AccountUsage.class.cast(obj); + + return Objects.equal(this.numPublicVIPs, that.numPublicVIPs) + && Objects.equal(this.numServiceNetVIPs, that.numServiceNetVIPs) + && Objects.equal(this.numLoadBalancers, that.numLoadBalancers) + && Objects.equal(this.startTime, that.startTime) + && Objects.equal(this.endTime, that.endTime); + } + + @Override + public String toString() { + return Objects.toStringHelper(this).omitNullValues().add("numPublicVIPs", numPublicVIPs) + .add("numServiceNetVIPs", numServiceNetVIPs).add("numLoadBalancers", numLoadBalancers) + .add("startTime", startTime).add("endTime", endTime.orNull()).toString(); + } +} diff --git a/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/domain/HistoricalUsage.java b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/domain/HistoricalUsage.java new file mode 100644 index 0000000000..ed3344ee74 --- /dev/null +++ b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/domain/HistoricalUsage.java @@ -0,0 +1,78 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.rackspace.cloudloadbalancers.domain; + +import static com.google.common.base.Preconditions.checkNotNull; + +import java.beans.ConstructorProperties; +import java.util.Map; + +import com.google.common.base.Objects; +import com.google.common.collect.Iterables; + +/** + * @author Everett Toews + */ +public final class HistoricalUsage { + private int accountId; + private Map> accountUsage; + private Iterable loadBalancerUsages; + + @ConstructorProperties({ "accountId", "accountUsage", "loadBalancerUsages" }) + protected HistoricalUsage(int accountId, Map> accountUsage, + Iterable loadBalancerUsages) { + this.accountId = accountId; + this.accountUsage = checkNotNull(accountUsage, "accountUsage"); + this.loadBalancerUsages = checkNotNull(loadBalancerUsages, "loadBalancerUsages"); + } + + public int getAccountId() { + return accountId; + } + + public Iterable getAccountUsage() { + return Iterables.get(accountUsage.values(), 0); + } + + public Iterable getLoadBalancerInfo() { + return loadBalancerUsages; + } + + @Override + public int hashCode() { + return Objects.hashCode(accountId); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null || getClass() != obj.getClass()) + return false; + HistoricalUsage that = HistoricalUsage.class.cast(obj); + + return Objects.equal(this.accountId, that.accountId); + } + + @Override + public String toString() { + return Objects.toStringHelper(this).omitNullValues().add("accountId", accountId) + .add("accountUsage", getAccountUsage()).add("loadBalancerInfo", loadBalancerUsages).toString(); + } +} diff --git a/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/domain/LoadBalancerInfo.java b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/domain/LoadBalancerInfo.java new file mode 100644 index 0000000000..785d9ca0a6 --- /dev/null +++ b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/domain/LoadBalancerInfo.java @@ -0,0 +1,75 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.rackspace.cloudloadbalancers.domain; + +import static com.google.common.base.Preconditions.checkNotNull; + +import java.beans.ConstructorProperties; + +import com.google.common.base.Objects; + +/** + * @author Everett Toews + */ +public final class LoadBalancerInfo { + private int loadBalancerId; + private String loadBalancerName; + private Iterable loadBalancerUsageRecords; + + @ConstructorProperties({ "loadBalancerId", "loadBalancerName", "loadBalancerUsageRecords" }) + protected LoadBalancerInfo(int port, String name, Iterable loadBalancerUsageRecords) { + this.loadBalancerId = port; + this.loadBalancerName = checkNotNull(name, "name"); + this.loadBalancerUsageRecords = checkNotNull(loadBalancerUsageRecords, "loadBalancerUsageRecords"); + } + + public int getLoadBalancerId() { + return loadBalancerId; + } + + public String getLoadBalancerName() { + return loadBalancerName; + } + + public Iterable getLoadBalancerUsage() { + return loadBalancerUsageRecords; + } + + @Override + public int hashCode() { + return Objects.hashCode(loadBalancerId); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null || getClass() != obj.getClass()) + return false; + LoadBalancerInfo that = LoadBalancerInfo.class.cast(obj); + + return Objects.equal(this.loadBalancerId, that.loadBalancerId); + } + + @Override + public String toString() { + return Objects.toStringHelper(this).omitNullValues().add("loadBalancerId", loadBalancerId) + .add("loadBalancerName", loadBalancerName).add("loadBalancerUsage", loadBalancerUsageRecords).toString(); + } +} diff --git a/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/domain/LoadBalancerStats.java b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/domain/LoadBalancerStats.java new file mode 100644 index 0000000000..d51d4bd445 --- /dev/null +++ b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/domain/LoadBalancerStats.java @@ -0,0 +1,96 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.rackspace.cloudloadbalancers.domain; + +import java.beans.ConstructorProperties; + +import com.google.common.base.Objects; + +/** + * @author Everett Toews + */ +public final class LoadBalancerStats { + private int connectTimeOut; + private int connectError; + private int connectFailure; + private int dataTimedOut; + private int keepAliveTimedOut; + private int maxConn; + + @ConstructorProperties({ "connectTimeOut", "connectError", "connectFailure", "dataTimedOut", "keepAliveTimedOut", + "maxConn" }) + protected LoadBalancerStats(int connectTimeOut, int connectError, int connectFailure, int dataTimedOut, + int keepAliveTimedOut, int maxConn) { + this.connectTimeOut = connectTimeOut; + this.connectError = connectError; + this.connectFailure = connectFailure; + this.dataTimedOut = dataTimedOut; + this.keepAliveTimedOut = keepAliveTimedOut; + this.maxConn = maxConn; + } + + /** + * Connections closed by this load balancer because the 'connect_timeout' interval was exceeded. + */ + public int getConnectTimeOut() { + return connectTimeOut; + } + + /** + * Number of transaction or protocol errors in this load balancer. + */ + public int getConnectError() { + return connectError; + } + + /** + * Number of connection failures in this load balancer. + */ + public int getConnectFailure() { + return connectFailure; + } + + /** + * Connections closed by this load balancer because the 'timeout' interval was exceeded. + */ + public int getDataTimedOut() { + return dataTimedOut; + } + + /** + * Connections closed by this load balancer because the 'keepalive_timeout' interval was exceeded. + */ + public int getKeepAliveTimedOut() { + return keepAliveTimedOut; + } + + /** + * Maximum number of simultaneous TCP connections this load balancer has processed at any one time. + */ + public int getMaxConn() { + return maxConn; + } + + @Override + public String toString() { + return Objects.toStringHelper(this).omitNullValues().add("connectTimeOut", connectTimeOut) + .add("connectError", connectError).add("connectFailure", connectFailure).add("dataTimedOut", dataTimedOut) + .add("keepAliveTimedOut", keepAliveTimedOut).add("maxConn", maxConn).toString(); + } +} diff --git a/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/domain/LoadBalancerUsage.java b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/domain/LoadBalancerUsage.java new file mode 100644 index 0000000000..91b1229fe8 --- /dev/null +++ b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/domain/LoadBalancerUsage.java @@ -0,0 +1,157 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.rackspace.cloudloadbalancers.domain; + +import static com.google.common.base.Preconditions.checkNotNull; + +import java.beans.ConstructorProperties; +import java.util.Date; + +import org.jclouds.rackspace.cloudloadbalancers.domain.VirtualIP.Type; + +import com.google.common.base.Objects; +import com.google.common.base.Optional; + +/** + * @author Everett Toews + */ +public final class LoadBalancerUsage { + private int id; + private float averageNumConnections; + private float averageNumConnectionsSsl; + private int incomingTransferInBytes; + private int outgoingTransferInBytes; + private int incomingTransferSslInBytes; + private int outgoingTransferSslInBytes; + private int numVIPs; + private int numPolls; + private Date startTime; + private Date endTime; + private VirtualIP.Type vipType; + private String sslMode; + private Optional eventType; + + @ConstructorProperties({ "id", "averageNumConnections", "averageNumConnectionsSsl", "incomingTransfer", + "outgoingTransfer", "incomingTransferSsl", "outgoingTransferSsl", "numVips", "numPolls", "startTime", + "endTime", "vipType", "sslMode", "eventType" }) + protected LoadBalancerUsage(int id, float averageNumConnections, float averageNumConnectionsSsl, + int incomingTransferInBytes, int outgoingTransferInBytes, int incomingTransferSslInBytes, + int outgoingTransferSslInBytes, int numVIPs, int numPolls, Date startTime, Date endTime, Type vipType, + String sslMode, String eventType) { + this.id = id; + this.averageNumConnections = averageNumConnections; + this.averageNumConnectionsSsl = averageNumConnectionsSsl; + this.incomingTransferInBytes = incomingTransferInBytes; + this.outgoingTransferInBytes = outgoingTransferInBytes; + this.incomingTransferSslInBytes = incomingTransferSslInBytes; + this.outgoingTransferSslInBytes = outgoingTransferSslInBytes; + this.numVIPs = numVIPs; + this.numPolls = numPolls; + this.startTime = checkNotNull(startTime, "startTime"); + this.endTime = checkNotNull(endTime, "endTime"); + this.vipType = checkNotNull(vipType, "vipType"); + this.sslMode = checkNotNull(sslMode, "sslMode"); + this.eventType = Optional.fromNullable(eventType); + } + + public int getId() { + return id; + } + + public float getAverageNumConnections() { + return averageNumConnections; + } + + public float getAverageNumConnectionsSsl() { + return averageNumConnectionsSsl; + } + + public int getIncomingTransferInBytes() { + return incomingTransferInBytes; + } + + public int getOutgoingTransferInBytes() { + return outgoingTransferInBytes; + } + + public int getIncomingTransferSslInBytes() { + return incomingTransferSslInBytes; + } + + public int getOutgoingTransferSslInBytes() { + return outgoingTransferSslInBytes; + } + + public int getNumVIPs() { + return numVIPs; + } + + public int getNumPolls() { + return numPolls; + } + + public Date getStartTime() { + return startTime; + } + + public Date getEndTime() { + return endTime; + } + + public VirtualIP.Type getVIPType() { + return vipType; + } + + public String getSSLMode() { + return sslMode; + } + + public Optional getEventType() { + return eventType; + } + + @Override + public int hashCode() { + return Objects.hashCode(id); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null || getClass() != obj.getClass()) + return false; + LoadBalancerUsage that = LoadBalancerUsage.class.cast(obj); + + return Objects.equal(this.id, that.id); + } + + @Override + public String toString() { + return Objects.toStringHelper(this).omitNullValues() + .add("averageNumConnections", averageNumConnections) + .add("averageNumConnectionsSsl", averageNumConnectionsSsl) + .add("incomingTransferInBytes", incomingTransferInBytes) + .add("outgoingTransferInBytes", outgoingTransferInBytes) + .add("incomingTransferSslInBytes", incomingTransferSslInBytes) + .add("outgoingTransferSslInBytes", outgoingTransferSslInBytes).add("numVIPs", numVIPs) + .add("numPolls", numPolls).add("startTime", startTime).add("endTime", endTime).add("vipType", vipType) + .add("sslMode", sslMode).add("eventType", eventType.orNull()).toString(); + } +} diff --git a/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/domain/Protocol.java b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/domain/Protocol.java new file mode 100644 index 0000000000..38667ac411 --- /dev/null +++ b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/domain/Protocol.java @@ -0,0 +1,68 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.rackspace.cloudloadbalancers.domain; + +import static com.google.common.base.Preconditions.checkNotNull; + +import java.beans.ConstructorProperties; + +import com.google.common.base.Objects; + +/** + * @author Everett Toews + */ +public final class Protocol { + private String name; + private int port; + + @ConstructorProperties({ "name", "port" }) + protected Protocol(String name, int port) { + this.name = checkNotNull(name, "name"); + this.port = checkNotNull(port, "port"); + } + + public String getName() { + return name; + } + + public int getPort() { + return port; + } + + @Override + public int hashCode() { + return Objects.hashCode(name, port); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null || getClass() != obj.getClass()) + return false; + Protocol that = Protocol.class.cast(obj); + + return Objects.equal(this.name, that.name) && Objects.equal(this.port, that.port); + } + + @Override + public String toString() { + return Objects.toStringHelper(this).omitNullValues().add("name", name).add("port", port).toString(); + } +} diff --git a/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/features/ReportApi.java b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/features/ReportApi.java new file mode 100644 index 0000000000..8620598d13 --- /dev/null +++ b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/features/ReportApi.java @@ -0,0 +1,82 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.rackspace.cloudloadbalancers.features; + +import java.util.Date; + +import org.jclouds.collect.IterableWithMarker; +import org.jclouds.collect.PagedIterable; +import org.jclouds.openstack.v2_0.options.PaginationOptions; +import org.jclouds.rackspace.cloudloadbalancers.domain.HistoricalUsage; +import org.jclouds.rackspace.cloudloadbalancers.domain.LoadBalancer; +import org.jclouds.rackspace.cloudloadbalancers.domain.LoadBalancerStats; +import org.jclouds.rackspace.cloudloadbalancers.domain.LoadBalancerUsage; +import org.jclouds.rackspace.cloudloadbalancers.domain.Protocol; + +/** + * + *

+ * @see ReportAsyncApi + * @author Everett Toews + */ +public interface ReportApi { + /** + * List billable load balancers for the given date range. + */ + PagedIterable listBillableLoadBalancers(Date startTime, Date endTime); + + IterableWithMarker listBillableLoadBalancers(PaginationOptions options); + + /** + * View of all transfer activity, average number of connections, and number of virtual IPs associated with the load + * balancing service. Historical usage data is available for up to 90 days of service activity. + */ + HistoricalUsage getHistoricalUsage(Date startTime, Date endTime); + + /** + * Historical usage data is available for up to 90 days of service activity. + */ + PagedIterable listLoadBalancerUsage(int loadBalancerId, Date startTime, Date endTime); + + IterableWithMarker listLoadBalancerUsage(PaginationOptions options); + + /** + * Current usage represents all usage recorded within the preceding 24 hours. + */ + PagedIterable listCurrentLoadBalancerUsage(int loadBalancerId); + + IterableWithMarker listCurrentLoadBalancerUsage(PaginationOptions options); + + /** + * Current usage represents all usage recorded within the preceding 24 hours. + */ + LoadBalancerStats getLoadBalancerStats(int loadBalancerId); + + /** + * All load balancers must define the protocol of the service which is being load balanced. The protocol selection + * should be based on the protocol of the back-end nodes. When configuring a load balancer, the default port for + * the given protocol will be selected from this list unless otherwise specified. + */ + Iterable listProtocols(); + + /** + * Get all of the possible algorthims usable by load balancers. + */ + Iterable listAlgorithms(); +} \ No newline at end of file diff --git a/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/features/ReportAsyncApi.java b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/features/ReportAsyncApi.java new file mode 100644 index 0000000000..d823465cf4 --- /dev/null +++ b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/features/ReportAsyncApi.java @@ -0,0 +1,183 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.rackspace.cloudloadbalancers.features; + +import java.util.Date; + +import javax.inject.Named; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +import org.jclouds.Fallbacks.NullOnNotFoundOr404; +import org.jclouds.collect.IterableWithMarker; +import org.jclouds.collect.PagedIterable; +import org.jclouds.openstack.keystone.v2_0.KeystoneFallbacks.EmptyPaginatedCollectionOnNotFoundOr404; +import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest; +import org.jclouds.openstack.v2_0.options.PaginationOptions; +import org.jclouds.rackspace.cloudloadbalancers.domain.HistoricalUsage; +import org.jclouds.rackspace.cloudloadbalancers.domain.LoadBalancer; +import org.jclouds.rackspace.cloudloadbalancers.domain.LoadBalancerStats; +import org.jclouds.rackspace.cloudloadbalancers.domain.LoadBalancerUsage; +import org.jclouds.rackspace.cloudloadbalancers.domain.Protocol; +import org.jclouds.rackspace.cloudloadbalancers.functions.DateParser; +import org.jclouds.rackspace.cloudloadbalancers.functions.ParseAlgorithms; +import org.jclouds.rackspace.cloudloadbalancers.functions.ParseLoadBalancerUsages; +import org.jclouds.rackspace.cloudloadbalancers.functions.ParseLoadBalancers; +import org.jclouds.rest.annotations.Fallback; +import org.jclouds.rest.annotations.ParamParser; +import org.jclouds.rest.annotations.RequestFilters; +import org.jclouds.rest.annotations.ResponseParser; +import org.jclouds.rest.annotations.SelectJson; +import org.jclouds.rest.annotations.Transform; + +import com.google.common.util.concurrent.ListenableFuture; + +/** + * Provides asynchronous access to Rackspace Cloud Load Balancers via their REST API. + *

+ * + * @see ReportApi + * @author Everett Toews + */ +@RequestFilters(AuthenticateRequest.class) +public interface ReportAsyncApi { + /** + * @see ReportApi#listBillableLoadBalancers(Date, Date) + */ + @Named("report:list") + @GET + @Consumes(MediaType.APPLICATION_JSON) + @ResponseParser(ParseLoadBalancers.class) + @Transform(ParseLoadBalancers.ToPagedIterable.class) + @Fallback(NullOnNotFoundOr404.class) + @Path("/loadbalancers/billable") + ListenableFuture> listBillableLoadBalancers( + @ParamParser(DateParser.class) @QueryParam("startTime") Date startTime, + @ParamParser(DateParser.class) @QueryParam("endTime") Date endTime); + + /** + * @see ReportApi#listBillableLoadBalancers(PaginationOptions) + */ + @Named("report:list") + @GET + @ResponseParser(ParseLoadBalancers.class) + @Consumes(MediaType.APPLICATION_JSON) + @Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class) + @Path("/loadbalancers/billable") + ListenableFuture> listBillableLoadBalancers(PaginationOptions options); + + /** + * @see ReportApi#getHistoricalUsage(Date, Date) + */ + @Named("report:list") + @GET + @Consumes(MediaType.APPLICATION_JSON) + @Fallback(NullOnNotFoundOr404.class) + @Path("/loadbalancers/usage") + ListenableFuture getHistoricalUsage( + @ParamParser(DateParser.class) @QueryParam("startTime") Date startTime, + @ParamParser(DateParser.class) @QueryParam("endTime") Date endTime); + + /** + * @see ReportApi#listLoadBalancerUsage(int, Date, Date) + */ + @Named("report:list") + @GET + @Consumes(MediaType.APPLICATION_JSON) + @ResponseParser(ParseLoadBalancerUsages.class) + @Transform(ParseLoadBalancerUsages.ToPagedIterable.class) + @Fallback(NullOnNotFoundOr404.class) + @Path("/loadbalancers/{id}/usage") + ListenableFuture> listLoadBalancerUsage( + @PathParam("id") int loadBalancerId, + @ParamParser(DateParser.class) @QueryParam("startTime") Date startTime, + @ParamParser(DateParser.class) @QueryParam("endTime") Date endTime); + + /** + * @see ReportApi#listLoadBalancerUsage(PaginationOptions) + */ + @Named("report:list") + @GET + @ResponseParser(ParseLoadBalancerUsages.class) + @Consumes(MediaType.APPLICATION_JSON) + @Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class) + @Path("/loadbalancers/{id}/usage") + ListenableFuture> listLoadBalancerUsage(PaginationOptions options); + + /** + * @see ReportApi#listCurrentLoadBalancerUsage(int) + */ + @Named("report:list") + @GET + @Consumes(MediaType.APPLICATION_JSON) + @ResponseParser(ParseLoadBalancerUsages.class) + @Transform(ParseLoadBalancerUsages.ToPagedIterable.class) + @Fallback(NullOnNotFoundOr404.class) + @Path("/loadbalancers/{id}/usage/current") + ListenableFuture> listCurrentLoadBalancerUsage( + @PathParam("id") int loadBalancerId); + + /** + * @see ReportApi#listCurrentLoadBalancerUsage(PaginationOptions) + */ + @Named("report:list") + @GET + @ResponseParser(ParseLoadBalancerUsages.class) + @Consumes(MediaType.APPLICATION_JSON) + @Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class) + @Path("/loadbalancers/{id}/usage/current") + ListenableFuture> listCurrentLoadBalancerUsage(PaginationOptions options); + + /** + * @see ReportApi#getLoadBalancerStats(int) + */ + @Named("report:list") + @GET + @Consumes(MediaType.APPLICATION_JSON) + @Fallback(NullOnNotFoundOr404.class) + @Path("/loadbalancers/{id}/stats") + ListenableFuture getLoadBalancerStats( + @PathParam("id") int loadBalancerId); + + /** + * @see ReportApi#listProtocols() + */ + @Named("report:list") + @GET + @Consumes(MediaType.APPLICATION_JSON) + @SelectJson("protocols") + @Fallback(NullOnNotFoundOr404.class) + @Path("/loadbalancers/protocols") + ListenableFuture> listProtocols(); + + /** + * @see ReportApi#listAlgorithms() + */ + @Named("report:list") + @GET + @Consumes(MediaType.APPLICATION_JSON) + @ResponseParser(ParseAlgorithms.class) + @Fallback(NullOnNotFoundOr404.class) + @Path("/loadbalancers/algorithms") + ListenableFuture> listAlgorithms(); +} diff --git a/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/features/SSLTerminationApi.java b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/features/SSLTerminationApi.java index 6ce7b2cb2b..7376c1402c 100644 --- a/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/features/SSLTerminationApi.java +++ b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/features/SSLTerminationApi.java @@ -71,7 +71,7 @@ public interface SSLTerminationApi { * If a user wants to replace the existing SSL configuration, a new certificate, privatekey, and securePort * combination must be provided instead of, or in addition to, the optional/editable attributes. */ - void createOrUpdate(SSLTermination healthMonitor); + void createOrUpdate(SSLTermination sslTermination); /** * Get SSL termination info. diff --git a/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/functions/DateParser.java b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/functions/DateParser.java new file mode 100644 index 0000000000..ba70c77ce8 --- /dev/null +++ b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/functions/DateParser.java @@ -0,0 +1,48 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.rackspace.cloudloadbalancers.functions; + +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; + +import java.text.SimpleDateFormat; +import java.util.Date; + +import javax.inject.Singleton; + +import com.google.common.base.Function; + +/** + * Takes a Date and return a yyyy-MM-dd String. + * + * @author Everett Toews + */ +@Singleton +public class DateParser implements Function { + @Override + public String apply(Object input) { + checkArgument(checkNotNull(input, "input") instanceof Date, "This function is only valid for Dates!"); + Date date = Date.class.cast(input); + + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + + return format.format(date); + } + +} diff --git a/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/functions/ParseAlgorithms.java b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/functions/ParseAlgorithms.java new file mode 100644 index 0000000000..9e3c6ea587 --- /dev/null +++ b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/functions/ParseAlgorithms.java @@ -0,0 +1,71 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.rackspace.cloudloadbalancers.functions; + +import static com.google.common.base.Preconditions.checkNotNull; + +import java.util.List; +import java.util.Map; + +import javax.inject.Inject; + +import org.jclouds.http.HttpRequest; +import org.jclouds.http.HttpResponse; +import org.jclouds.http.HttpResponseException; +import org.jclouds.http.functions.ParseJson; +import org.jclouds.rest.InvocationContext; + +import com.google.common.base.Function; +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; + +/** + * @author Everett Toews + */ +public class ParseAlgorithms implements Function>, InvocationContext { + + private final ParseJson>>> json; + + @Inject + ParseAlgorithms(ParseJson>>> json) { + this.json = checkNotNull(json, "json"); + } + + @Override + public List apply(HttpResponse response) { + Map>> map = json.apply(response); + + if (map == null || map.size() == 0) + throw new HttpResponseException("Unexpected JSON format returned.", null, response); + + List> list = Iterables.get(map.values(), 0); + List algorithms = Lists.newArrayList(); + + for (Map nameAlgorithmPair: list) { + algorithms.add(Iterables.get(nameAlgorithmPair.values(), 0)); + } + + return algorithms; + } + + @Override + public ParseAlgorithms setContext(HttpRequest request) { + return this; + } +} diff --git a/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/functions/ParseLoadBalancerUsages.java b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/functions/ParseLoadBalancerUsages.java new file mode 100644 index 0000000000..05381b90df --- /dev/null +++ b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/functions/ParseLoadBalancerUsages.java @@ -0,0 +1,94 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.rackspace.cloudloadbalancers.functions; + +import static com.google.common.base.Preconditions.checkNotNull; +import static org.jclouds.openstack.v2_0.options.PaginationOptions.Builder.marker; + +import java.beans.ConstructorProperties; + +import javax.inject.Inject; +import javax.inject.Singleton; + +import org.jclouds.collect.IterableWithMarker; +import org.jclouds.collect.internal.CallerArg0ToPagedIterable; +import org.jclouds.http.functions.ParseJson; +import org.jclouds.json.Json; +import org.jclouds.openstack.keystone.v2_0.domain.PaginatedCollection; +import org.jclouds.openstack.v2_0.domain.Link; +import org.jclouds.rackspace.cloudloadbalancers.CloudLoadBalancersApi; +import org.jclouds.rackspace.cloudloadbalancers.domain.LoadBalancerUsage; +import org.jclouds.rackspace.cloudloadbalancers.features.ReportApi; +import org.jclouds.rackspace.cloudloadbalancers.functions.ParseLoadBalancerUsages.LoadBalancerUsages; + +import com.google.common.base.Function; +import com.google.inject.TypeLiteral; + +/** + * boiler plate until we determine a better way + * + * @author Everett Toews + */ +@Singleton +public class ParseLoadBalancerUsages extends ParseJson { + + @Inject + public ParseLoadBalancerUsages(Json json) { + super(json, TypeLiteral.get(LoadBalancerUsages.class)); + } + + static class LoadBalancerUsages extends PaginatedCollection { + + @ConstructorProperties({ "loadBalancerUsageRecords", "links" }) + protected LoadBalancerUsages(Iterable loadBalancerUsageRecords, Iterable links) { + super(loadBalancerUsageRecords, links); + } + } + + public static class ToPagedIterable extends CallerArg0ToPagedIterable { + + private final CloudLoadBalancersApi api; + + @Inject + protected ToPagedIterable(CloudLoadBalancersApi api) { + this.api = checkNotNull(api, "api"); + } + + @Override + protected Function> markerToNextForCallingArg0(final String zone) { + final ReportApi reportApi = api.getReportApiForZone(zone); + + return new Function>() { + + @Override + public IterableWithMarker apply(Object input) { + IterableWithMarker list = reportApi.listLoadBalancerUsage(marker(input.toString())); + return list; + } + + @Override + public String toString() { + return "listLoadBalancerUsage()"; + } + }; + } + + } + +} diff --git a/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/features/ReportApiExpectTest.java b/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/features/ReportApiExpectTest.java new file mode 100644 index 0000000000..b3b4868e09 --- /dev/null +++ b/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/features/ReportApiExpectTest.java @@ -0,0 +1,186 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.rackspace.cloudloadbalancers.features; + +import static org.testng.Assert.assertEquals; + +import java.net.URI; +import java.util.Calendar; +import java.util.Date; + +import org.jclouds.http.HttpResponse; +import org.jclouds.rackspace.cloudloadbalancers.CloudLoadBalancersApi; +import org.jclouds.rackspace.cloudloadbalancers.domain.HistoricalUsage; +import org.jclouds.rackspace.cloudloadbalancers.domain.LoadBalancer; +import org.jclouds.rackspace.cloudloadbalancers.domain.LoadBalancerStats; +import org.jclouds.rackspace.cloudloadbalancers.domain.LoadBalancerUsage; +import org.jclouds.rackspace.cloudloadbalancers.domain.Protocol; +import org.jclouds.rackspace.cloudloadbalancers.functions.DateParser; +import org.jclouds.rackspace.cloudloadbalancers.internal.BaseCloudLoadBalancerApiExpectTest; +import org.testng.annotations.Test; + +import com.google.common.collect.FluentIterable; +import com.google.common.collect.Iterables; + +/** + * @author Everett Toews + */ +@Test(groups = "unit") +public class ReportApiExpectTest extends BaseCloudLoadBalancerApiExpectTest { + public void testListBillableLoadBalancers() { + Calendar calendar = Calendar.getInstance(); + calendar.add(Calendar.DATE, -7); + Date aWeekAgo = calendar.getTime(); + Date today = new Date(); + + String query = new StringBuilder() + .append("?startTime=") + .append(new DateParser().apply(aWeekAgo)) + .append("&endTime=") + .append(new DateParser().apply(today)) + .toString(); + + URI endpoint = URI.create("https://dfw.loadbalancers.api.rackspacecloud.com/v1.0/123123/loadbalancers/billable" + query); + ReportApi api = requestsSendResponses( + rackspaceAuthWithUsernameAndApiKey, + responseWithAccess, + authenticatedGET().endpoint(endpoint).build(), + HttpResponse.builder().statusCode(200).payload(payloadFromResource("/report-billable-list.json")).build() + ).getReportApiForZone("DFW"); + + FluentIterable loadBalancers = api.listBillableLoadBalancers(aWeekAgo, today).concat(); + + assertEquals(Iterables.size(loadBalancers), 2); + } + + public void testGetHistoricalUsage() { + Calendar calendar = Calendar.getInstance(); + calendar.add(Calendar.DATE, -7); + Date aWeekAgo = calendar.getTime(); + Date today = new Date(); + + String query = new StringBuilder() + .append("?startTime=") + .append(new DateParser().apply(aWeekAgo)) + .append("&endTime=") + .append(new DateParser().apply(today)) + .toString(); + + URI endpoint = URI.create("https://dfw.loadbalancers.api.rackspacecloud.com/v1.0/123123/loadbalancers/usage" + query); + ReportApi api = requestsSendResponses( + rackspaceAuthWithUsernameAndApiKey, + responseWithAccess, + authenticatedGET().endpoint(endpoint).build(), + HttpResponse.builder().statusCode(200).payload(payloadFromResource("/report-historical-get.json")).build() + ).getReportApiForZone("DFW"); + + HistoricalUsage historicalUsage = api.getHistoricalUsage(aWeekAgo, today); + + assertEquals(historicalUsage.getAccountId(), 717071); + assertEquals(Iterables.get(historicalUsage.getAccountUsage(), 0).getNumLoadBalancers(), 2); + assertEquals(Iterables.size(historicalUsage.getLoadBalancerInfo()), 2); + } + + public void testListLoadBalancerUsage() { + Calendar calendar = Calendar.getInstance(); + calendar.add(Calendar.DATE, -7); + Date aWeekAgo = calendar.getTime(); + Date today = new Date(); + + String query = new StringBuilder() + .append("?startTime=") + .append(new DateParser().apply(aWeekAgo)) + .append("&endTime=") + .append(new DateParser().apply(today)) + .toString(); + + URI endpoint = URI.create("https://dfw.loadbalancers.api.rackspacecloud.com/v1.0/123123/loadbalancers/2000/usage" + query); + ReportApi api = requestsSendResponses( + rackspaceAuthWithUsernameAndApiKey, + responseWithAccess, + authenticatedGET().endpoint(endpoint).build(), + HttpResponse.builder().statusCode(200).payload(payloadFromResource("/report-loadbalancerusage-list.json")).build() + ).getReportApiForZone("DFW"); + + FluentIterable loadBalancerUsages = api.listLoadBalancerUsage(2000, aWeekAgo, today).concat(); + + assertEquals(Iterables.size(loadBalancerUsages), 25); + } + + public void testListCurrentLoadBalancerUsage() { + URI endpoint = URI.create("https://dfw.loadbalancers.api.rackspacecloud.com/v1.0/123123/loadbalancers/2000/usage/current"); + ReportApi api = requestsSendResponses( + rackspaceAuthWithUsernameAndApiKey, + responseWithAccess, + authenticatedGET().endpoint(endpoint).build(), + HttpResponse.builder().statusCode(200).payload(payloadFromResource("/report-loadbalancerusage-list.json")).build() + ).getReportApiForZone("DFW"); + + FluentIterable loadBalancerUsages = api.listCurrentLoadBalancerUsage(2000).concat(); + + assertEquals(Iterables.size(loadBalancerUsages), 25); + } + + public void testGetLoadBalancerStats() { + URI endpoint = URI.create("https://dfw.loadbalancers.api.rackspacecloud.com/v1.0/123123/loadbalancers/2000/stats"); + ReportApi api = requestsSendResponses( + rackspaceAuthWithUsernameAndApiKey, + responseWithAccess, + authenticatedGET().endpoint(endpoint).build(), + HttpResponse.builder().statusCode(200).payload(payloadFromResource("/report-loadbalancerstats-get.json")).build() + ).getReportApiForZone("DFW"); + + LoadBalancerStats loadBalancerStats = api.getLoadBalancerStats(2000); + + assertEquals(loadBalancerStats.getConnectTimeOut(), 2); + assertEquals(loadBalancerStats.getConnectError(), 0); + assertEquals(loadBalancerStats.getConnectFailure(), 0); + assertEquals(loadBalancerStats.getDataTimedOut(), 10); + assertEquals(loadBalancerStats.getKeepAliveTimedOut(), 0); + assertEquals(loadBalancerStats.getMaxConn(), 22); + } + + public void testListProtocols() { + URI endpoint = URI.create("https://dfw.loadbalancers.api.rackspacecloud.com/v1.0/123123/loadbalancers/protocols"); + ReportApi api = requestsSendResponses( + rackspaceAuthWithUsernameAndApiKey, + responseWithAccess, + authenticatedGET().endpoint(endpoint).build(), + HttpResponse.builder().statusCode(200).payload(payloadFromResource("/report-protocols-list.json")).build() + ).getReportApiForZone("DFW"); + + Iterable protocols = api.listProtocols(); + + assertEquals(Iterables.size(protocols), 20); + } + + public void testListAlgorithms() { + URI endpoint = URI.create("https://dfw.loadbalancers.api.rackspacecloud.com/v1.0/123123/loadbalancers/algorithms"); + ReportApi api = requestsSendResponses( + rackspaceAuthWithUsernameAndApiKey, + responseWithAccess, + authenticatedGET().endpoint(endpoint).build(), + HttpResponse.builder().statusCode(200).payload(payloadFromResource("/report-algorithms-list.json")).build() + ).getReportApiForZone("DFW"); + + Iterable algorithms = api.listAlgorithms(); + + assertEquals(Iterables.size(algorithms), 5); + } +} diff --git a/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/features/ReportApiLiveTest.java b/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/features/ReportApiLiveTest.java new file mode 100644 index 0000000000..8884db7948 --- /dev/null +++ b/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/features/ReportApiLiveTest.java @@ -0,0 +1,110 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.rackspace.cloudloadbalancers.features; + +import static org.jclouds.rackspace.cloudloadbalancers.predicates.LoadBalancerPredicates.awaitAvailable; +import static org.jclouds.rackspace.cloudloadbalancers.predicates.LoadBalancerPredicates.awaitDeleted; +import static org.testng.Assert.assertNotEquals; +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertTrue; + +import java.util.Calendar; +import java.util.Date; + +import org.jclouds.http.HttpResponseException; +import org.jclouds.rackspace.cloudloadbalancers.domain.HistoricalUsage; +import org.jclouds.rackspace.cloudloadbalancers.domain.LoadBalancer; +import org.jclouds.rackspace.cloudloadbalancers.domain.LoadBalancerRequest; +import org.jclouds.rackspace.cloudloadbalancers.domain.LoadBalancerStats; +import org.jclouds.rackspace.cloudloadbalancers.domain.LoadBalancerUsage; +import org.jclouds.rackspace.cloudloadbalancers.domain.NodeRequest; +import org.jclouds.rackspace.cloudloadbalancers.domain.Protocol; +import org.jclouds.rackspace.cloudloadbalancers.domain.VirtualIP.Type; +import org.jclouds.rackspace.cloudloadbalancers.internal.BaseCloudLoadBalancersApiLiveTest; +import org.testng.annotations.AfterGroups; +import org.testng.annotations.Test; + +import com.google.common.collect.FluentIterable; +import com.google.common.collect.Iterables; + +/** + * @author Everett Toews + */ +@Test(groups = "live", singleThreaded = true, testName = "ReportApiLiveTest") +public class ReportApiLiveTest extends BaseCloudLoadBalancersApiLiveTest { + private LoadBalancer lb; + private String zone; + + public void testCreateLoadBalancer() { + NodeRequest nodeRequest = NodeRequest.builder().address("192.168.1.1").port(8080).build(); + LoadBalancerRequest lbRequest = LoadBalancerRequest.builder() + .name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(nodeRequest).build(); + + zone = Iterables.getFirst(clbApi.getConfiguredZones(), null); + lb = clbApi.getLoadBalancerApiForZone(zone).create(lbRequest); + + assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); + } + + @Test(dependsOnMethods = "testCreateLoadBalancer") + public void testReports() throws Exception { + Calendar calendar = Calendar.getInstance(); + calendar.add(Calendar.DATE, -1); + Date yesterday = calendar.getTime(); + Date today = new Date(); + + FluentIterable loadBalancers = clbApi.getReportApiForZone(zone).listBillableLoadBalancers(yesterday, today).concat(); + assertNotNull(loadBalancers); + + HistoricalUsage historicalUsage = clbApi.getReportApiForZone(zone).getHistoricalUsage(yesterday, today); + assertNotEquals(historicalUsage.getAccountId(), 0); + + FluentIterable loadBalancerUsages = clbApi.getReportApiForZone(zone).listLoadBalancerUsage(lb.getId(), yesterday, today).concat(); + assertNotNull(loadBalancerUsages); + + loadBalancerUsages = clbApi.getReportApiForZone(zone).listCurrentLoadBalancerUsage(lb.getId()).concat(); + assertNotNull(loadBalancerUsages); + + try { + LoadBalancerStats loadBalancerStats = clbApi.getReportApiForZone(zone).getLoadBalancerStats(lb.getId()); + assertNotNull(loadBalancerStats); + } + catch (HttpResponseException e) { + // CLB sometimes doesn't like it when you get stats on a newly created LB so ignore a 500 + if (e.getResponse().getStatusCode() != 500) { + throw e; + } + } + + Iterable protocols = clbApi.getReportApiForZone(zone).listProtocols(); + assertTrue(!Iterables.isEmpty(protocols)); + + Iterable algorithms = clbApi.getReportApiForZone(zone).listAlgorithms(); + assertTrue(!Iterables.isEmpty(algorithms)); + } + + @Override + @AfterGroups(groups = "live") + protected void tearDownContext() { + assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); + clbApi.getLoadBalancerApiForZone(zone).remove(lb.getId()); + assertTrue(awaitDeleted(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); + super.tearDownContext(); + } +} diff --git a/apis/rackspace-cloudloadbalancers/src/test/resources/report-algorithms-list.json b/apis/rackspace-cloudloadbalancers/src/test/resources/report-algorithms-list.json new file mode 100644 index 0000000000..9793f97cae --- /dev/null +++ b/apis/rackspace-cloudloadbalancers/src/test/resources/report-algorithms-list.json @@ -0,0 +1,19 @@ +{ + "algorithms": [ + { + "name": "LEAST_CONNECTIONS" + }, + { + "name": "RANDOM" + }, + { + "name": "ROUND_ROBIN" + }, + { + "name": "WEIGHTED_LEAST_CONNECTIONS" + }, + { + "name": "WEIGHTED_ROUND_ROBIN" + } + ] +} \ No newline at end of file diff --git a/apis/rackspace-cloudloadbalancers/src/test/resources/report-billable-list.json b/apis/rackspace-cloudloadbalancers/src/test/resources/report-billable-list.json new file mode 100644 index 0000000000..e485a3a957 --- /dev/null +++ b/apis/rackspace-cloudloadbalancers/src/test/resources/report-billable-list.json @@ -0,0 +1,64 @@ +{ + "loadBalancers": [ + { + "name": "jclouds-app", + "id": 85901, + "protocol": "HTTP", + "port": 80, + "algorithm": "WEIGHTED_LEAST_CONNECTIONS", + "status": "ACTIVE", + "timeout": 30, + "created": { + "time": "2012-12-24T18:13:44Z" + }, + "virtualIps": [ + { + "address": "166.78.34.87", + "id": 5557, + "type": "PUBLIC", + "ipVersion": "IPV4" + }, + { + "address": "2001:4800:7901:0000:9a32:3c2a:0000:0001", + "id": 9080119, + "type": "PUBLIC", + "ipVersion": "IPV6" + } + ], + "updated": { + "time": "2013-01-24T17:35:56Z" + }, + "nodeCount": 1 + }, + { + "name": "jclouds-app", + "id": 90903, + "protocol": "HTTP", + "port": 80, + "algorithm": "WEIGHTED_LEAST_CONNECTIONS", + "status": "ACTIVE", + "timeout": 30, + "created": { + "time": "2013-01-20T20:53:29Z" + }, + "virtualIps": [ + { + "address": "166.78.34.184", + "id": 5751, + "type": "PUBLIC", + "ipVersion": "IPV4" + }, + { + "address": "2001:4800:7901:0000:9a32:3c2a:0000:0002", + "id": 9080915, + "type": "PUBLIC", + "ipVersion": "IPV6" + } + ], + "updated": { + "time": "2013-01-24T21:32:42Z" + }, + "nodeCount": 2 + } + ] +} \ No newline at end of file diff --git a/apis/rackspace-cloudloadbalancers/src/test/resources/report-historical-get.json b/apis/rackspace-cloudloadbalancers/src/test/resources/report-historical-get.json new file mode 100644 index 0000000000..662bd6edd9 --- /dev/null +++ b/apis/rackspace-cloudloadbalancers/src/test/resources/report-historical-get.json @@ -0,0 +1,750 @@ +{ + "accountId": 717071, + "accountUsage": { + "accountUsageRecords": [ + { + "startTime": "2013-01-25T00:00:28Z", + "numLoadBalancers": 2, + "numPublicVips": 2, + "numServicenetVips": 0 + } + ], + "links": [] + }, + "loadBalancerUsages": [ + { + "loadBalancerId": 85901, + "loadBalancerName": "jclouds-app", + "links": [], + "loadBalancerUsageRecords": [ + { + "id": 17888041, + "startTime": "2013-01-25T00:00:00Z", + "endTime": "2013-01-25T01:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17895283, + "startTime": "2013-01-25T01:00:00Z", + "endTime": "2013-01-25T02:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17902527, + "startTime": "2013-01-25T02:00:00Z", + "endTime": "2013-01-25T03:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17909761, + "startTime": "2013-01-25T03:00:00Z", + "endTime": "2013-01-25T04:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17916995, + "startTime": "2013-01-25T04:00:00Z", + "endTime": "2013-01-25T05:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17924231, + "startTime": "2013-01-25T05:00:00Z", + "endTime": "2013-01-25T06:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17931467, + "startTime": "2013-01-25T06:00:00Z", + "endTime": "2013-01-25T07:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17938703, + "startTime": "2013-01-25T07:00:00Z", + "endTime": "2013-01-25T08:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17945951, + "startTime": "2013-01-25T08:00:00Z", + "endTime": "2013-01-25T09:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17953175, + "startTime": "2013-01-25T09:00:00Z", + "endTime": "2013-01-25T10:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 11, + "sslMode": "OFF" + }, + { + "id": 17960399, + "startTime": "2013-01-25T10:00:00Z", + "endTime": "2013-01-25T11:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17967623, + "startTime": "2013-01-25T11:00:00Z", + "endTime": "2013-01-25T12:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17974855, + "startTime": "2013-01-25T12:00:00Z", + "endTime": "2013-01-25T13:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17982103, + "startTime": "2013-01-25T13:00:00Z", + "endTime": "2013-01-25T14:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17989349, + "startTime": "2013-01-25T14:00:00Z", + "endTime": "2013-01-25T15:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17996607, + "startTime": "2013-01-25T15:00:00Z", + "endTime": "2013-01-25T16:00:00Z", + "numVips": 1, + "incomingTransfer": 46, + "outgoingTransfer": 368, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 18003887, + "startTime": "2013-01-25T16:00:00Z", + "endTime": "2013-01-25T17:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 18011157, + "startTime": "2013-01-25T17:00:00Z", + "endTime": "2013-01-25T18:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 18018437, + "startTime": "2013-01-25T18:00:00Z", + "endTime": "2013-01-25T19:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 18025709, + "startTime": "2013-01-25T19:00:00Z", + "endTime": "2013-01-25T20:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 18033013, + "startTime": "2013-01-25T20:00:00Z", + "endTime": "2013-01-25T21:00:00Z", + "numVips": 1, + "incomingTransfer": 847, + "outgoingTransfer": 2328, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 18040267, + "startTime": "2013-01-25T21:00:00Z", + "endTime": "2013-01-25T22:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 18047493, + "startTime": "2013-01-25T22:00:00Z", + "endTime": "2013-01-25T23:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 18054719, + "startTime": "2013-01-25T23:00:00Z", + "endTime": "2013-01-26T00:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + } + ] + }, + { + "loadBalancerId": 90903, + "loadBalancerName": "jclouds-app", + "links": [], + "loadBalancerUsageRecords": [ + { + "id": 17887647, + "startTime": "2013-01-25T00:00:00Z", + "endTime": "2013-01-25T01:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17894889, + "startTime": "2013-01-25T01:00:00Z", + "endTime": "2013-01-25T02:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17902133, + "startTime": "2013-01-25T02:00:00Z", + "endTime": "2013-01-25T03:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17909367, + "startTime": "2013-01-25T03:00:00Z", + "endTime": "2013-01-25T04:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17916601, + "startTime": "2013-01-25T04:00:00Z", + "endTime": "2013-01-25T05:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17923837, + "startTime": "2013-01-25T05:00:00Z", + "endTime": "2013-01-25T06:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17931073, + "startTime": "2013-01-25T06:00:00Z", + "endTime": "2013-01-25T07:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17938309, + "startTime": "2013-01-25T07:00:00Z", + "endTime": "2013-01-25T08:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17945557, + "startTime": "2013-01-25T08:00:00Z", + "endTime": "2013-01-25T09:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17952781, + "startTime": "2013-01-25T09:00:00Z", + "endTime": "2013-01-25T10:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17960005, + "startTime": "2013-01-25T10:00:00Z", + "endTime": "2013-01-25T11:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17967229, + "startTime": "2013-01-25T11:00:00Z", + "endTime": "2013-01-25T12:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17974461, + "startTime": "2013-01-25T12:00:00Z", + "endTime": "2013-01-25T13:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17981709, + "startTime": "2013-01-25T13:00:00Z", + "endTime": "2013-01-25T14:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17988955, + "startTime": "2013-01-25T14:00:00Z", + "endTime": "2013-01-25T15:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17996213, + "startTime": "2013-01-25T15:00:00Z", + "endTime": "2013-01-25T16:00:00Z", + "numVips": 1, + "incomingTransfer": 46, + "outgoingTransfer": 306, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 18003493, + "startTime": "2013-01-25T16:00:00Z", + "endTime": "2013-01-25T17:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 18010763, + "startTime": "2013-01-25T17:00:00Z", + "endTime": "2013-01-25T18:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 18018043, + "startTime": "2013-01-25T18:00:00Z", + "endTime": "2013-01-25T19:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 18025315, + "startTime": "2013-01-25T19:00:00Z", + "endTime": "2013-01-25T20:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 18032619, + "startTime": "2013-01-25T20:00:00Z", + "endTime": "2013-01-25T21:00:00Z", + "numVips": 1, + "incomingTransfer": 427, + "outgoingTransfer": 662, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 18039873, + "startTime": "2013-01-25T21:00:00Z", + "endTime": "2013-01-25T22:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 18047099, + "startTime": "2013-01-25T22:00:00Z", + "endTime": "2013-01-25T23:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 18054325, + "startTime": "2013-01-25T23:00:00Z", + "endTime": "2013-01-26T00:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + } + ] + } + ] +} \ No newline at end of file diff --git a/apis/rackspace-cloudloadbalancers/src/test/resources/report-loadbalancerstats-get.json b/apis/rackspace-cloudloadbalancers/src/test/resources/report-loadbalancerstats-get.json new file mode 100644 index 0000000000..1c99c7ea91 --- /dev/null +++ b/apis/rackspace-cloudloadbalancers/src/test/resources/report-loadbalancerstats-get.json @@ -0,0 +1,8 @@ +{ + "connectTimeOut": 2, + "connectError": 0, + "connectFailure": 0, + "dataTimedOut": 10, + "keepAliveTimedOut": 0, + "maxConn": 22 +} \ No newline at end of file diff --git a/apis/rackspace-cloudloadbalancers/src/test/resources/report-loadbalancerusage-list.json b/apis/rackspace-cloudloadbalancers/src/test/resources/report-loadbalancerusage-list.json new file mode 100644 index 0000000000..398b051e66 --- /dev/null +++ b/apis/rackspace-cloudloadbalancers/src/test/resources/report-loadbalancerusage-list.json @@ -0,0 +1,380 @@ +{ + "links": [], + "loadBalancerUsageRecords": [ + { + "id": 17887647, + "startTime": "2013-01-25T00:00:00Z", + "endTime": "2013-01-25T01:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17894889, + "startTime": "2013-01-25T01:00:00Z", + "endTime": "2013-01-25T02:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17902133, + "startTime": "2013-01-25T02:00:00Z", + "endTime": "2013-01-25T03:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17909367, + "startTime": "2013-01-25T03:00:00Z", + "endTime": "2013-01-25T04:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17916601, + "startTime": "2013-01-25T04:00:00Z", + "endTime": "2013-01-25T05:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17923837, + "startTime": "2013-01-25T05:00:00Z", + "endTime": "2013-01-25T06:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17931073, + "startTime": "2013-01-25T06:00:00Z", + "endTime": "2013-01-25T07:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17938309, + "startTime": "2013-01-25T07:00:00Z", + "endTime": "2013-01-25T08:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17945557, + "startTime": "2013-01-25T08:00:00Z", + "endTime": "2013-01-25T09:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17952781, + "startTime": "2013-01-25T09:00:00Z", + "endTime": "2013-01-25T10:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17960005, + "startTime": "2013-01-25T10:00:00Z", + "endTime": "2013-01-25T11:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17967229, + "startTime": "2013-01-25T11:00:00Z", + "endTime": "2013-01-25T12:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17974461, + "startTime": "2013-01-25T12:00:00Z", + "endTime": "2013-01-25T13:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17981709, + "startTime": "2013-01-25T13:00:00Z", + "endTime": "2013-01-25T14:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17988955, + "startTime": "2013-01-25T14:00:00Z", + "endTime": "2013-01-25T15:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 17996213, + "startTime": "2013-01-25T15:00:00Z", + "endTime": "2013-01-25T16:00:00Z", + "numVips": 1, + "incomingTransfer": 46, + "outgoingTransfer": 306, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 18003493, + "startTime": "2013-01-25T16:00:00Z", + "endTime": "2013-01-25T17:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 18010763, + "startTime": "2013-01-25T17:00:00Z", + "endTime": "2013-01-25T18:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 18018043, + "startTime": "2013-01-25T18:00:00Z", + "endTime": "2013-01-25T19:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 18025315, + "startTime": "2013-01-25T19:00:00Z", + "endTime": "2013-01-25T20:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 18032619, + "startTime": "2013-01-25T20:00:00Z", + "endTime": "2013-01-25T21:00:00Z", + "numVips": 1, + "incomingTransfer": 427, + "outgoingTransfer": 662, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 18039873, + "startTime": "2013-01-25T21:00:00Z", + "endTime": "2013-01-25T22:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 18047099, + "startTime": "2013-01-25T22:00:00Z", + "endTime": "2013-01-25T23:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 18054325, + "startTime": "2013-01-25T23:00:00Z", + "endTime": "2013-01-26T00:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + }, + { + "id": 18061573, + "startTime": "2013-01-26T00:00:00Z", + "endTime": "2013-01-26T01:00:00Z", + "numVips": 1, + "incomingTransfer": 0, + "outgoingTransfer": 0, + "incomingTransferSsl": 0, + "outgoingTransferSsl": 0, + "vipType": "PUBLIC", + "averageNumConnections": 0.0, + "averageNumConnectionsSsl": 0.0, + "numPolls": 12, + "sslMode": "OFF" + } + ] +} \ No newline at end of file diff --git a/apis/rackspace-cloudloadbalancers/src/test/resources/report-protocols-list.json b/apis/rackspace-cloudloadbalancers/src/test/resources/report-protocols-list.json new file mode 100644 index 0000000000..d4ca665e46 --- /dev/null +++ b/apis/rackspace-cloudloadbalancers/src/test/resources/report-protocols-list.json @@ -0,0 +1,84 @@ +{ + "protocols": [ + { + "name": "DNS_TCP", + "port": 53 + }, + { + "name": "DNS_UDP", + "port": 53 + }, + { + "name": "FTP", + "port": 21 + }, + { + "name": "HTTP", + "port": 80 + }, + { + "name": "HTTPS", + "port": 443 + }, + { + "name": "IMAPS", + "port": 993 + }, + { + "name": "IMAPv2", + "port": 143 + }, + { + "name": "IMAPv3", + "port": 220 + }, + { + "name": "IMAPv4", + "port": 143 + }, + { + "name": "LDAP", + "port": 389 + }, + { + "name": "LDAPS", + "port": 636 + }, + { + "name": "MYSQL", + "port": 3306 + }, + { + "name": "POP3", + "port": 110 + }, + { + "name": "POP3S", + "port": 995 + }, + { + "name": "SFTP", + "port": 22 + }, + { + "name": "SMTP", + "port": 25 + }, + { + "name": "TCP", + "port": 0 + }, + { + "name": "TCP_CLIENT_FIRST", + "port": 0 + }, + { + "name": "UDP", + "port": 0 + }, + { + "name": "UDP_STREAM", + "port": 0 + } + ] +} \ No newline at end of file