mirror of https://github.com/apache/jclouds.git
Issue 695: Added ComputePoolMemoryUsageDetail objects+service calls+tests
This commit is contained in:
parent
e6a9580ffd
commit
be93927f45
|
@ -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.memory;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ComputePoolMemoryUsageDetail is more than a simple wrapper as it extends Resource.
|
||||||
|
* <xs:complexType name="ComputePoolMemoryUsageDetail">
|
||||||
|
* @author Jason King
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@XmlRootElement(name = "ComputePoolMemoryUsageDetail")
|
||||||
|
public class ComputePoolMemoryUsageDetail extends Resource<ComputePoolMemoryUsageDetail> {
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static Builder builder() {
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Builder toBuilder() {
|
||||||
|
return new Builder().fromComputePoolMemoryUsage(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder extends Resource.Builder<ComputePoolMemoryUsageDetail> {
|
||||||
|
private Date time;
|
||||||
|
private ResourceCapacity value;
|
||||||
|
private VirtualMachinesMemoryUsage virtualMachinesMemoryUsage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see ComputePoolMemoryUsageDetail#getTime
|
||||||
|
*/
|
||||||
|
public Builder time(Date time) {
|
||||||
|
this.time =(checkNotNull(time,"time"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see ComputePoolMemoryUsageDetail#getValue
|
||||||
|
*/
|
||||||
|
public Builder value(ResourceCapacity value) {
|
||||||
|
this.value =(checkNotNull(value,"value"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see ComputePoolMemoryUsageDetail#getVirtualMachinesMemoryUsage
|
||||||
|
*/
|
||||||
|
public Builder virtualMachines(VirtualMachinesMemoryUsage virtualMachinesMemoryUsage) {
|
||||||
|
this.virtualMachinesMemoryUsage =(checkNotNull(virtualMachinesMemoryUsage,"virtualMachinesMemoryUsage"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ComputePoolMemoryUsageDetail build() {
|
||||||
|
return new ComputePoolMemoryUsageDetail(href, type, name, links, actions, time, value, virtualMachinesMemoryUsage);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder fromComputePoolMemoryUsage(ComputePoolMemoryUsageDetail in) {
|
||||||
|
return fromResource(in).time(in.getTime()).value(in.getValue()).virtualMachines(in.getVirtualMachinesMemoryUsage());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Builder fromBaseResource(BaseResource<ComputePoolMemoryUsageDetail> in) {
|
||||||
|
return Builder.class.cast(super.fromBaseResource(in));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Builder fromResource(Resource<ComputePoolMemoryUsageDetail> 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 VirtualMachinesMemoryUsage virtualMachinesMemoryUsage;
|
||||||
|
|
||||||
|
private ComputePoolMemoryUsageDetail(URI href, String type, String name, Set<Link> links, Set<Action> actions, Date time, @Nullable ResourceCapacity value, @Nullable VirtualMachinesMemoryUsage virtualMachinesMemoryUsage) {
|
||||||
|
super(href, type, name, links, actions);
|
||||||
|
this.time = checkNotNull(time, "time");
|
||||||
|
this.value = value;
|
||||||
|
this.virtualMachinesMemoryUsage = virtualMachinesMemoryUsage;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ComputePoolMemoryUsageDetail() {
|
||||||
|
//For JAXB
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getTime() {
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResourceCapacity getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VirtualMachinesMemoryUsage getVirtualMachinesMemoryUsage() {
|
||||||
|
return virtualMachinesMemoryUsage;
|
||||||
|
}
|
||||||
|
|
||||||
|
@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;
|
||||||
|
|
||||||
|
ComputePoolMemoryUsageDetail that = (ComputePoolMemoryUsageDetail) o;
|
||||||
|
|
||||||
|
if (!time.equals(that.time)) return false;
|
||||||
|
if (value != null ? !value.equals(that.value) : that.value != null)
|
||||||
|
return false;
|
||||||
|
if (virtualMachinesMemoryUsage != null ? !virtualMachinesMemoryUsage.equals(that.virtualMachinesMemoryUsage) : that.virtualMachinesMemoryUsage != 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 + (virtualMachinesMemoryUsage != null ? virtualMachinesMemoryUsage.hashCode() : 0);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String string() {
|
||||||
|
return super.string()+", time="+ time +", value="+value+", virtualMachinesMemoryUsage="+ virtualMachinesMemoryUsage;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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.memory;
|
||||||
|
|
||||||
|
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="VirtualMachineMemoryUsageDetail">
|
||||||
|
* @author Jason King
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class VirtualMachineMemoryUsageDetail extends BaseNamedResource<VirtualMachineMemoryUsageDetail> {
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static Builder builder() {
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Builder toBuilder() {
|
||||||
|
return new Builder().fromVirtualMachineMemoryUsageDetail(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder extends BaseNamedResource.Builder<VirtualMachineMemoryUsageDetail> {
|
||||||
|
private ResourceCapacity usage;
|
||||||
|
private int utilization;
|
||||||
|
private boolean deleted;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see VirtualMachineMemoryUsageDetail#getUsage
|
||||||
|
*/
|
||||||
|
public Builder usage(ResourceCapacity usage) {
|
||||||
|
this.usage = usage;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see VirtualMachineMemoryUsageDetail#getUtilization
|
||||||
|
*/
|
||||||
|
public Builder utilization(int utilization) {
|
||||||
|
this.utilization = utilization;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see VirtualMachineMemoryUsageDetail#isDeleted
|
||||||
|
*/
|
||||||
|
public Builder deleted(boolean deleted) {
|
||||||
|
this.deleted = deleted;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VirtualMachineMemoryUsageDetail build() {
|
||||||
|
return new VirtualMachineMemoryUsageDetail(href, type, name, usage, utilization, deleted);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder fromVirtualMachineMemoryUsageDetail(VirtualMachineMemoryUsageDetail in) {
|
||||||
|
return fromNamedResource(in).usage(in.getUsage());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Builder fromBaseResource(BaseResource<VirtualMachineMemoryUsageDetail> in) {
|
||||||
|
return Builder.class.cast(super.fromBaseResource(in));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Builder fromNamedResource(BaseNamedResource<VirtualMachineMemoryUsageDetail> 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 VirtualMachineMemoryUsageDetail(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 VirtualMachineMemoryUsageDetail() {
|
||||||
|
//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;
|
||||||
|
|
||||||
|
VirtualMachineMemoryUsageDetail that = (VirtualMachineMemoryUsageDetail) 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.memory;
|
||||||
|
|
||||||
|
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 VirtualMachineMemoryUsageDetail elements.
|
||||||
|
* <xs:complexType name="MemoryUsage_VirtualMachines">
|
||||||
|
* @author Jason King
|
||||||
|
*/
|
||||||
|
public class VirtualMachinesMemoryUsage {
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static Builder builder() {
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder toBuilder() {
|
||||||
|
return new Builder().fromMemoryUsageDetails(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
|
||||||
|
private Set<VirtualMachineMemoryUsageDetail> virtualMachinesMemoryUsageDetail = Sets.newLinkedHashSet();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see VirtualMachinesMemoryUsage#getVirtualMachinesMemoryUsageDetail
|
||||||
|
*/
|
||||||
|
public Builder vmMemoryUsageDetails(Set<VirtualMachineMemoryUsageDetail> vmMemoryUsageDetails) {
|
||||||
|
this.virtualMachinesMemoryUsageDetail = Sets.newLinkedHashSet(checkNotNull(vmMemoryUsageDetails, "vmMemoryUsageDetails"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder addVmMemoryUsageDetail(VirtualMachineMemoryUsageDetail vmMemoryUsageDetail) {
|
||||||
|
virtualMachinesMemoryUsageDetail.add(checkNotNull(vmMemoryUsageDetail,"vmMemoryUsageDetail"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VirtualMachinesMemoryUsage build() {
|
||||||
|
return new VirtualMachinesMemoryUsage(virtualMachinesMemoryUsageDetail);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder fromMemoryUsageDetails(VirtualMachinesMemoryUsage in) {
|
||||||
|
return vmMemoryUsageDetails(in.getVirtualMachinesMemoryUsageDetail());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private VirtualMachinesMemoryUsage() {
|
||||||
|
//For JAXB and builder use
|
||||||
|
}
|
||||||
|
|
||||||
|
private VirtualMachinesMemoryUsage(Set<VirtualMachineMemoryUsageDetail> virtualMachinesMemoryUsageDetail) {
|
||||||
|
this.virtualMachinesMemoryUsageDetail = Sets.newLinkedHashSet(virtualMachinesMemoryUsageDetail);
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "VirtualMachine", required=false)
|
||||||
|
private Set<VirtualMachineMemoryUsageDetail> virtualMachinesMemoryUsageDetail = Sets.newLinkedHashSet();
|
||||||
|
|
||||||
|
public Set<VirtualMachineMemoryUsageDetail> getVirtualMachinesMemoryUsageDetail() {
|
||||||
|
return Collections.unmodifiableSet(virtualMachinesMemoryUsageDetail);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
|
VirtualMachinesMemoryUsage that = (VirtualMachinesMemoryUsage) o;
|
||||||
|
|
||||||
|
if (virtualMachinesMemoryUsageDetail != null ? !virtualMachinesMemoryUsageDetail.equals(that.virtualMachinesMemoryUsageDetail) : that.virtualMachinesMemoryUsageDetail != null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return virtualMachinesMemoryUsageDetail != null ? virtualMachinesMemoryUsageDetail.hashCode() : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return "["+ virtualMachinesMemoryUsageDetail.toString()+"]";
|
||||||
|
}
|
||||||
|
}
|
|
@ -27,6 +27,7 @@ import org.jclouds.tmrk.enterprisecloud.domain.resource.ComputePoolResourceSumma
|
||||||
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.jclouds.tmrk.enterprisecloud.domain.resource.cpu.ComputePoolCpuUsageDetail;
|
||||||
import org.jclouds.tmrk.enterprisecloud.domain.resource.memory.ComputePoolMemoryUsage;
|
import org.jclouds.tmrk.enterprisecloud.domain.resource.memory.ComputePoolMemoryUsage;
|
||||||
|
import org.jclouds.tmrk.enterprisecloud.domain.resource.memory.ComputePoolMemoryUsageDetail;
|
||||||
|
|
||||||
import javax.ws.rs.Consumes;
|
import javax.ws.rs.Consumes;
|
||||||
import javax.ws.rs.GET;
|
import javax.ws.rs.GET;
|
||||||
|
@ -90,4 +91,13 @@ public interface ResourceAsyncClient {
|
||||||
@JAXBResponseParser
|
@JAXBResponseParser
|
||||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||||
ListenableFuture<ComputePoolMemoryUsage> getComputePoolMemoryUsage(@EndpointParam URI uri);
|
ListenableFuture<ComputePoolMemoryUsage> getComputePoolMemoryUsage(@EndpointParam URI uri);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see ResourceClient#getComputePoolMemoryUsageDetail
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Consumes("application/vnd.tmrk.cloud.computePoolMemoryUsageDetail")
|
||||||
|
@JAXBResponseParser
|
||||||
|
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||||
|
ListenableFuture<ComputePoolMemoryUsageDetail> getComputePoolMemoryUsageDetail(@EndpointParam URI uri);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.jclouds.tmrk.enterprisecloud.domain.resource.ComputePoolResourceSumma
|
||||||
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.jclouds.tmrk.enterprisecloud.domain.resource.cpu.ComputePoolCpuUsageDetail;
|
||||||
import org.jclouds.tmrk.enterprisecloud.domain.resource.memory.ComputePoolMemoryUsage;
|
import org.jclouds.tmrk.enterprisecloud.domain.resource.memory.ComputePoolMemoryUsage;
|
||||||
|
import org.jclouds.tmrk.enterprisecloud.domain.resource.memory.ComputePoolMemoryUsageDetail;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
@ -78,14 +79,14 @@ public interface ResourceClient {
|
||||||
* for a specified compute pool defined in an environment at the time in the URL query part,
|
* 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
|
* a specified five minute time interval within the 24 hours ending one hour prior to
|
||||||
* the current time, rounded later.
|
* the current time, rounded later.
|
||||||
* For example, if current time is 11:22, the end time 10:25.
|
* For example, if current time is 11:22, the end time is 10:25.
|
||||||
* The response includes usage of every virtual machine during the interval.
|
* 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
|
* Note: The query part is required and the time passed as the parameter must
|
||||||
* precisely match a time in the preceding 24 hours.
|
* precisely match a time in the preceding 24 hours.
|
||||||
*
|
*
|
||||||
* Times are on five minute intervals starting on the hour.
|
* Times are on five minute intervals starting on the hour.
|
||||||
* Available times are in <Time> in the response to {@code getComputePoolCpuUsage}
|
* Available times are in Time in the response to {@code getComputePoolCpuUsage}
|
||||||
* The time parameter is of the form 2011-12-05t10%3a10%3a00z
|
* The time parameter is of the form 2011-12-05t10%3a10%3a00z
|
||||||
*
|
*
|
||||||
* Deleted is applicable and appears only when virtual machines have been removed
|
* Deleted is applicable and appears only when virtual machines have been removed
|
||||||
|
@ -109,4 +110,25 @@ public interface ResourceClient {
|
||||||
*/
|
*/
|
||||||
ComputePoolMemoryUsage getComputePoolMemoryUsage(URI uri);
|
ComputePoolMemoryUsage getComputePoolMemoryUsage(URI uri);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Get Resources Usage Memory Detail call returns information regarding memory 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 is 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 getComputePoolMemoryUsage}.
|
||||||
|
*
|
||||||
|
* Deleted is applicable and appears only when virtual machine 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/memory/details?time={time}
|
||||||
|
* @return the compute pool memory usage detail
|
||||||
|
*/
|
||||||
|
ComputePoolMemoryUsageDetail getComputePoolMemoryUsageDetail(URI uri);
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,6 +113,21 @@ public class ResourceAsyncClientTest extends BaseTerremarkEnterpriseCloudAsyncCl
|
||||||
checkFilters(httpRequest);
|
checkFilters(httpRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testGetComputePoolMemoryUsageDetail() throws SecurityException, NoSuchMethodException, IOException, URISyntaxException {
|
||||||
|
Method method = ResourceAsyncClient.class.getMethod("getComputePoolMemoryUsageDetail", URI.class);
|
||||||
|
HttpRequest httpRequest = processor.createRequest(method, URI.create("/cloudapi/ecloud/computepools/89/usage/memory/details?time=2011-12-05t10%3a10%3a00z"));
|
||||||
|
|
||||||
|
assertRequestLineEquals(httpRequest, "GET https://services-beta.enterprisecloud.terremark.com/cloudapi/ecloud/computepools/89/usage/memory/details?time=2011-12-05t10%3a10%3a00z HTTP/1.1");
|
||||||
|
assertNonPayloadHeadersEqual(httpRequest,
|
||||||
|
"Accept: application/vnd.tmrk.cloud.computePoolMemoryUsageDetail\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>>() {
|
||||||
|
|
|
@ -25,6 +25,7 @@ import org.jclouds.tmrk.enterprisecloud.domain.resource.ComputePoolResourceSumma
|
||||||
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.jclouds.tmrk.enterprisecloud.domain.resource.cpu.ComputePoolCpuUsageDetail;
|
||||||
import org.jclouds.tmrk.enterprisecloud.domain.resource.memory.ComputePoolMemoryUsage;
|
import org.jclouds.tmrk.enterprisecloud.domain.resource.memory.ComputePoolMemoryUsage;
|
||||||
|
import org.jclouds.tmrk.enterprisecloud.domain.resource.memory.ComputePoolMemoryUsageDetail;
|
||||||
import org.testng.annotations.BeforeGroups;
|
import org.testng.annotations.BeforeGroups;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@ -110,7 +111,7 @@ public class ResourceClientLiveTest extends BaseTerremarkEnterpriseCloudClientLi
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testGetComputePoolMemoryUsageDetail(URI uri) {
|
private void testGetComputePoolMemoryUsageDetail(URI uri) {
|
||||||
// ComputePoolMemoryUsageDetail detail = client.getComputePoolMemoryUsageDetail(uri);
|
ComputePoolMemoryUsageDetail detail = client.getComputePoolMemoryUsageDetail(uri);
|
||||||
// assertNotNull(detail.getTime());
|
assertNotNull(detail.getTime());
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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.memory.ComputePoolMemoryUsageDetail;
|
||||||
|
import org.jclouds.tmrk.enterprisecloud.domain.resource.memory.VirtualMachineMemoryUsageDetail;
|
||||||
|
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 ComputePoolMemoryUsageDetail
|
||||||
|
*
|
||||||
|
* @author Jason King
|
||||||
|
*/
|
||||||
|
@Test(groups = "unit", testName = "ComputePoolResourceSummaryListJAXBParsingTest")
|
||||||
|
public class ComputePoolMemoryUsageDetailJAXBParsingTest 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("getComputePoolMemoryUsageDetail", URI.class);
|
||||||
|
HttpRequest request = factory(ResourceAsyncClient.class).createRequest(method,new URI("/1"));
|
||||||
|
assertResponseParserClassEquals(method, request, ParseXMLWithJAXB.class);
|
||||||
|
|
||||||
|
Function<HttpResponse, ComputePoolMemoryUsageDetail> parser = (Function<HttpResponse, ComputePoolMemoryUsageDetail>) RestAnnotationProcessor
|
||||||
|
.createResponseParser(parserFactory, injector, method, request);
|
||||||
|
|
||||||
|
InputStream is = getClass().getResourceAsStream("/computePoolMemoryUsageDetail.xml");
|
||||||
|
ComputePoolMemoryUsageDetail detail = parser.apply(new HttpResponse(200, "ok", newInputStreamPayload(is)));
|
||||||
|
|
||||||
|
assertEquals(detail.getTime(), dateService.iso8601DateParse("2011-12-05T15:55:00.0Z"));
|
||||||
|
assertEquals(detail.getValue(), ResourceCapacity.builder().value(404).unit("MB").build());
|
||||||
|
Set<VirtualMachineMemoryUsageDetail> virtualMachinesMemoryUsageDetail = detail.getVirtualMachinesMemoryUsage().getVirtualMachinesMemoryUsageDetail();
|
||||||
|
assertDetail(virtualMachinesMemoryUsageDetail);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testParseNoDetailWithJAXB() throws Exception {
|
||||||
|
|
||||||
|
Method method = ResourceAsyncClient.class.getMethod("getComputePoolMemoryUsageDetail", URI.class);
|
||||||
|
HttpRequest request = factory(ResourceAsyncClient.class).createRequest(method,new URI("/1"));
|
||||||
|
assertResponseParserClassEquals(method, request, ParseXMLWithJAXB.class);
|
||||||
|
|
||||||
|
Function<HttpResponse, ComputePoolMemoryUsageDetail> parser = (Function<HttpResponse, ComputePoolMemoryUsageDetail>) RestAnnotationProcessor
|
||||||
|
.createResponseParser(parserFactory, injector, method, request);
|
||||||
|
|
||||||
|
InputStream is = getClass().getResourceAsStream("/computePoolMemoryUsageDetailNoDetail.xml");
|
||||||
|
ComputePoolMemoryUsageDetail detail = parser.apply(new HttpResponse(200, "ok", newInputStreamPayload(is)));
|
||||||
|
|
||||||
|
assertEquals(detail.getTime(), dateService.iso8601DateParse("1974-12-05T15:55:00.0Z"));
|
||||||
|
assertEquals(detail.getValue(), ResourceCapacity.builder().value(0).unit("MB").build());
|
||||||
|
assertNull(detail.getVirtualMachinesMemoryUsage());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void assertDetail(Set<VirtualMachineMemoryUsageDetail> details) {
|
||||||
|
assertEquals(details.size(),1);
|
||||||
|
VirtualMachineMemoryUsageDetail detail = Iterables.getOnlyElement(details);
|
||||||
|
VirtualMachineMemoryUsageDetail expected = VirtualMachineMemoryUsageDetail.builder()
|
||||||
|
.href(URI.create("/cloudapi/ecloud/virtualmachines/5504"))
|
||||||
|
.name("helloworld")
|
||||||
|
.type("application/vnd.tmrk.cloud.virtualMachine")
|
||||||
|
.usage(ResourceCapacity.builder().value(404).unit("MB").build())
|
||||||
|
.utilization(100)
|
||||||
|
.build();
|
||||||
|
assertEquals(detail,expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
<ComputePoolMemoryUsageDetail
|
||||||
|
href="/cloudapi/ecloud/computepools/89/usage/memory/details?time=2011-12-05t15%3a55%3a00z"
|
||||||
|
type="application/vnd.tmrk.cloud.computePoolMemoryUsageDetail"
|
||||||
|
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/memory"
|
||||||
|
type="application/vnd.tmrk.cloud.computePoolMemoryUsage"
|
||||||
|
rel="up"/>
|
||||||
|
</Links>
|
||||||
|
<Time>2011-12-05T15:55:00Z</Time>
|
||||||
|
<Value>
|
||||||
|
<Unit>MB</Unit>
|
||||||
|
<Value>404</Value>
|
||||||
|
</Value>
|
||||||
|
<VirtualMachines>
|
||||||
|
<VirtualMachine href="/cloudapi/ecloud/virtualmachines/5504"
|
||||||
|
name="helloworld"
|
||||||
|
type="application/vnd.tmrk.cloud.virtualMachine">
|
||||||
|
<Usage>
|
||||||
|
<Unit>MB</Unit>
|
||||||
|
<Value>404</Value>
|
||||||
|
</Usage>
|
||||||
|
<Utilization>100</Utilization>
|
||||||
|
</VirtualMachine>
|
||||||
|
</VirtualMachines>
|
||||||
|
</ComputePoolMemoryUsageDetail>
|
|
@ -0,0 +1,18 @@
|
||||||
|
<ComputePoolMemoryUsageDetail
|
||||||
|
href="/cloudapi/ecloud/computepools/89/usage/memory/details?time=1974-12-05t15%3a55%3a00z"
|
||||||
|
type="application/vnd.tmrk.cloud.computePoolMemoryUsageDetail"
|
||||||
|
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/memory"
|
||||||
|
type="application/vnd.tmrk.cloud.computePoolMemoryUsage"
|
||||||
|
rel="up"/>
|
||||||
|
</Links>
|
||||||
|
<Time>1974-12-05T15:55:00Z</Time>
|
||||||
|
<Value>
|
||||||
|
<Unit>MB</Unit>
|
||||||
|
<Value>0</Value>
|
||||||
|
</Value>
|
||||||
|
</ComputePoolMemoryUsageDetail>
|
Loading…
Reference in New Issue