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..ccde02a2d --- /dev/null +++ b/api/services/ocean/aws/paths/cluster-aggregated-network-data-consumption.yaml @@ -0,0 +1,22 @@ +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/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..6820957b5 --- /dev/null +++ b/api/services/ocean/aws/schemas/networkDataConsumption.yaml @@ -0,0 +1,76 @@ +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 + 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 diff --git a/api/services/ocean/aws/schemas/networkDataConsumptionRequest.yaml b/api/services/ocean/aws/schemas/networkDataConsumptionRequest.yaml new file mode 100644 index 000000000..11c4a8952 --- /dev/null +++ b/api/services/ocean/aws/schemas/networkDataConsumptionRequest.yaml @@ -0,0 +1,17 @@ +type: object +required: + - oceanId + - months +properties: + oceanId: + type: string + example: "o-12345" + description: > + Ocean cluster identifier. + 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 4c8a2abc4..c88b4f1f2 100644 --- a/api/spot.yaml +++ b/api/spot.yaml @@ -511,6 +511,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}: