From 5fe9049ab8269f97ce72f954ca94649fe6fadf57 Mon Sep 17 00:00:00 2001 From: shir Date: Fri, 25 Aug 2023 18:00:49 +0300 Subject: [PATCH 1/4] [src] Network Costs - billing mechanism - CON-22569 --- ...r-aggregated-network-data-consumption.yaml | 23 ++++++ .../networkDataConsumptionResponse.yaml | 24 ++++++ .../aws/schemas/networkDataConsumption.yaml | 73 +++++++++++++++++++ .../networkDataConsumptionRequest.yaml | 15 ++++ api/spot.yaml | 2 + 5 files changed, 137 insertions(+) create mode 100644 api/services/ocean/aws/paths/cluster-aggregated-network-data-consumption.yaml create mode 100644 api/services/ocean/aws/responses/networkDataConsumptionResponse.yaml create mode 100644 api/services/ocean/aws/schemas/networkDataConsumption.yaml create mode 100644 api/services/ocean/aws/schemas/networkDataConsumptionRequest.yaml diff --git a/api/services/ocean/aws/paths/cluster-aggregated-network-data-consumption.yaml b/api/services/ocean/aws/paths/cluster-aggregated-network-data-consumption.yaml new file mode 100644 index 000000000..6d85adbc7 --- /dev/null +++ b/api/services/ocean/aws/paths/cluster-aggregated-network-data-consumption.yaml @@ -0,0 +1,23 @@ +post: + summary: "Get Cluster Monthly Aggregated Network Client Data Consumption" + description: | + Provides Network Client monthly usage distribute by charge plan: POC, FREE or PAID. + operationId: "oceanK8sAggregatedNetworkClientDataConsumption" + tags: + - "Ocean AWS" + parameters: + - $ref: "../../commons/parameters/oceanId.yaml" + - $ref: "../../../../commons/parameters/accountId.yaml" + requestBody: + required: true + content: + application/json: + schema: + allOf: + - $ref: "../schemas/networkDataConsumptionRequest.yaml" + + responses: + 200: + $ref: "../responses/networkDataConsumptionResponse.yaml" + 400: + description: "Bad Request" \ No newline at end of file diff --git a/api/services/ocean/aws/responses/networkDataConsumptionResponse.yaml b/api/services/ocean/aws/responses/networkDataConsumptionResponse.yaml new file mode 100644 index 000000000..603bd194e --- /dev/null +++ b/api/services/ocean/aws/responses/networkDataConsumptionResponse.yaml @@ -0,0 +1,24 @@ +description: Ocean Monthly Aggregated Network Client Data Consumption Response +content: + application/json: + schema: + allOf: + - $ref: "../../../../commons/schemas/responseItemWrapper.yaml" + - type: object + properties: + request: + type: object + properties: + url: + example: "/ocean/k8s/networkClient/monthlyDataConsumption" + method: + example: "POST" + response: + type: object + properties: + items: + type: array + items: + $ref: "../schemas/networkDataConsumption.yaml" + kind: + example: "ocean:k8s:networkClient:monthlyDataConsumption" \ No newline at end of file diff --git a/api/services/ocean/aws/schemas/networkDataConsumption.yaml b/api/services/ocean/aws/schemas/networkDataConsumption.yaml new file mode 100644 index 000000000..29775c39b --- /dev/null +++ b/api/services/ocean/aws/schemas/networkDataConsumption.yaml @@ -0,0 +1,73 @@ +type: object +properties: + result: + type: object + properties: + totalForDuration: + type: object + properties: + startTime: + type: string + example: 2023-08-01T00:00:00.000Z + description: > + Beginning date value using either the date format "yyyy-MM-dd'T'HH:mm:ss'Z'" or ms "1494751821472". + endTime: + type: string + example: 2023-10-01T00:00:00.000Z + description: > + End date value using either the date format "yyyy-MM-dd'T'HH:mm:ss'Z'" or ms "1494751821472". + summary: + type: object + properties: + totalConsumption: + type: number + example: 650.123 + description: The total data consumption of the network client in a given time range + pocConsumption: + type: number + example: 300 + description: The total data consumption of the network client in the POC period, if the given time range include POC time. + freeConsumption: + type: number + example: 100 + description: The total data consumption the network client got as free tier and will not be charged for it. + paidConsumption: + type: number + example: 250.123 + description: The total data consumption the network client will be charged for. + detailedConsumptions: + type: array + items: + type: object + properties: + startTime: + type: string + example: 2023-08-01T00:00:00.000Z + description: > + Beginning date value using either the date format "yyyy-MM-dd'T'HH:mm:ss'Z'" or ms "1494751821472". + endTime: + type: string + example: 2023-09-01T00:00:00.000Z + description: > + Beginning date value using either the date format "yyyy-MM-dd'T'HH:mm:ss'Z'" or ms "1494751821472". + totalConsumption: + type: number + example: 350.123 + description: The total data consumption of the network client in the given month. + maxConsumptionForFreeTier: + type: number + example: 100 + description: The max number of first free data consumption in GB of the network client in the given month. + plans: + type: object + properties: + pocConsumption: + type: number + example: 300 + freeConsumption: + type: number + example: 100 + paidConsumption: + type: number + example: 250.123 + description: The distribution of the data consumption by charge plan in the given month. \ No newline at end of file diff --git a/api/services/ocean/aws/schemas/networkDataConsumptionRequest.yaml b/api/services/ocean/aws/schemas/networkDataConsumptionRequest.yaml new file mode 100644 index 000000000..67b8a913e --- /dev/null +++ b/api/services/ocean/aws/schemas/networkDataConsumptionRequest.yaml @@ -0,0 +1,15 @@ +type: object +required: + - oceanId + - months +properties: + oceanId: + type: string + example: "o-12345" + months: + type: array + example: ["02/2023", "03/2023", "04/2023"] + items: + type: string + description: > + An array of months to get the aggregated network client data consumption. \ No newline at end of file diff --git a/api/spot.yaml b/api/spot.yaml index 1b339932b..b268bf111 100644 --- a/api/spot.yaml +++ b/api/spot.yaml @@ -513,6 +513,8 @@ paths: $ref: services/ocean/aws/paths/cluster-aggregated-costs.yaml /ocean/aws/k8s/cluster/{oceanClusterId}/aggregatedCosts/summary: $ref: services/ocean/aws/paths/cluster-aggregated-costs-summary.yaml + /ocean/k8s/networkClient/monthlyDataConsumption: + $ref: services/ocean/aws/paths/cluster-aggregated-network-data-consumption.yaml /ocean/aws/k8s/launchSpec: $ref: services/ocean/aws/paths/clusters-launchSpec.yaml /ocean/aws/k8s/launchSpec/{oceanLaunchSpecId}: From 4943e78f61e633f8ebd42a71c89f6acdb75e7474 Mon Sep 17 00:00:00 2001 From: shir Date: Tue, 29 Aug 2023 10:09:15 +0300 Subject: [PATCH 2/4] [src] Network Costs - billing mechanism - CON-22569 --- .../aws/paths/cluster-aggregated-network-data-consumption.yaml | 1 - api/services/ocean/aws/schemas/networkDataConsumption.yaml | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/api/services/ocean/aws/paths/cluster-aggregated-network-data-consumption.yaml b/api/services/ocean/aws/paths/cluster-aggregated-network-data-consumption.yaml index 6d85adbc7..ccde02a2d 100644 --- a/api/services/ocean/aws/paths/cluster-aggregated-network-data-consumption.yaml +++ b/api/services/ocean/aws/paths/cluster-aggregated-network-data-consumption.yaml @@ -6,7 +6,6 @@ post: tags: - "Ocean AWS" parameters: - - $ref: "../../commons/parameters/oceanId.yaml" - $ref: "../../../../commons/parameters/accountId.yaml" requestBody: required: true diff --git a/api/services/ocean/aws/schemas/networkDataConsumption.yaml b/api/services/ocean/aws/schemas/networkDataConsumption.yaml index 29775c39b..6820957b5 100644 --- a/api/services/ocean/aws/schemas/networkDataConsumption.yaml +++ b/api/services/ocean/aws/schemas/networkDataConsumption.yaml @@ -63,11 +63,14 @@ properties: properties: pocConsumption: type: number + description: The total data consumption of the network client in the POC period, if the given time range include POC time. example: 300 freeConsumption: type: number + description: The total data consumption the network client got as free tier and will not be charged for it. example: 100 paidConsumption: type: number + description: The total data consumption the network client will be charged for. example: 250.123 description: The distribution of the data consumption by charge plan in the given month. \ No newline at end of file From cec58d76f5e26d08a1324d18bac8e02fc5ed2af0 Mon Sep 17 00:00:00 2001 From: shir Date: Tue, 29 Aug 2023 11:22:49 +0300 Subject: [PATCH 3/4] [src] Network Costs - billing mechanism - CON-22569 --- .../ocean/aws/schemas/networkDataConsumptionRequest.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/services/ocean/aws/schemas/networkDataConsumptionRequest.yaml b/api/services/ocean/aws/schemas/networkDataConsumptionRequest.yaml index 67b8a913e..f59033c87 100644 --- a/api/services/ocean/aws/schemas/networkDataConsumptionRequest.yaml +++ b/api/services/ocean/aws/schemas/networkDataConsumptionRequest.yaml @@ -6,6 +6,8 @@ properties: oceanId: type: string example: "o-12345" + description: > + Ocean cluster identifier.. months: type: array example: ["02/2023", "03/2023", "04/2023"] From e7f1130677279b7bcb51a531c0d176e492088317 Mon Sep 17 00:00:00 2001 From: Moshe Dahan Date: Tue, 29 Aug 2023 11:59:45 +0300 Subject: [PATCH 4/4] [src] cr remove extra dot --- .../ocean/aws/schemas/networkDataConsumptionRequest.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/services/ocean/aws/schemas/networkDataConsumptionRequest.yaml b/api/services/ocean/aws/schemas/networkDataConsumptionRequest.yaml index f59033c87..11c4a8952 100644 --- a/api/services/ocean/aws/schemas/networkDataConsumptionRequest.yaml +++ b/api/services/ocean/aws/schemas/networkDataConsumptionRequest.yaml @@ -7,7 +7,7 @@ properties: type: string example: "o-12345" description: > - Ocean cluster identifier.. + Ocean cluster identifier. months: type: array example: ["02/2023", "03/2023", "04/2023"]