mirror of https://github.com/apache/jclouds.git
AS per JCLOUDS-1012 project and projectId parameters are not supported. This commits adds the 2 parameters to the usage response.
This commit is contained in:
parent
99c5b9ace7
commit
ef816119b1
|
@ -114,6 +114,8 @@ public class UsageRecord {
|
|||
protected Long size;
|
||||
protected String type;
|
||||
protected UsageType usageType;
|
||||
protected String project;
|
||||
protected String projectId;
|
||||
|
||||
/**
|
||||
* @see UsageRecord#getId()
|
||||
|
@ -283,10 +285,25 @@ public class UsageRecord {
|
|||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see UsageRecord#getProject()
|
||||
*/
|
||||
public T project(String project) {
|
||||
this.project = project;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see UsageRecord#getProjectId()
|
||||
*/
|
||||
public T projectId(String projectId) {
|
||||
this.projectId = projectId;
|
||||
return self();
|
||||
}
|
||||
public UsageRecord build() {
|
||||
return new UsageRecord(id, description, accountId, accountName, domainId, startDate, endDate, assignDate, releaseDate,
|
||||
zoneId, virtualMachineId, virtualMachineName, serviceOfferingId, templateId, ipAddress, isSourceNAT, rawUsageHours,
|
||||
usage, size, type, usageType);
|
||||
usage, size, type, usageType, project, projectId);
|
||||
}
|
||||
|
||||
public T fromUsageRecord(UsageRecord in) {
|
||||
|
@ -311,7 +328,9 @@ public class UsageRecord {
|
|||
.usage(in.getUsage())
|
||||
.size(in.getSize())
|
||||
.type(in.getType())
|
||||
.usageType(in.getUsageType());
|
||||
.usageType(in.getUsageType())
|
||||
.project(in.getProject())
|
||||
.projectId(in.getProjectId());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -343,18 +362,20 @@ public class UsageRecord {
|
|||
private final Long size;
|
||||
private final String type;
|
||||
private final UsageType usageType;
|
||||
private final String project;
|
||||
private final String projectId;
|
||||
|
||||
@ConstructorProperties({
|
||||
"usageid", "description", "accountid", "account", "domainid", "startdate", "enddate", "assigndate", "releasedate",
|
||||
"zoneid", "virtualmachineid", "name", "offeringid", "templateid", "ipaddress", "issourcenat", "rawusage", "usage",
|
||||
"size", "type", "usagetype"
|
||||
"size", "type", "usagetype", "project", "projectId"
|
||||
})
|
||||
protected UsageRecord(String id, @Nullable String description, @Nullable String accountId, @Nullable String accountName,
|
||||
@Nullable String domainId, @Nullable Date startDate, @Nullable Date endDate, @Nullable Date assignDate,
|
||||
@Nullable String releaseDate, @Nullable String zoneId, @Nullable String virtualMachineId, @Nullable String virtualMachineName,
|
||||
@Nullable String serviceOfferingId, @Nullable String templateId, @Nullable String ipAddress,
|
||||
boolean isSourceNAT, double rawUsageHours, @Nullable String usage, @Nullable Long size,
|
||||
@Nullable String type, @Nullable UsageType usageType) {
|
||||
@Nullable String type, @Nullable UsageType usageType, @Nullable String project, @Nullable String projectId) {
|
||||
this.id = id;
|
||||
this.description = description;
|
||||
this.accountId = accountId;
|
||||
|
@ -376,6 +397,8 @@ public class UsageRecord {
|
|||
this.size = size;
|
||||
this.type = type;
|
||||
this.usageType = usageType;
|
||||
this.project = project;
|
||||
this.projectId = projectId;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
|
@ -478,12 +501,22 @@ public class UsageRecord {
|
|||
public UsageType getUsageType() {
|
||||
return this.usageType;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getProject() {
|
||||
return this.project;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getProjectId() {
|
||||
return this.projectId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(id, description, accountId, accountName, domainId, startDate, endDate, assignDate, releaseDate,
|
||||
zoneId, virtualMachineId, virtualMachineName, serviceOfferingId, templateId, ipAddress, isSourceNAT, rawUsageHours,
|
||||
size, usage, type, usageType);
|
||||
size, usage, type, usageType, project, projectId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -511,7 +544,9 @@ public class UsageRecord {
|
|||
&& Objects.equal(this.usage, that.usage)
|
||||
&& Objects.equal(this.size, that.size)
|
||||
&& Objects.equal(this.type, that.type)
|
||||
&& Objects.equal(this.usageType, that.usageType);
|
||||
&& Objects.equal(this.usageType, that.usageType)
|
||||
&& Objects.equal(this.project, that.project)
|
||||
&& Objects.equal(this.projectId, that.projectId);
|
||||
}
|
||||
|
||||
protected ToStringHelper string() {
|
||||
|
@ -521,7 +556,7 @@ public class UsageRecord {
|
|||
.add("releaseDate", releaseDate).add("zoneId", zoneId).add("virtualMachineId", virtualMachineId)
|
||||
.add("virtualMachineName", virtualMachineName).add("serviceOfferingId", serviceOfferingId).add("templateId", templateId)
|
||||
.add("ipAddress", ipAddress).add("isSourceNAT", isSourceNAT).add("rawUsageHours", rawUsageHours).add("usage", usage)
|
||||
.add("size", size).add("type", type).add("usageType", usageType);
|
||||
.add("size", size).add("type", type).add("usageType", usageType).add("project", project).add("projectId", projectId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -60,7 +60,7 @@ public class ListUsageRecordsResponseTest extends BaseSetParserTest<UsageRecord>
|
|||
.accountName("admin").accountId("2").domainId("1").zoneId("1")
|
||||
.description("Template Id:203 Size:3117171712")
|
||||
.usage("24 Hrs").usageType(UsageRecord.UsageType.TEMPLATE).rawUsageHours(24)
|
||||
.size(3117171712l).templateId("0").id("203")
|
||||
.size(3117171712l).templateId("0").id("203").project("project1").projectId("1")
|
||||
.startDate(start).endDate(end).build());
|
||||
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{ "listusagerecordsresponse" : { "count":1 ,"usagerecord" : [ {"account":"admin","accountid":2,"domainid":1,"zoneid":1,"description":"Template Id:203 Size:3117171712","usage":"24 Hrs","usagetype":7,"rawusage":"24","templateid":0,"usageid":203,"size":3117171712,"startdate":"2011-12-15'T'00:00:00+00:00","enddate":"2011-12-15'T'23:59:59+00:00"} ] } }
|
||||
{ "listusagerecordsresponse" : { "count":1 ,"usagerecord" : [ {"account":"admin","accountid":2,"domainid":1,"zoneid":1,"description":"Template Id:203 Size:3117171712","usage":"24 Hrs","usagetype":7,"rawusage":"24","templateid":0,"usageid":203,"size":3117171712,"project":"project1","projectId":1,"startdate":"2011-12-15'T'00:00:00+00:00","enddate":"2011-12-15'T'23:59:59+00:00"} ] } }
|
Loading…
Reference in New Issue