mirror of https://github.com/apache/jclouds.git
Issue 695: Added ComputePoolCpuUsageDetail objects+service calls+tests
This commit is contained in:
parent
afc173ef78
commit
00de94b7b8
|
@ -0,0 +1,225 @@
|
||||||
|
/**
|
||||||
|
* 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.tmrk.enterprisecloud.domain.resource.cpu;
|
||||||
|
|
||||||
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
|
import org.jclouds.tmrk.enterprisecloud.domain.Action;
|
||||||
|
import org.jclouds.tmrk.enterprisecloud.domain.Link;
|
||||||
|
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
|
||||||
|
import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
|
||||||
|
import org.jclouds.tmrk.enterprisecloud.domain.internal.ResourceCapacity;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ComputePoolCpuUsageDetail is more than a simple wrapper as it extends Resource.
|
||||||
|
* <xs:complexType name="ComputePoolCpuUsageDetail">
|
||||||
|
* @author Jason King
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@XmlRootElement(name = "ComputePoolCpuUsageDetail")
|
||||||
|
public class ComputePoolCpuUsageDetail extends Resource<ComputePoolCpuUsageDetail> {
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static Builder builder() {
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Builder toBuilder() {
|
||||||
|
return new Builder().fromComputePoolCpuUsage(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder extends Resource.Builder<ComputePoolCpuUsageDetail> {
|
||||||
|
private Date time;
|
||||||
|
private ResourceCapacity value;
|
||||||
|
private VirtualMachinesCpuUsage virtualMachinesCpuUsage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.jclouds.tmrk.enterprisecloud.domain.resource.cpu.ComputePoolCpuUsageDetail#getTime
|
||||||
|
*/
|
||||||
|
public Builder time(Date time) {
|
||||||
|
this.time =(checkNotNull(time,"time"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.jclouds.tmrk.enterprisecloud.domain.resource.cpu.ComputePoolCpuUsageDetail#getValue
|
||||||
|
*/
|
||||||
|
public Builder value(ResourceCapacity value) {
|
||||||
|
this.value =(checkNotNull(value,"value"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.jclouds.tmrk.enterprisecloud.domain.resource.cpu.ComputePoolCpuUsageDetail#getVirtualMachinesCpuUsage
|
||||||
|
*/
|
||||||
|
public Builder virtualMachines(VirtualMachinesCpuUsage virtualMachinesCpuUsage) {
|
||||||
|
this.virtualMachinesCpuUsage =(checkNotNull(virtualMachinesCpuUsage,"virtualMachinesCpuUsage"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ComputePoolCpuUsageDetail build() {
|
||||||
|
return new ComputePoolCpuUsageDetail(href, type, name, links, actions, time, value, virtualMachinesCpuUsage);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder fromComputePoolCpuUsage(ComputePoolCpuUsageDetail in) {
|
||||||
|
return fromResource(in).time(in.getTime()).value(in.getValue()).virtualMachines(in.getVirtualMachinesCpuUsage());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Builder fromBaseResource(BaseResource<ComputePoolCpuUsageDetail> in) {
|
||||||
|
return Builder.class.cast(super.fromBaseResource(in));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Builder fromResource(Resource<ComputePoolCpuUsageDetail> in) {
|
||||||
|
return Builder.class.cast(super.fromResource(in));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Builder type(String type) {
|
||||||
|
return Builder.class.cast(super.type(type));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Builder href(URI href) {
|
||||||
|
return Builder.class.cast(super.href(href));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Builder name(String name) {
|
||||||
|
return Builder.class.cast(super.name(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Builder links(Set<Link> links) {
|
||||||
|
return Builder.class.cast(super.links(links));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Builder actions(Set<Action> actions) {
|
||||||
|
return Builder.class.cast(super.actions(actions));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Builder fromAttributes(Map<String, String> attributes) {
|
||||||
|
return Builder.class.cast(super.fromAttributes(attributes));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "Time", required = true)
|
||||||
|
private Date time;
|
||||||
|
|
||||||
|
@XmlElement(name = "Value", required = false)
|
||||||
|
private ResourceCapacity value;
|
||||||
|
|
||||||
|
@XmlElement(name = "VirtualMachines", required = false)
|
||||||
|
private VirtualMachinesCpuUsage virtualMachinesCpuUsage;
|
||||||
|
|
||||||
|
private ComputePoolCpuUsageDetail(URI href, String type, String name, Set<Link> links, Set<Action> actions, Date time, @Nullable ResourceCapacity value, @Nullable VirtualMachinesCpuUsage virtualMachinesCpuUsage) {
|
||||||
|
super(href, type, name, links, actions);
|
||||||
|
this.time = checkNotNull(time, "time");
|
||||||
|
this.value = value;
|
||||||
|
this.virtualMachinesCpuUsage = virtualMachinesCpuUsage;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ComputePoolCpuUsageDetail() {
|
||||||
|
//For JAXB
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getTime() {
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResourceCapacity getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VirtualMachinesCpuUsage getVirtualMachinesCpuUsage() {
|
||||||
|
return virtualMachinesCpuUsage;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
if (!super.equals(o)) return false;
|
||||||
|
|
||||||
|
ComputePoolCpuUsageDetail that = (ComputePoolCpuUsageDetail) o;
|
||||||
|
|
||||||
|
if (!time.equals(that.time)) return false;
|
||||||
|
if (value != null ? !value.equals(that.value) : that.value != null)
|
||||||
|
return false;
|
||||||
|
if (virtualMachinesCpuUsage != null ? !virtualMachinesCpuUsage.equals(that.virtualMachinesCpuUsage) : that.virtualMachinesCpuUsage != null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int result = super.hashCode();
|
||||||
|
result = 31 * result + time.hashCode();
|
||||||
|
result = 31 * result + (value != null ? value.hashCode() : 0);
|
||||||
|
result = 31 * result + (virtualMachinesCpuUsage != null ? virtualMachinesCpuUsage.hashCode() : 0);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String string() {
|
||||||
|
return super.string()+", time="+ time +", value="+value+", virtualMachinesCpuUsage="+ virtualMachinesCpuUsage;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,199 @@
|
||||||
|
/**
|
||||||
|
* 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.tmrk.enterprisecloud.domain.resource.cpu;
|
||||||
|
|
||||||
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
|
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseNamedResource;
|
||||||
|
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
|
||||||
|
import org.jclouds.tmrk.enterprisecloud.domain.internal.ResourceCapacity;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <xs:complexType name="VirtualMachineCpuUsageDetail">
|
||||||
|
* @author Jason King
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class VirtualMachineCpuUsageDetail extends BaseNamedResource<VirtualMachineCpuUsageDetail> {
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static Builder builder() {
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Builder toBuilder() {
|
||||||
|
return new Builder().fromVirtualMachineCpuUsageDetai(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder extends BaseNamedResource.Builder<VirtualMachineCpuUsageDetail> {
|
||||||
|
private ResourceCapacity usage;
|
||||||
|
private int utilization;
|
||||||
|
private boolean deleted;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see VirtualMachineCpuUsageDetail#getUsage
|
||||||
|
*/
|
||||||
|
public Builder usage(ResourceCapacity usage) {
|
||||||
|
this.usage = usage;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see VirtualMachineCpuUsageDetail#getUtilization
|
||||||
|
*/
|
||||||
|
public Builder utilization(int utilization) {
|
||||||
|
this.utilization = utilization;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see VirtualMachineCpuUsageDetail#isDeleted
|
||||||
|
*/
|
||||||
|
public Builder deleted(boolean deleted) {
|
||||||
|
this.deleted = deleted;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VirtualMachineCpuUsageDetail build() {
|
||||||
|
return new VirtualMachineCpuUsageDetail(href, type, name, usage, utilization, deleted);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder fromVirtualMachineCpuUsageDetai(VirtualMachineCpuUsageDetail in) {
|
||||||
|
return fromNamedResource(in).usage(in.getUsage());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Builder fromBaseResource(BaseResource<VirtualMachineCpuUsageDetail> in) {
|
||||||
|
return Builder.class.cast(super.fromBaseResource(in));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Builder fromNamedResource(BaseNamedResource<VirtualMachineCpuUsageDetail> in) {
|
||||||
|
return Builder.class.cast(super.fromNamedResource(in));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Builder name(String name) {
|
||||||
|
return Builder.class.cast(super.name(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Builder href(URI href) {
|
||||||
|
return Builder.class.cast(super.href(href));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Builder type(String type) {
|
||||||
|
return Builder.class.cast(super.type(type));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Builder fromAttributes(Map<String, String> attributes) {
|
||||||
|
return Builder.class.cast(super.fromAttributes(attributes));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "Usage", required = false)
|
||||||
|
private ResourceCapacity usage;
|
||||||
|
|
||||||
|
@XmlElement(name = "Utilization", required = true)
|
||||||
|
private int utilization;
|
||||||
|
|
||||||
|
@XmlElement(name = "Deleted", required = false)
|
||||||
|
private boolean deleted;
|
||||||
|
|
||||||
|
private VirtualMachineCpuUsageDetail(URI href, String type, String name,
|
||||||
|
@Nullable ResourceCapacity usage, int utilization, boolean deleted) {
|
||||||
|
super(href, type, name);
|
||||||
|
this.usage = usage;
|
||||||
|
this.utilization = utilization;
|
||||||
|
this.deleted = deleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
private VirtualMachineCpuUsageDetail() {
|
||||||
|
//For JAXB
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResourceCapacity getUsage() {
|
||||||
|
return usage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getUtilization() {
|
||||||
|
return utilization;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDeleted() {
|
||||||
|
return deleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
if (!super.equals(o)) return false;
|
||||||
|
|
||||||
|
VirtualMachineCpuUsageDetail that = (VirtualMachineCpuUsageDetail) o;
|
||||||
|
|
||||||
|
if (deleted != that.deleted) return false;
|
||||||
|
if (utilization != that.utilization) return false;
|
||||||
|
if (usage != null ? !usage.equals(that.usage) : that.usage != null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int result = super.hashCode();
|
||||||
|
result = 31 * result + (usage != null ? usage.hashCode() : 0);
|
||||||
|
result = 31 * result + utilization;
|
||||||
|
result = 31 * result + (deleted ? 1 : 0);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String string() {
|
||||||
|
return super.string()+", usage="+usage+", utilization="+utilization+", deleted="+deleted;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,107 @@
|
||||||
|
/**
|
||||||
|
* 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.tmrk.enterprisecloud.domain.resource.cpu;
|
||||||
|
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wraps individual VirtualMachineCpuUsageDetail elements.
|
||||||
|
* <xs:complexType name="CpuUsage_VirtualMachines">
|
||||||
|
* @author Jason King
|
||||||
|
*/
|
||||||
|
public class VirtualMachinesCpuUsage {
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static Builder builder() {
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder toBuilder() {
|
||||||
|
return new Builder().fromCpuUsageDetails(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
|
||||||
|
private Set<VirtualMachineCpuUsageDetail> virtualMachinesCpuUsageDetail = Sets.newLinkedHashSet();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see VirtualMachinesCpuUsage#getVirtualMachinesCpuUsageDetail
|
||||||
|
*/
|
||||||
|
public Builder vmCpuUsageDetails(Set<VirtualMachineCpuUsageDetail> vmCpuUsageDetails) {
|
||||||
|
this.virtualMachinesCpuUsageDetail = Sets.newLinkedHashSet(checkNotNull(vmCpuUsageDetails, "vmCpuUsageDetails"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder addVmCpuUsageDetail(VirtualMachineCpuUsageDetail vmCpuUsageDetail) {
|
||||||
|
virtualMachinesCpuUsageDetail.add(checkNotNull(vmCpuUsageDetail,"vmCpuUsageDetail"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VirtualMachinesCpuUsage build() {
|
||||||
|
return new VirtualMachinesCpuUsage(virtualMachinesCpuUsageDetail);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder fromCpuUsageDetails(VirtualMachinesCpuUsage in) {
|
||||||
|
return vmCpuUsageDetails(in.getVirtualMachinesCpuUsageDetail());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private VirtualMachinesCpuUsage() {
|
||||||
|
//For JAXB and builder use
|
||||||
|
}
|
||||||
|
|
||||||
|
private VirtualMachinesCpuUsage(Set<VirtualMachineCpuUsageDetail> virtualMachinesCpuUsageDetail) {
|
||||||
|
this.virtualMachinesCpuUsageDetail = Sets.newLinkedHashSet(virtualMachinesCpuUsageDetail);
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "VirtualMachine", required=false)
|
||||||
|
private Set<VirtualMachineCpuUsageDetail> virtualMachinesCpuUsageDetail = Sets.newLinkedHashSet();
|
||||||
|
|
||||||
|
public Set<VirtualMachineCpuUsageDetail> getVirtualMachinesCpuUsageDetail() {
|
||||||
|
return Collections.unmodifiableSet(virtualMachinesCpuUsageDetail);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
|
VirtualMachinesCpuUsage that = (VirtualMachinesCpuUsage) o;
|
||||||
|
|
||||||
|
if (virtualMachinesCpuUsageDetail != null ? !virtualMachinesCpuUsageDetail.equals(that.virtualMachinesCpuUsageDetail) : that.virtualMachinesCpuUsageDetail != null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return virtualMachinesCpuUsageDetail != null ? virtualMachinesCpuUsageDetail.hashCode() : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return "["+ virtualMachinesCpuUsageDetail.toString()+"]";
|
||||||
|
}
|
||||||
|
}
|
|
@ -25,6 +25,7 @@ import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
|
||||||
import org.jclouds.tmrk.enterprisecloud.domain.resource.cpu.ComputePoolCpuUsage;
|
import org.jclouds.tmrk.enterprisecloud.domain.resource.cpu.ComputePoolCpuUsage;
|
||||||
import org.jclouds.tmrk.enterprisecloud.domain.resource.ComputePoolResourceSummary;
|
import org.jclouds.tmrk.enterprisecloud.domain.resource.ComputePoolResourceSummary;
|
||||||
import org.jclouds.tmrk.enterprisecloud.domain.resource.ComputePoolResourceSummaryList;
|
import org.jclouds.tmrk.enterprisecloud.domain.resource.ComputePoolResourceSummaryList;
|
||||||
|
import org.jclouds.tmrk.enterprisecloud.domain.resource.cpu.ComputePoolCpuUsageDetail;
|
||||||
|
|
||||||
import javax.ws.rs.Consumes;
|
import javax.ws.rs.Consumes;
|
||||||
import javax.ws.rs.GET;
|
import javax.ws.rs.GET;
|
||||||
|
@ -70,4 +71,13 @@ public interface ResourceAsyncClient {
|
||||||
@JAXBResponseParser
|
@JAXBResponseParser
|
||||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||||
ListenableFuture<ComputePoolCpuUsage> getComputePoolCpuUsage(@EndpointParam URI uri);
|
ListenableFuture<ComputePoolCpuUsage> getComputePoolCpuUsage(@EndpointParam URI uri);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see ResourceClient#getComputePoolCpuUsageDetail
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Consumes("application/vnd.tmrk.cloud.computePoolCpuUsageDetail")
|
||||||
|
@JAXBResponseParser
|
||||||
|
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||||
|
ListenableFuture<ComputePoolCpuUsageDetail> getComputePoolCpuUsageDetail(@EndpointParam URI uri);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ import org.jclouds.concurrent.Timeout;
|
||||||
import org.jclouds.tmrk.enterprisecloud.domain.resource.cpu.ComputePoolCpuUsage;
|
import org.jclouds.tmrk.enterprisecloud.domain.resource.cpu.ComputePoolCpuUsage;
|
||||||
import org.jclouds.tmrk.enterprisecloud.domain.resource.ComputePoolResourceSummary;
|
import org.jclouds.tmrk.enterprisecloud.domain.resource.ComputePoolResourceSummary;
|
||||||
import org.jclouds.tmrk.enterprisecloud.domain.resource.ComputePoolResourceSummaryList;
|
import org.jclouds.tmrk.enterprisecloud.domain.resource.ComputePoolResourceSummaryList;
|
||||||
|
import org.jclouds.tmrk.enterprisecloud.domain.resource.cpu.ComputePoolCpuUsageDetail;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
@ -42,6 +43,7 @@ public interface ResourceClient {
|
||||||
/**
|
/**
|
||||||
* The Get Resources Summary List call returns summary information regarding
|
* The Get Resources Summary List call returns summary information regarding
|
||||||
* resource utilization in the compute pools defined in an environment.
|
* resource utilization in the compute pools defined in an environment.
|
||||||
|
*
|
||||||
* @param uri the uri of the call based upon the environment
|
* @param uri the uri of the call based upon the environment
|
||||||
* e.g. /cloudapi/ecloud/computepools/environments/{id}/resourcesummarylist
|
* e.g. /cloudapi/ecloud/computepools/environments/{id}/resourcesummarylist
|
||||||
* @return the summary list
|
* @return the summary list
|
||||||
|
@ -51,6 +53,7 @@ public interface ResourceClient {
|
||||||
/**
|
/**
|
||||||
* The Get Resources Summary call returns resource summary information regarding
|
* The Get Resources Summary call returns resource summary information regarding
|
||||||
* a specified compute pool defined in an environment.
|
* a specified compute pool defined in an environment.
|
||||||
|
*
|
||||||
* @param uri the uri of the call based upon the compute pool
|
* @param uri the uri of the call based upon the compute pool
|
||||||
* e.g. /cloudapi/ecloud/computepools/{id}/resourcesummary
|
* e.g. /cloudapi/ecloud/computepools/{id}/resourcesummary
|
||||||
* @return the summary
|
* @return the summary
|
||||||
|
@ -62,10 +65,35 @@ public interface ResourceClient {
|
||||||
* defined in an environment at five minute intervals for the 24 hours ending one hour
|
* defined in an environment at five minute intervals for the 24 hours ending one hour
|
||||||
* prior to the current time, rounded later.
|
* prior to the current time, rounded later.
|
||||||
* For example, if current time is 11:22, the end time is 10:25.
|
* For example, if current time is 11:22, the end time is 10:25.
|
||||||
|
*
|
||||||
* @param uri the uri of the call based upon the compute pool
|
* @param uri the uri of the call based upon the compute pool
|
||||||
* e.g. /cloudapi/ecloud/computepools/{id}/usage/cpu
|
* e.g. /cloudapi/ecloud/computepools/{id}/usage/cpu
|
||||||
* @return The cpu usage for the compute pool
|
* @return The cpu usage for the compute pool
|
||||||
*/
|
*/
|
||||||
ComputePoolCpuUsage getComputePoolCpuUsage(URI uri);
|
ComputePoolCpuUsage getComputePoolCpuUsage(URI uri);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Get Resources Usage Processor Detail call returns information regarding processor usage
|
||||||
|
* for a specified compute pool defined in an environment at the time in the URL query part,
|
||||||
|
* a specified five minute time interval within the 24 hours ending one hour prior to
|
||||||
|
* the current time, rounded later.
|
||||||
|
* For example, if current time is 11:22, the end time 10:25.
|
||||||
|
* The response includes usage of every virtual machine during the interval.
|
||||||
|
*
|
||||||
|
* Note: The query part is required and the time passed as the parameter must
|
||||||
|
* precisely match a time in the preceding 24 hours.
|
||||||
|
*
|
||||||
|
* Times are on five minute intervals starting on the hour.
|
||||||
|
* Available times are in <Time> in the response to {@code getComputePoolCpuUsage}
|
||||||
|
* The time parameter is of the form 2011-12-05t10%3a10%3a00z
|
||||||
|
*
|
||||||
|
* Deleted is applicable and appears only when virtual machines have been removed
|
||||||
|
* subsequent to the time of the snapshot.
|
||||||
|
*
|
||||||
|
* @param uri the uri of the call based upon the compute pool and the time
|
||||||
|
* e.g. /cloudapi/ecloud/computepools/{id}/usage/cpu/details?time={time}
|
||||||
|
* @return the compute pool cpu usage detail
|
||||||
|
*/
|
||||||
|
ComputePoolCpuUsageDetail getComputePoolCpuUsageDetail(URI uri);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,6 +83,21 @@ public class ResourceAsyncClientTest extends BaseTerremarkEnterpriseCloudAsyncCl
|
||||||
checkFilters(httpRequest);
|
checkFilters(httpRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testGetComputePoolCpuUsageDetail() throws SecurityException, NoSuchMethodException, IOException, URISyntaxException {
|
||||||
|
Method method = ResourceAsyncClient.class.getMethod("getComputePoolCpuUsageDetail", URI.class);
|
||||||
|
HttpRequest httpRequest = processor.createRequest(method, URI.create("/cloudapi/ecloud/computepools/89/usage/cpu/details?time=2011-12-05t10%3a10%3a00z"));
|
||||||
|
|
||||||
|
assertRequestLineEquals(httpRequest, "GET https://services-beta.enterprisecloud.terremark.com/cloudapi/ecloud/computepools/89/usage/cpu/details?time=2011-12-05t10%3a10%3a00z HTTP/1.1");
|
||||||
|
assertNonPayloadHeadersEqual(httpRequest,
|
||||||
|
"Accept: application/vnd.tmrk.cloud.computePoolCpuUsageDetail\nx-tmrk-version: 2011-07-01\n");
|
||||||
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
assertResponseParserClassEquals(method, httpRequest, ParseXMLWithJAXB.class);
|
||||||
|
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
|
||||||
|
|
||||||
|
checkFilters(httpRequest);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected TypeLiteral<RestAnnotationProcessor<ResourceAsyncClient>> createTypeLiteral() {
|
protected TypeLiteral<RestAnnotationProcessor<ResourceAsyncClient>> createTypeLiteral() {
|
||||||
return new TypeLiteral<RestAnnotationProcessor<ResourceAsyncClient>>() {
|
return new TypeLiteral<RestAnnotationProcessor<ResourceAsyncClient>>() {
|
||||||
|
|
|
@ -18,14 +18,18 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.tmrk.enterprisecloud.features;
|
package org.jclouds.tmrk.enterprisecloud.features;
|
||||||
|
|
||||||
|
import org.jclouds.tmrk.enterprisecloud.domain.Link;
|
||||||
|
import org.jclouds.tmrk.enterprisecloud.domain.internal.ResourceCapacity;
|
||||||
import org.jclouds.tmrk.enterprisecloud.domain.resource.cpu.ComputePoolCpuUsage;
|
import org.jclouds.tmrk.enterprisecloud.domain.resource.cpu.ComputePoolCpuUsage;
|
||||||
import org.jclouds.tmrk.enterprisecloud.domain.resource.ComputePoolResourceSummary;
|
import org.jclouds.tmrk.enterprisecloud.domain.resource.ComputePoolResourceSummary;
|
||||||
import org.jclouds.tmrk.enterprisecloud.domain.resource.ComputePoolResourceSummaryList;
|
import org.jclouds.tmrk.enterprisecloud.domain.resource.ComputePoolResourceSummaryList;
|
||||||
|
import org.jclouds.tmrk.enterprisecloud.domain.resource.cpu.ComputePoolCpuUsageDetail;
|
||||||
import org.testng.annotations.BeforeGroups;
|
import org.testng.annotations.BeforeGroups;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
|
import static org.testng.Assert.assertEquals;
|
||||||
import static org.testng.Assert.assertNotNull;
|
import static org.testng.Assert.assertNotNull;
|
||||||
import static org.testng.Assert.assertNull;
|
import static org.testng.Assert.assertNull;
|
||||||
|
|
||||||
|
@ -64,10 +68,32 @@ public class ResourceClientLiveTest extends BaseTerremarkEnterpriseCloudClientLi
|
||||||
|
|
||||||
public void testGetComputePoolCpuUsage() throws Exception {
|
public void testGetComputePoolCpuUsage() throws Exception {
|
||||||
ComputePoolCpuUsage cpuUsage = client.getComputePoolCpuUsage(URI.create("/cloudapi/ecloud/computepools/89/usage/cpu"));
|
ComputePoolCpuUsage cpuUsage = client.getComputePoolCpuUsage(URI.create("/cloudapi/ecloud/computepools/89/usage/cpu"));
|
||||||
|
for(Link link: cpuUsage.getLinks()) {
|
||||||
|
//The compute pool cpu usage has a link to a detail entry
|
||||||
|
if( "application/vnd.tmrk.cloud.computePoolCpuUsageDetail".equals(link.getType())) {
|
||||||
|
testGetComputePoolCpuUsageDetail(link.getHref());
|
||||||
|
}
|
||||||
|
}
|
||||||
assertNotNull(cpuUsage);
|
assertNotNull(cpuUsage);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMissingComputePoolCpuUsage() {
|
public void testMissingComputePoolCpuUsage() {
|
||||||
assertNull(client.getComputePoolCpuUsage(URI.create("/cloudapi/ecloud/computepools/-1/usage/cpu")));
|
assertNull(client.getComputePoolCpuUsage(URI.create("/cloudapi/ecloud/computepools/-1/usage/cpu")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void testGetComputePoolCpuUsageDetail(URI uri) {
|
||||||
|
ComputePoolCpuUsageDetail detail = client.getComputePoolCpuUsageDetail(uri);
|
||||||
|
assertNotNull(detail.getTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testMissingComputePoolCpuUsageDetail() {
|
||||||
|
assertNull(client.getComputePoolCpuUsageDetail(URI.create("/cloudapi/ecloud/computepools/-1/usage/cpu/details?time=2011-12-05t10%3a10%3a00z")));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testMissingDateComputePoolCpuUsageDetail() {
|
||||||
|
ComputePoolCpuUsageDetail detail = client.getComputePoolCpuUsageDetail(URI.create("/cloudapi/ecloud/computepools/89/usage/cpu/details?time=1974-01-01t10%3a10%3a00z"));
|
||||||
|
assertNotNull(detail.getTime());
|
||||||
|
assertEquals(detail.getValue(), ResourceCapacity.builder().value(0).unit("MHz").build());
|
||||||
|
assertNull(detail.getVirtualMachinesCpuUsage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,145 @@
|
||||||
|
/**
|
||||||
|
* 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.tmrk.enterprisecloud.xml;
|
||||||
|
|
||||||
|
import com.google.common.base.Function;
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
|
import com.google.inject.AbstractModule;
|
||||||
|
import com.google.inject.Module;
|
||||||
|
import com.google.inject.Provides;
|
||||||
|
import org.jclouds.crypto.Crypto;
|
||||||
|
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
||||||
|
import org.jclouds.http.HttpRequest;
|
||||||
|
import org.jclouds.http.HttpResponse;
|
||||||
|
import org.jclouds.http.functions.ParseSax;
|
||||||
|
import org.jclouds.http.functions.ParseXMLWithJAXB;
|
||||||
|
import org.jclouds.logging.config.NullLoggingModule;
|
||||||
|
import org.jclouds.rest.AuthorizationException;
|
||||||
|
import org.jclouds.rest.BaseRestClientTest;
|
||||||
|
import org.jclouds.rest.RestContextSpec;
|
||||||
|
import org.jclouds.rest.internal.RestAnnotationProcessor;
|
||||||
|
import org.jclouds.tmrk.enterprisecloud.domain.internal.ResourceCapacity;
|
||||||
|
import org.jclouds.tmrk.enterprisecloud.domain.resource.cpu.ComputePoolCpuUsageDetail;
|
||||||
|
import org.jclouds.tmrk.enterprisecloud.domain.resource.cpu.VirtualMachineCpuUsageDetail;
|
||||||
|
import org.jclouds.tmrk.enterprisecloud.features.ResourceAsyncClient;
|
||||||
|
import org.testng.annotations.BeforeClass;
|
||||||
|
import org.testng.annotations.BeforeMethod;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import javax.inject.Named;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import static org.jclouds.io.Payloads.newInputStreamPayload;
|
||||||
|
import static org.jclouds.rest.RestContextFactory.contextSpec;
|
||||||
|
import static org.jclouds.rest.RestContextFactory.createContextBuilder;
|
||||||
|
import static org.testng.Assert.assertEquals;
|
||||||
|
import static org.testng.Assert.assertNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests behavior of JAXB parsing for ComputePoolCpuUsageDetail
|
||||||
|
*
|
||||||
|
* @author Jason King
|
||||||
|
*/
|
||||||
|
@Test(groups = "unit", testName = "ComputePoolResourceSummaryListJAXBParsingTest")
|
||||||
|
public class ComputePoolCpuUsageDetailJAXBParsingTest extends BaseRestClientTest {
|
||||||
|
|
||||||
|
private SimpleDateFormatDateService dateService;
|
||||||
|
@BeforeMethod
|
||||||
|
public void setUp() {
|
||||||
|
dateService = new SimpleDateFormatDateService();
|
||||||
|
}
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
void setupFactory() {
|
||||||
|
RestContextSpec<String, Integer> contextSpec = contextSpec("test", "http://localhost:9999", "1", "", "userfoo",
|
||||||
|
"credentialFoo", String.class, Integer.class,
|
||||||
|
ImmutableSet.<Module>of(new MockModule(), new NullLoggingModule(), new AbstractModule() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void configure() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
@Provides
|
||||||
|
@Named("exception")
|
||||||
|
Set<String> exception() {
|
||||||
|
throw new AuthorizationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
}));
|
||||||
|
|
||||||
|
injector = createContextBuilder(contextSpec).buildInjector();
|
||||||
|
parserFactory = injector.getInstance(ParseSax.Factory.class);
|
||||||
|
crypto = injector.getInstance(Crypto.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testParseWithJAXB() throws Exception {
|
||||||
|
|
||||||
|
Method method = ResourceAsyncClient.class.getMethod("getComputePoolCpuUsageDetail", URI.class);
|
||||||
|
HttpRequest request = factory(ResourceAsyncClient.class).createRequest(method,new URI("/1"));
|
||||||
|
assertResponseParserClassEquals(method, request, ParseXMLWithJAXB.class);
|
||||||
|
|
||||||
|
Function<HttpResponse, ComputePoolCpuUsageDetail> parser = (Function<HttpResponse, ComputePoolCpuUsageDetail>) RestAnnotationProcessor
|
||||||
|
.createResponseParser(parserFactory, injector, method, request);
|
||||||
|
|
||||||
|
InputStream is = getClass().getResourceAsStream("/computePoolCpuUsageDetail.xml");
|
||||||
|
ComputePoolCpuUsageDetail detail = parser.apply(new HttpResponse(200, "ok", newInputStreamPayload(is)));
|
||||||
|
|
||||||
|
assertEquals(detail.getTime(), dateService.iso8601DateParse("2011-12-05T10:10:00.0Z"));
|
||||||
|
assertEquals(detail.getValue(), ResourceCapacity.builder().value(43).unit("MHz").build());
|
||||||
|
Set<VirtualMachineCpuUsageDetail> virtualMachinesCpuUsageDetail = detail.getVirtualMachinesCpuUsage().getVirtualMachinesCpuUsageDetail();
|
||||||
|
assertDetail(virtualMachinesCpuUsageDetail);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testParseNoDetailWithJAXB() throws Exception {
|
||||||
|
|
||||||
|
Method method = ResourceAsyncClient.class.getMethod("getComputePoolCpuUsageDetail", URI.class);
|
||||||
|
HttpRequest request = factory(ResourceAsyncClient.class).createRequest(method,new URI("/1"));
|
||||||
|
assertResponseParserClassEquals(method, request, ParseXMLWithJAXB.class);
|
||||||
|
|
||||||
|
Function<HttpResponse, ComputePoolCpuUsageDetail> parser = (Function<HttpResponse, ComputePoolCpuUsageDetail>) RestAnnotationProcessor
|
||||||
|
.createResponseParser(parserFactory, injector, method, request);
|
||||||
|
|
||||||
|
InputStream is = getClass().getResourceAsStream("/computePoolCpuUsageDetailNoDetail.xml");
|
||||||
|
ComputePoolCpuUsageDetail detail = parser.apply(new HttpResponse(200, "ok", newInputStreamPayload(is)));
|
||||||
|
|
||||||
|
assertEquals(detail.getTime(), dateService.iso8601DateParse("1974-12-05T10:10:00.0Z"));
|
||||||
|
assertEquals(detail.getValue(), ResourceCapacity.builder().value(0).unit("MHz").build());
|
||||||
|
assertNull(detail.getVirtualMachinesCpuUsage());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void assertDetail(Set<VirtualMachineCpuUsageDetail> details) {
|
||||||
|
assertEquals(details.size(),1);
|
||||||
|
VirtualMachineCpuUsageDetail detail = Iterables.getOnlyElement(details);
|
||||||
|
VirtualMachineCpuUsageDetail expected = VirtualMachineCpuUsageDetail.builder()
|
||||||
|
.href(URI.create("/cloudapi/ecloud/virtualmachines/5504"))
|
||||||
|
.name("helloworld")
|
||||||
|
.type("application/vnd.tmrk.cloud.virtualMachine")
|
||||||
|
.usage(ResourceCapacity.builder().value(43).unit("MHz").build())
|
||||||
|
.utilization(2)
|
||||||
|
.build();
|
||||||
|
assertEquals(detail,expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
<ComputePoolCpuUsageDetail
|
||||||
|
href="/cloudapi/ecloud/computepools/89/usage/cpu/details?time=2011-12-05t10%3a10%3a00z"
|
||||||
|
type="application/vnd.tmrk.cloud.computePoolCpuUsageDetail"
|
||||||
|
xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<Links>
|
||||||
|
<Link href="/cloudapi/ecloud/computepools/89"
|
||||||
|
name="Default Compute Pool"
|
||||||
|
type="application/vnd.tmrk.cloud.computePool" rel="up"/>
|
||||||
|
<Link href="/cloudapi/ecloud/computepools/89/usage/cpu"
|
||||||
|
type="application/vnd.tmrk.cloud.computePoolCpuUsage" rel="up"/>
|
||||||
|
</Links>
|
||||||
|
<Time>2011-12-05T10:10:00Z</Time>
|
||||||
|
<Value>
|
||||||
|
<Unit>MHz</Unit>
|
||||||
|
<Value>43</Value>
|
||||||
|
</Value>
|
||||||
|
<VirtualMachines>
|
||||||
|
<VirtualMachine href="/cloudapi/ecloud/virtualmachines/5504"
|
||||||
|
name="helloworld"
|
||||||
|
type="application/vnd.tmrk.cloud.virtualMachine">
|
||||||
|
<Usage>
|
||||||
|
<Unit>MHz</Unit>
|
||||||
|
<Value>43</Value>
|
||||||
|
</Usage>
|
||||||
|
<Utilization>2</Utilization>
|
||||||
|
</VirtualMachine>
|
||||||
|
</VirtualMachines>
|
||||||
|
</ComputePoolCpuUsageDetail>
|
|
@ -0,0 +1,17 @@
|
||||||
|
<ComputePoolCpuUsageDetail
|
||||||
|
href="/cloudapi/ecloud/computepools/89/usage/cpu/details?time=1974-12-05t10%3a10%3a00z"
|
||||||
|
type="application/vnd.tmrk.cloud.computePoolCpuUsageDetail"
|
||||||
|
xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<Links>
|
||||||
|
<Link href="/cloudapi/ecloud/computepools/89"
|
||||||
|
name="Default Compute Pool"
|
||||||
|
type="application/vnd.tmrk.cloud.computePool" rel="up"/>
|
||||||
|
<Link href="/cloudapi/ecloud/computepools/89/usage/cpu"
|
||||||
|
type="application/vnd.tmrk.cloud.computePoolCpuUsage" rel="up"/>
|
||||||
|
</Links>
|
||||||
|
<Time>1974-12-05T10:10:00Z</Time>
|
||||||
|
<Value>
|
||||||
|
<Unit>MHz</Unit>
|
||||||
|
<Value>0</Value>
|
||||||
|
</Value>
|
||||||
|
</ComputePoolCpuUsageDetail>
|
Loading…
Reference in New Issue