diff --git a/api/services/ocean/rightsizing/paths/oceanRightsizingSavings.yaml b/api/services/ocean/rightsizing/paths/oceanRightsizingSavings.yaml new file mode 100644 index 00000000..a25e8621 --- /dev/null +++ b/api/services/ocean/rightsizing/paths/oceanRightsizingSavings.yaml @@ -0,0 +1,22 @@ +post: + summary: "Get Ocean Rightsizing Savings" + description: | + Get right-sizing savings for an Ocean cluster. + operationId: "oceanRightsizingSavings" + tags: + - "Ocean Automatic Rightsizing" + parameters: + - $ref: "../parameters/oceanId.yaml" + - $ref: "../../../../commons/parameters/accountId.yaml" + requestBody: + required: true + content: + application/json: + schema: + allOf: + - $ref: "../schemas/oceanRightsizingSavingsRequest.yaml" + responses: + 200: + $ref: "../responses/oceanRightsizingSavingsResponse.yaml" + 400: + description: "Bad Request" \ No newline at end of file diff --git a/api/services/ocean/rightsizing/responses/oceanRightsizingSavingsResponse.yaml b/api/services/ocean/rightsizing/responses/oceanRightsizingSavingsResponse.yaml new file mode 100644 index 00000000..6e45a2ac --- /dev/null +++ b/api/services/ocean/rightsizing/responses/oceanRightsizingSavingsResponse.yaml @@ -0,0 +1,56 @@ +description: "Ocean Rightsizing Savings Response" +content: + application/json: + schema: + allOf: + - $ref: "../../../../commons/schemas/responseItemWrapper.yaml" + - type: object + properties: + request: + type: object + properties: + url: + example: "/ocean/o-abcd1234/rightSizing/savings" + method: + example: "POST" + response: + type: object + properties: + items: + type: array + items: + $ref: "../schemas/oceanRightsizingSavings.yaml" + example: + totalSavingsSummary: + cpuWithOcean: 100, + memoryWithOcean: 128, + savings: 1000, + percentage: 0.75 + namespacesSavingsSummary: + - namespace: "kube-system" + savings: 500 + - namespace: "default" + savings: 500 + workloadSavings: + - workloadName: "coredns" + workloadType: "Deployment" + namespace: "kube-system" + cpuWithOcean: 25 + cpuWithoutOcean: 50 + memoryWithOcean: 32 + memoryWithoutOcean: 64 + savings: 250 + isDeleted: True + - workloadName: "aws-node" + workloadType: "DaemonSet" + namespace: "kube-system" + cpuWithOcean: 25 + cpuWithoutOcean: 50 + memoryWithOcean: 32 + memoryWithoutOcean: 64 + savings: 250 + isDeleted": False + count: + example: 1 + kind: + example: "mcs:ocean:rightSizing:savings" \ No newline at end of file diff --git a/api/services/ocean/rightsizing/schemas/oceanRightsizingSavings.yaml b/api/services/ocean/rightsizing/schemas/oceanRightsizingSavings.yaml new file mode 100644 index 00000000..ae6be0a8 --- /dev/null +++ b/api/services/ocean/rightsizing/schemas/oceanRightsizingSavings.yaml @@ -0,0 +1,50 @@ +type: object +title: Ocean Rightsizing Savings Response +description: > + Rightsizing Savings Response Object +properties: + totalSavingsSummary: + type: object + properties: + cpuWithOcean: + type: number + memoryWithOcean: + type: number + savings: + type: number + percentage: + type: number + namespacesSavingsSummary: + type: array + items: + type: object + properties: + namespace: + type: string + savings: + type: number + workloadSavings: + type: array + items: + type: object + properties: + workloadName: + type: string + workloadType: + type: string + namespace: + type: string + cpuWithOcean: + type: number + cpuWithoutOcean: + type: number + memoryWithOcean: + type: number + memoryWithoutOcean: + type: number + savings: + type: number + isDeleted: + type: boolean + + diff --git a/api/services/ocean/rightsizing/schemas/oceanRightsizingSavingsRequest.yaml b/api/services/ocean/rightsizing/schemas/oceanRightsizingSavingsRequest.yaml new file mode 100644 index 00000000..c57e8ecc --- /dev/null +++ b/api/services/ocean/rightsizing/schemas/oceanRightsizingSavingsRequest.yaml @@ -0,0 +1,26 @@ +type: object +title: Ocean Rightsizing Savings +description: > + Determines the Ocean Rightsizing savings +required: + - endTime + - startTime + - workloads +properties: + startTime: + type: string + example: 2025-01-20T11:35:02.745Z + description: > + Beginning date value using either the date format "yyyy-MM-dd'T'HH:mm:ss'Z'" or ms "1494751821472". + endTime: + type: string + example: 2025-01-30T11:30:01.745Z + description: > + End date value using either the date format "yyyy-MM-dd'T'HH:mm:ss'Z'" or ms "1494751821472". + benchmark: + type: string + description: > + The benchmark to compare the savings against. The default is ORIGINAL. + enum: [ORIGINAL, CURRENT] + workloads: + $ref: "../schemas/oceanRightsizingSavingsWorkloadsRequest.yaml" diff --git a/api/services/ocean/rightsizing/schemas/oceanRightsizingSavingsWorkloadsRequest.yaml b/api/services/ocean/rightsizing/schemas/oceanRightsizingSavingsWorkloadsRequest.yaml new file mode 100644 index 00000000..6b3884ae --- /dev/null +++ b/api/services/ocean/rightsizing/schemas/oceanRightsizingSavingsWorkloadsRequest.yaml @@ -0,0 +1,17 @@ +type: object +title: Ocean Rightsizing Savings Workloads +description: > + Determines the Ocean Savings filtering by the combinations of namespace::workload +properties: + namespaceName: + description: Determines the namespace to filter with an array of it's workloads + type: array + items: + type: string + properties: + workloadName: + type: string +example: { + namespaceName1: [ "workloadName1", "workloadName1" ], + namespaceName2: [ "workloadName1", "workloadName1" ] +} diff --git a/api/spot.yaml b/api/spot.yaml index fec7a1b5..93f00d90 100644 --- a/api/spot.yaml +++ b/api/spot.yaml @@ -936,6 +936,8 @@ paths: $ref: services/ocean/rightsizing/paths/oceanRightsizingAcknowledgeRollbacks.yaml /ocean/{oceanId}/rightSizing/cluster/configuration: $ref: services/ocean/rightsizing/paths/oceanRightsizingClusterConfiguration.yaml + /ocean/{oceanId}/rightSizing/savings: + $ref: services/ocean/rightsizing/paths/oceanRightsizingSavings.yaml /security/v1/compliances: $ref: services/security/v1/paths/compliances.yaml /security/v1/compliances/count: