Skip to content

Commit 2e7a251

Browse files
author
Henrique Sato
committed
Address Vishesh review
1 parent 0855298 commit 2e7a251

File tree

9 files changed

+39
-7
lines changed

9 files changed

+39
-7
lines changed

api/src/main/java/com/cloud/event/EventTypes.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.apache.cloudstack.api.response.ZoneResponse;
3030
import org.apache.cloudstack.config.Configuration;
3131
import org.apache.cloudstack.ha.HAConfig;
32+
import org.apache.cloudstack.quota.QuotaTariff;
3233
import org.apache.cloudstack.storage.object.Bucket;
3334
import org.apache.cloudstack.storage.object.ObjectStore;
3435
import org.apache.cloudstack.usage.Usage;
@@ -1182,9 +1183,9 @@ public class EventTypes {
11821183
entityEventDetails.put(EVENT_BUCKET_DELETE, Bucket.class);
11831184

11841185
// Quota
1185-
entityEventDetails.put(EVENT_QUOTA_TARIFF_CREATE, "QuotaTariff");
1186-
entityEventDetails.put(EVENT_QUOTA_TARIFF_DELETE, "QuotaTariff");
1187-
entityEventDetails.put(EVENT_QUOTA_TARIFF_UPDATE, "QuotaTariff");
1186+
entityEventDetails.put(EVENT_QUOTA_TARIFF_CREATE, QuotaTariff.class);
1187+
entityEventDetails.put(EVENT_QUOTA_TARIFF_DELETE, QuotaTariff.class);
1188+
entityEventDetails.put(EVENT_QUOTA_TARIFF_UPDATE, QuotaTariff.class);
11881189
}
11891190

11901191
public static String getEntityForEvent(String eventName) {

api/src/main/java/org/apache/cloudstack/api/ApiCommandResourceType.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ public enum ApiCommandResourceType {
8080
VpnCustomerGateway(com.cloud.network.Site2SiteCustomerGateway.class),
8181
ManagementServer(org.apache.cloudstack.management.ManagementServerHost.class),
8282
ObjectStore(org.apache.cloudstack.storage.object.ObjectStore.class),
83-
Bucket(org.apache.cloudstack.storage.object.Bucket.class);
83+
Bucket(org.apache.cloudstack.storage.object.Bucket.class),
84+
QuotaTariff(org.apache.cloudstack.quota.QuotaTariff.class);
8485

8586
private final Class<?> clazz;
8687

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package org.apache.cloudstack.quota;
2+
3+
import org.apache.cloudstack.api.InternalIdentity;
4+
5+
public interface QuotaTariff extends InternalIdentity {
6+
7+
}

framework/quota/src/main/java/org/apache/cloudstack/quota/dao/QuotaTariffDaoImpl.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,4 +231,9 @@ public QuotaTariffVO findByUuid(String uuid) {
231231

232232
return quotaTariffs.get(0);
233233
}
234+
235+
@Override
236+
public QuotaTariffVO findByIdIncludingRemoved(Long id) {
237+
return Transaction.execute(TransactionLegacy.USAGE_DB, (TransactionCallback<QuotaTariffVO>) status -> super.findByIdIncludingRemoved(id));
238+
}
234239
}

framework/quota/src/main/java/org/apache/cloudstack/quota/vo/QuotaTariffVO.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
//under the License.
1717
package org.apache.cloudstack.quota.vo;
1818

19-
import org.apache.cloudstack.api.InternalIdentity;
19+
import org.apache.cloudstack.quota.QuotaTariff;
2020
import org.apache.cloudstack.quota.constant.QuotaTypes;
2121
import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils;
2222

@@ -37,7 +37,7 @@
3737

3838
@Entity
3939
@Table(name = "quota_tariff")
40-
public class QuotaTariffVO implements InternalIdentity {
40+
public class QuotaTariffVO implements QuotaTariff {
4141
private static final long serialVersionUID = -7117933766387653203L;
4242

4343
@Id

plugins/database/quota/src/main/java/org/apache/cloudstack/api/command/QuotaTariffCreateCmd.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import org.apache.cloudstack.acl.RoleType;
2222
import org.apache.cloudstack.api.APICommand;
23+
import org.apache.cloudstack.api.ApiCommandResourceType;
2324
import org.apache.cloudstack.api.ApiConstants;
2425
import org.apache.cloudstack.api.ApiErrorCode;
2526
import org.apache.cloudstack.api.BaseCmd;
@@ -135,4 +136,9 @@ public Date getEndDate() {
135136
public void setEndDate(Date endDate) {
136137
this.endDate = endDate;
137138
}
139+
140+
@Override
141+
public ApiCommandResourceType getApiResourceType() {
142+
return ApiCommandResourceType.QuotaTariff;
143+
}
138144
}

plugins/database/quota/src/main/java/org/apache/cloudstack/api/command/QuotaTariffDeleteCmd.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import org.apache.cloudstack.acl.RoleType;
2222
import org.apache.cloudstack.api.APICommand;
2323
import org.apache.cloudstack.api.ApiArgValidator;
24+
import org.apache.cloudstack.api.ApiCommandResourceType;
2425
import org.apache.cloudstack.api.ApiConstants;
2526
import org.apache.cloudstack.api.BaseCmd;
2627
import org.apache.cloudstack.api.Parameter;
@@ -61,4 +62,9 @@ public void execute() {
6162
public long getEntityOwnerId() {
6263
return Account.ACCOUNT_ID_SYSTEM;
6364
}
65+
66+
@Override
67+
public ApiCommandResourceType getApiResourceType() {
68+
return ApiCommandResourceType.QuotaTariff;
69+
}
6470
}

plugins/database/quota/src/main/java/org/apache/cloudstack/api/command/QuotaTariffUpdateCmd.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import org.apache.cloudstack.acl.RoleType;
2222
import org.apache.cloudstack.api.APICommand;
23+
import org.apache.cloudstack.api.ApiCommandResourceType;
2324
import org.apache.cloudstack.api.ApiConstants;
2425
import org.apache.cloudstack.api.ApiErrorCode;
2526
import org.apache.cloudstack.api.BaseCmd;
@@ -127,4 +128,8 @@ public long getEntityOwnerId() {
127128
return Account.ACCOUNT_ID_SYSTEM;
128129
}
129130

131+
@Override
132+
public ApiCommandResourceType getApiResourceType() {
133+
return ApiCommandResourceType.QuotaTariff;
134+
}
130135
}

ui/src/components/view/SearchView.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,8 @@ export default {
339339
{ value: 'Template' },
340340
{ value: 'User' },
341341
{ value: 'VirtualMachine' },
342-
{ value: 'Volume' }
342+
{ value: 'Volume' },
343+
{ value: 'QuotaTariff' }
343344
]
344345
this.fields[resourceTypeIndex].loading = false
345346
}

0 commit comments

Comments
 (0)