diff options
author | Harald Musum <musum@yahooinc.com> | 2023-10-16 13:58:23 +0200 |
---|---|---|
committer | Harald Musum <musum@yahooinc.com> | 2023-10-16 13:58:23 +0200 |
commit | 48f117e55853568ad4eddd5b4de2cd08dc4d3ddd (patch) | |
tree | 7ba5c460aa634ff7d58b2eab3d9858846868c55d /controller-server | |
parent | 0ccfe8aab8c12ecd518f882a048f8a13fb2084f1 (diff) |
Stop using name for each application
Diffstat (limited to 'controller-server')
2 files changed, 5 insertions, 15 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/pricing/PricingApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/pricing/PricingApiHandler.java index 48ddd59e3f2..6ef247c5b41 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/pricing/PricingApiHandler.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/pricing/PricingApiHandler.java @@ -152,7 +152,6 @@ public class PricingApiHandler extends ThreadedHttpRequestHandler { private ApplicationResources applicationResources(String appResourcesString) { List<String> elements = Arrays.stream(appResourcesString.split(",")).toList(); - var applicationName = "default"; var vcpu = ZERO; var memoryGb = ZERO; var diskGb = ZERO; @@ -165,8 +164,6 @@ public class PricingApiHandler extends ThreadedHttpRequestHandler { for (var element : keysAndValues(elements)) { var value = element.getSecond(); switch (element.getFirst().toLowerCase()) { - case "name" -> applicationName = value; - case "vcpu" -> vcpu = new BigDecimal(value); case "memorygb" -> memoryGb = new BigDecimal(value); case "diskgb" -> diskGb = new BigDecimal(value); @@ -181,7 +178,7 @@ public class PricingApiHandler extends ThreadedHttpRequestHandler { } } - return new ApplicationResources(applicationName, vcpu, memoryGb, diskGb, gpuMemoryGb, + return new ApplicationResources(vcpu, memoryGb, diskGb, gpuMemoryGb, enclaveVcpu, enclaveMemoryGb, enclaveDiskGb, enclaveGpuMemoryGb); } @@ -218,12 +215,10 @@ public class PricingApiHandler extends ThreadedHttpRequestHandler { private static void applicationPrices(Cursor applicationPricesArray, List<PriceInformation> applicationPrices, PriceParameters priceParameters) { applicationPrices.forEach(priceInformation -> { var element = applicationPricesArray.addObject(); - element.setString("name", priceInformation.applicationName()); var array = element.setArray("priceInfo"); addItem(array, supportLevelDescription(priceParameters), priceInformation.listPriceWithSupport()); addItem(array, "Enclave", priceInformation.enclaveDiscount()); addItem(array, "Volume discount", priceInformation.volumeDiscount()); - }); } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/pricing/PricingApiHandlerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/pricing/PricingApiHandlerTest.java index c1f9c5db769..63636b3ff20 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/pricing/PricingApiHandlerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/pricing/PricingApiHandlerTest.java @@ -26,7 +26,6 @@ public class PricingApiHandlerTest extends ControllerContainerCloudTest { { "applications": [ { - "name": "app1", "priceInfo": [ {"description": "Basic support unit price", "amount": "2240.00"}, {"description": "Volume discount", "amount": "-5.64"} @@ -49,7 +48,6 @@ public class PricingApiHandlerTest extends ControllerContainerCloudTest { { "applications": [ { - "name": "app1", "priceInfo": [ {"description": "Basic support unit price", "amount": "2240.00"}, {"description": "Enclave", "amount": "-15.12"}, @@ -73,7 +71,6 @@ public class PricingApiHandlerTest extends ControllerContainerCloudTest { { "applications": [ { - "name": "app1", "priceInfo": [ {"description": "Commercial support unit price", "amount": "3200.00"}, {"description": "Enclave", "amount": "-15.12"}, @@ -97,7 +94,6 @@ public class PricingApiHandlerTest extends ControllerContainerCloudTest { { "applications": [ { - "name": "app1", "priceInfo": [ {"description": "Commercial support unit price", "amount": "2000.00"}, {"description": "Enclave", "amount": "-15.12"}, @@ -105,7 +101,6 @@ public class PricingApiHandlerTest extends ControllerContainerCloudTest { ] }, { - "name": "app2", "priceInfo": [ {"description": "Commercial support unit price", "amount": "2000.00"}, {"description": "Enclave", "amount": "-15.12"}, @@ -160,7 +155,7 @@ public class PricingApiHandlerTest extends ControllerContainerCloudTest { * price will be 20000 + 2000 + 200 */ String urlEncodedPriceInformation1App(PricingInfo.SupportLevel supportLevel) { - return "application=" + URLEncoder.encode("name=app1,vcpu=2,memoryGb=2,diskGb=20,gpuMemoryGb=0", UTF_8) + + return "application=" + URLEncoder.encode("vcpu=2,memoryGb=2,diskGb=20,gpuMemoryGb=0", UTF_8) + "&supportLevel=" + supportLevel.name().toLowerCase() + "&committedSpend=100"; } @@ -170,7 +165,7 @@ public class PricingApiHandlerTest extends ControllerContainerCloudTest { * price will be 20000 + 2000 + 200 */ String urlEncodedPriceInformation1AppEnclave(PricingInfo.SupportLevel supportLevel) { - return "application=" + URLEncoder.encode("name=app1,enclaveVcpu=2,enclaveMemoryGb=2,enclaveDiskGb=20,enclaveGpuMemoryGb=0", UTF_8) + + return "application=" + URLEncoder.encode("enclaveVcpu=2,enclaveMemoryGb=2,enclaveDiskGb=20,enclaveGpuMemoryGb=0", UTF_8) + "&supportLevel=" + supportLevel.name().toLowerCase() + "&committedSpend=100"; } @@ -179,8 +174,8 @@ public class PricingApiHandlerTest extends ControllerContainerCloudTest { * 1 node, with 1 vcpu, 1 Gb memory, 10 Gb disk and no GPU */ String urlEncodedPriceInformation2AppsEnclave(PricingInfo.SupportLevel supportLevel) { - return "application=" + URLEncoder.encode("name=app1,enclaveVcpu=1,enclaveMemoryGb=1,enclaveDiskGb=10,enclaveGpuMemoryGb=0", UTF_8) + - "&application=" + URLEncoder.encode("name=app2,enclaveVcpu=1,enclaveMemoryGb=1,enclaveDiskGb=10,enclaveGpuMemoryGb=0", UTF_8) + + return "application=" + URLEncoder.encode("enclaveVcpu=1,enclaveMemoryGb=1,enclaveDiskGb=10,enclaveGpuMemoryGb=0", UTF_8) + + "&application=" + URLEncoder.encode("enclaveVcpu=1,enclaveMemoryGb=1,enclaveDiskGb=10,enclaveGpuMemoryGb=0", UTF_8) + "&supportLevel=" + supportLevel.name().toLowerCase() + "&committedSpend=0"; } |