diff options
author | Øyvind Grønnesby <oyving@yahooinc.com> | 2023-02-23 09:05:28 +0100 |
---|---|---|
committer | Øyvind Grønnesby <oyving@yahooinc.com> | 2023-02-23 09:14:33 +0100 |
commit | 88a602d98d87475d1fb3757ae93295e84b936ee5 (patch) | |
tree | 1a7c2c3d259da39034b22fb044601e6de4fe3af2 | |
parent | e97115b107f378e60aa060af4ac4d4fafc83ab46 (diff) |
Add majorVersion and architecture to API output
6 files changed, 21 insertions, 7 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/billing/BillingApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/billing/BillingApiHandler.java index 703e95d09f2..5928a50c907 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/billing/BillingApiHandler.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/billing/BillingApiHandler.java @@ -413,6 +413,12 @@ public class BillingApiHandler extends ThreadedHttpRequestHandler { cursor.setString("zone", zoneId.value()) ); + lineItem.getArchitecture().ifPresent(architecture -> { + cursor.setString("architecture", architecture.name()); + }); + + cursor.setLong("majorVersion", lineItem.getMajorVersion()); + lineItem.getCpuHours().ifPresent(cpuHours -> cursor.setString("cpuHours", cpuHours.toString()) ); diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/billing/BillingApiHandlerV2.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/billing/BillingApiHandlerV2.java index 0ddaa409ef8..67dd172fd83 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/billing/BillingApiHandlerV2.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/billing/BillingApiHandlerV2.java @@ -311,6 +311,8 @@ public class BillingApiHandlerV2 extends RestApiRequestHandler<BillingApiHandler slime.setString("description", item.description()); slime.setString("amount",item.amount().toString()); toSlime(slime.setObject("plan"), planRegistry.plan(item.plan()).orElseThrow(() -> new RuntimeException("No such plan: '" + item.plan() + "'"))); + item.getArchitecture().ifPresent(arch -> slime.setString("architecture", arch.name())); + slime.setLong("majorVersion", item.getMajorVersion()); item.applicationId().ifPresent(appId -> { slime.setString("application", appId.application().value()); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/billing/BillingApiHandlerV2Test.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/billing/BillingApiHandlerV2Test.java index 857dcbac6fd..43271277ce9 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/billing/BillingApiHandlerV2Test.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/billing/BillingApiHandlerV2Test.java @@ -103,7 +103,7 @@ public class BillingApiHandlerV2Test extends ControllerContainerCloudTest { var singleRequest = request("/billing/v2/tenant/" + tenant + "/bill/id-1").roles(tenantReader); tester.assertResponse(singleRequest, """ - {"id":"id-1","from":"2020-05-23","to":"2020-05-28","total":"123.00","status":"OPEN","statusHistory":[{"at":"2020-05-23T00:00:00Z","status":"OPEN"}],"items":[{"id":"some-id","description":"description","amount":"123.00","plan":{"id":"paid","name":"Paid Plan - for testing purposes"},"cpu":{},"memory":{},"disk":{}}]}"""); + {"id":"id-1","from":"2020-05-23","to":"2020-05-28","total":"123.00","status":"OPEN","statusHistory":[{"at":"2020-05-23T00:00:00Z","status":"OPEN"}],"items":[{"id":"some-id","description":"description","amount":"123.00","plan":{"id":"paid","name":"Paid Plan - for testing purposes"},"majorVersion":0,"cpu":{},"memory":{},"disk":{}}]}"""); } @Test diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/billing/responses/billing-all-tenants.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/billing/responses/billing-all-tenants.json index e9b18a879b9..d761439667a 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/billing/responses/billing-all-tenants.json +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/billing/responses/billing-all-tenants.json @@ -16,7 +16,8 @@ "description": "description", "amount": "123.00", "plan": "paid", - "planName": "Plan with id: paid" + "planName": "Plan with id: paid", + "majorVersion": 0 } ] }, @@ -27,7 +28,8 @@ "description": "support", "amount": "42.00", "plan": "some-plan", - "planName": "Plan with id: some-plan" + "planName": "Plan with id: some-plan", + "majorVersion": 0 } ] } @@ -47,7 +49,8 @@ "description": "description", "amount": "123.00", "plan": "paid", - "planName": "Plan with id: paid" + "planName": "Plan with id: paid", + "majorVersion": 0 } ] }, diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/billing/responses/line-item-list.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/billing/responses/line-item-list.json index e8404b12dd8..fbfc5ce09ee 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/billing/responses/line-item-list.json +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/billing/responses/line-item-list.json @@ -5,7 +5,8 @@ "description": "some description", "amount": "123.45", "plan": "some-plan", - "planName": "Plan with id: some-plan" + "planName": "Plan with id: some-plan", + "majorVersion": 0 } ] } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/billing/responses/tenant-billing-view.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/billing/responses/tenant-billing-view.json index adb319a3642..4e255205e19 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/billing/responses/tenant-billing-view.json +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/billing/responses/tenant-billing-view.json @@ -12,7 +12,8 @@ "description": "description", "amount": "123.00", "plan": "paid", - "planName": "Plan with id: paid" + "planName": "Plan with id: paid", + "majorVersion": 0 } ] }, @@ -38,7 +39,8 @@ "description": "description", "amount": "123.00", "plan": "paid", - "planName": "Plan with id: paid" + "planName": "Plan with id: paid", + "majorVersion": 0 } ] } |