From 46f1174c36ad1d41360f85dcbdfea4d97384c8ff Mon Sep 17 00:00:00 2001 From: artaasadi Date: Sun, 23 Jun 2024 14:33:08 +0200 Subject: [PATCH 1/2] fix: add disk wastage request --- plugin/kaytu/compute_instance.go | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/plugin/kaytu/compute_instance.go b/plugin/kaytu/compute_instance.go index 2c11927..9e6437e 100644 --- a/plugin/kaytu/compute_instance.go +++ b/plugin/kaytu/compute_instance.go @@ -10,6 +10,7 @@ type GcpComputeInstance struct { type RightsizingGcpComputeInstance struct { Zone string `json:"zone"` + Region string `json:"region"` MachineType string `json:"machineType"` MachineFamily string `json:"machineFamily"` CPU int64 `json:"cpu"` @@ -39,8 +40,26 @@ type GcpComputeInstanceWastageRequest struct { Loading bool `json:"loading"` } +type RightsizingGcpComputeDisk struct { + Zone string `json:"zone"` + Region string `json:"region"` + DiskType string `json:"diskType"` + DiskSize *int32 `json:"diskSize"` + Cost float64 `json:"cost"` +} + +type GcpComputeDiskRecommendation struct { + Current RightsizingGcpComputeDisk + Recommended *RightsizingGcpComputeDisk + + Size Usage `json:"size"` + + Description string `json:"description"` +} + type GcpComputeInstanceWastageResponse struct { - RightSizing GcpComputeInstanceRightsizingRecommendation `json:"rightSizing"` + RightSizing GcpComputeInstanceRightsizingRecommendation `json:"rightSizing"` + VolumeRightSizing map[string]GcpComputeDiskRecommendation `json:"volumes"` } type Datapoint struct { From 8407774cc1c34dfe0815357b3e353d218b5be43c Mon Sep 17 00:00:00 2001 From: artaasadi Date: Sun, 23 Jun 2024 14:38:42 +0200 Subject: [PATCH 2/2] fix: add disk wastage request --- plugin/kaytu/compute_instance.go | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/plugin/kaytu/compute_instance.go b/plugin/kaytu/compute_instance.go index 9e6437e..f23be60 100644 --- a/plugin/kaytu/compute_instance.go +++ b/plugin/kaytu/compute_instance.go @@ -8,6 +8,14 @@ type GcpComputeInstance struct { MachineType string `json:"machineType"` } +type GcpComputeDisk struct { + HashedDiskId string `json:"hashedDiskId"` + Zone string `json:"zone"` + Region string `json:"region"` + DiskType string `json:"diskType"` + DiskSize *int32 `json:"diskSize"` +} + type RightsizingGcpComputeInstance struct { Zone string `json:"zone"` Region string `json:"region"` @@ -30,14 +38,16 @@ type GcpComputeInstanceRightsizingRecommendation struct { } type GcpComputeInstanceWastageRequest struct { - RequestId *string `json:"requestId"` - CliVersion *string `json:"cliVersion"` - Identification map[string]string `json:"identification"` - Instance GcpComputeInstance `json:"instance"` - Metrics map[string][]Datapoint `json:"metrics"` - Region string `json:"region"` - Preferences map[string]*string `json:"preferences"` - Loading bool `json:"loading"` + RequestId *string `json:"requestId"` + CliVersion *string `json:"cliVersion"` + Identification map[string]string `json:"identification"` + Instance GcpComputeInstance `json:"instance"` + Disks []GcpComputeDisk `json:"disks"` + Metrics map[string][]Datapoint `json:"metrics"` + DiskMetrics map[string]map[string][]Datapoint `json:"diskMetrics"` + Region string `json:"region"` + Preferences map[string]*string `json:"preferences"` + Loading bool `json:"loading"` } type RightsizingGcpComputeDisk struct {