From 9275602fe660ac5cfee0deaac33c7742b35d9de1 Mon Sep 17 00:00:00 2001 From: Adnan Gulegulzar Date: Fri, 14 Jun 2024 20:25:22 -0400 Subject: [PATCH 01/20] returning error --- plugin/gcp/metrics.go | 6 +++--- plugin/gcp/metrics_test.go | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/plugin/gcp/metrics.go b/plugin/gcp/metrics.go index 9790a15..54849f3 100644 --- a/plugin/gcp/metrics.go +++ b/plugin/gcp/metrics.go @@ -75,15 +75,15 @@ func (c *CloudMonitoring) NewInstanceMetricRequest( return request } -func (c *CloudMonitoring) GetMetric(request *monitoringpb.ListTimeSeriesRequest) *monitoringpb.TimeSeries { +func (c *CloudMonitoring) GetMetric(request *monitoringpb.ListTimeSeriesRequest) (*monitoringpb.TimeSeries, error) { it := c.client.ListTimeSeries(context.Background(), request) resp, err := it.Next() if err != nil { - panic(err) + return nil, err } - return resp + return resp, err } diff --git a/plugin/gcp/metrics_test.go b/plugin/gcp/metrics_test.go index 37a6244..c57bdca 100644 --- a/plugin/gcp/metrics_test.go +++ b/plugin/gcp/metrics_test.go @@ -41,7 +41,10 @@ func TestGetMetrics(t *testing.T) { ) // execute the request - resp := metric.GetMetric(request) + resp, err := metric.GetMetric(request) + if err != nil { + t.Error(err) + } log.Printf("metrics: %s", resp.GetMetric().String()) log.Printf("resource: %s", resp.GetResource().String()) From 484baad2fd4fa205c3a37615752431eb83ba79e7 Mon Sep 17 00:00:00 2001 From: Adnan Gulegulzar Date: Fri, 14 Jun 2024 20:27:26 -0400 Subject: [PATCH 02/20] collect metrics job for compute instance processor --- .../compute_instance/compute_instance.go | 7 +- .../compute_instance/compute_instance_item.go | 33 ++----- .../job_compute_instance_list.go | 6 +- .../job_get_compute_instance_metrics.go | 99 +++++++++++++++++++ plugin/service.go | 13 +++ 5 files changed, 127 insertions(+), 31 deletions(-) create mode 100644 plugin/processor/compute_instance/job_get_compute_instance_metrics.go diff --git a/plugin/processor/compute_instance/compute_instance.go b/plugin/processor/compute_instance/compute_instance.go index e095333..abf44ad 100644 --- a/plugin/processor/compute_instance/compute_instance.go +++ b/plugin/processor/compute_instance/compute_instance.go @@ -10,7 +10,8 @@ import ( ) type ComputeInstanceProcessor struct { - provider *gcp.Compute + provider *gcp.Compute + metricProvider *gcp.CloudMonitoring // identification map[string]string items util.ConcurrentMap[string, ComputeInstanceItem] publishOptimizationItem func(item *golang.ChartOptimizationItem) @@ -21,13 +22,15 @@ type ComputeInstanceProcessor struct { func NewComputeInstanceProcessor( prv *gcp.Compute, + metricPrv *gcp.CloudMonitoring, publishOptimizationItem func(item *golang.ChartOptimizationItem), publishResultSummary func(summary *golang.ResultSummary), kaytuAcccessToken string, jobQueue *sdk.JobQueue, ) *ComputeInstanceProcessor { r := &ComputeInstanceProcessor{ - provider: prv, + provider: prv, + metricProvider: metricPrv, // identification: identification, items: util.NewMap[string, ComputeInstanceItem](), publishOptimizationItem: publishOptimizationItem, diff --git a/plugin/processor/compute_instance/compute_instance_item.go b/plugin/processor/compute_instance/compute_instance_item.go index 3883ab6..744e7b1 100644 --- a/plugin/processor/compute_instance/compute_instance_item.go +++ b/plugin/processor/compute_instance/compute_instance_item.go @@ -1,7 +1,7 @@ package compute_instance import ( - "github.com/google/uuid" + "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb" "github.com/kaytu-io/kaytu/pkg/plugin/proto/src/golang" "google.golang.org/protobuf/types/known/wrapperspb" ) @@ -16,39 +16,18 @@ type ComputeInstanceItem struct { Skipped bool LazyLoadingEnabled bool SkipReason string + Metrics map[string][]*monitoringpb.Point // Wastage kaytu.EC2InstanceWastageResponse } -// func (i ComputeInstanceItem) ToOptimizationItem() *golang.OptimizationItem { -// oi := &golang.OptimizationItem{ -// Id: i.Id, -// Name: i.Name, -// ResourceType: i.MachineType, -// Region: i.Region, -// Devices: nil, -// Preferences: i.Preferences, -// Description: "description placeholder", -// Loading: i.OptimizationLoading, -// Skipped: i.Skipped, -// SkipReason: i.SkipReason, -// LazyLoadingEnabled: i.LazyLoadingEnabled, -// } - -// // if i.Instance.PlatformDetails != nil { -// // oi.Platform = *i.Instance.PlatformDetails -// // } -// if oi.Name == "" { -// oi.Name = string(i.Name) -// } - -// return oi -// } - func (i ComputeInstanceItem) ToOptimizationItem() *golang.ChartOptimizationItem { chartrow := &golang.ChartRow{ - RowId: uuid.New().String(), + RowId: i.Id, Values: map[string]*golang.ChartRowItem{ + "instance_id": { + Value: i.Id, + }, "instance_name": { Value: i.Name, }, diff --git a/plugin/processor/compute_instance/job_compute_instance_list.go b/plugin/processor/compute_instance/job_compute_instance_list.go index aa406ce..ce5af5a 100644 --- a/plugin/processor/compute_instance/job_compute_instance_list.go +++ b/plugin/processor/compute_instance/job_compute_instance_list.go @@ -54,6 +54,7 @@ func (job *ListComputeInstancesJob) Run() error { Skipped: false, LazyLoadingEnabled: false, SkipReason: "NA", + Metrics: nil, } log.Printf("OI instance: %s", oi.Name) @@ -62,8 +63,9 @@ func (job *ListComputeInstancesJob) Run() error { job.processor.publishOptimizationItem(oi.ToOptimizationItem()) } - if err = job.processor.provider.CloseClient(); err != nil { - return err + for _, instance := range instances { + + job.processor.jobQueue.Push(NewGetComputeInstanceMetricsJob(job.processor, instance)) } return nil diff --git a/plugin/processor/compute_instance/job_get_compute_instance_metrics.go b/plugin/processor/compute_instance/job_get_compute_instance_metrics.go new file mode 100644 index 0000000..b9c7f78 --- /dev/null +++ b/plugin/processor/compute_instance/job_get_compute_instance_metrics.go @@ -0,0 +1,99 @@ +package compute_instance + +import ( + "context" + "fmt" + "log" + "strconv" + "time" + + "cloud.google.com/go/compute/apiv1/computepb" + "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb" + "github.com/kaytu-io/plugin-gcp/plugin/preferences" +) + +type GetComputeInstanceMetricsJob struct { + processor *ComputeInstanceProcessor + instance *computepb.Instance +} + +func NewGetComputeInstanceMetricsJob(processor *ComputeInstanceProcessor, instance *computepb.Instance) *GetComputeInstanceMetricsJob { + return &GetComputeInstanceMetricsJob{ + processor: processor, + instance: instance, + } +} + +func (job *GetComputeInstanceMetricsJob) Id() string { + return "get_compute_instance_metrics" +} + +func (job *GetComputeInstanceMetricsJob) Description() string { + return "Get metrics for the specified compute instance" + +} + +func (job *GetComputeInstanceMetricsJob) Run() error { + + err := job.processor.metricProvider.InitializeClient(context.Background()) + if err != nil { + return err + } + + endtime := time.Now() + starttime := endtime.Add(-24 * 1 * time.Hour) + + cpuRequest := job.processor.metricProvider.NewInstanceMetricRequest( + "compute.googleapis.com/instance/cpu/utilization", + fmt.Sprint(job.instance.GetId()), + starttime, + endtime, + 60, // 1 minute + ) + + cpumetric, err := job.processor.metricProvider.GetMetric(cpuRequest) + if err != nil { + return err + } + + memoryRequest := job.processor.metricProvider.NewInstanceMetricRequest( + "compute.googleapis.com/instance/cpu/utilization", + fmt.Sprint(job.instance.GetId()), + starttime, + endtime, + 60, // 1 minute + ) + + memoryMetric, err := job.processor.metricProvider.GetMetric(memoryRequest) + if err != nil { + return err + } + + instanceMetrics := make(map[string][]*monitoringpb.Point) + + instanceMetrics["cpuUtilization"] = cpumetric.GetPoints() + instanceMetrics["memoryUtilization"] = memoryMetric.GetPoints() + + oi := ComputeInstanceItem{ + Name: *job.instance.Name, + Id: strconv.FormatUint(job.instance.GetId(), 10), + MachineType: job.instance.GetMachineType(), + Region: job.instance.GetZone(), + OptimizationLoading: false, + Preferences: preferences.DefaultComputeEnginePreferences, + Skipped: false, + LazyLoadingEnabled: false, + SkipReason: "NA", + Metrics: instanceMetrics, + } + + for k, v := range oi.Metrics { + log.Printf("%s : %d", k, len(v)) + } + + job.processor.items.Set(oi.Id, oi) + job.processor.publishOptimizationItem(oi.ToOptimizationItem()) + + return nil + +} diff --git a/plugin/service.go b/plugin/service.go index bf49ea2..c2bfbb1 100644 --- a/plugin/service.go +++ b/plugin/service.go @@ -45,6 +45,12 @@ func (p *GCPPlugin) GetConfig() golang.RegisterConfig { OverviewChart: &golang.ChartDefinition{ Columns: []*golang.ChartColumnItem{ + { + Id: "instance_id", + Name: "Instance ID", + Width: uint32(10), + Sortable: true, + }, { Id: "instance_name", Name: "Instance Name", @@ -86,6 +92,12 @@ func (p *GCPPlugin) StartProcess(cmd string, flags map[string]string, kaytuAcces }, ) + metricClient := gcp.NewCloudMonitoring( + []string{ + "https://www.googleapis.com/auth/monitoring.read", + }, + ) + publishOptimizationItem := func(item *golang.ChartOptimizationItem) { p.stream.Send(&golang.PluginMessage{ PluginMessage: &golang.PluginMessage_Coi{ @@ -117,6 +129,7 @@ func (p *GCPPlugin) StartProcess(cmd string, flags map[string]string, kaytuAcces if cmd == "compute-instance" { p.processor = compute_instance.NewComputeInstanceProcessor( gcpProvider, + metricClient, publishOptimizationItem, publishResultSummary, kaytuAccessToken, From c236bd60a1c95acfed03298435ce06c1e89b23e8 Mon Sep 17 00:00:00 2001 From: Adnan Gulegulzar Date: Sun, 16 Jun 2024 12:18:02 -0400 Subject: [PATCH 03/20] get memory for compute instance --- plugin/gcp/compute.go | 43 +++++++++++++++++++++++++++++++++----- plugin/gcp/compute_test.go | 27 ++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 5 deletions(-) diff --git a/plugin/gcp/compute.go b/plugin/gcp/compute.go index 9f9e9ba..848e8d8 100644 --- a/plugin/gcp/compute.go +++ b/plugin/gcp/compute.go @@ -13,7 +13,8 @@ import ( ) type Compute struct { - client *compute.InstancesClient + instancesClient *compute.InstancesClient + machineTypeClient *compute.MachineTypesClient GCP } @@ -38,15 +39,28 @@ func (c *Compute) InitializeClient(ctx context.Context) error { return err } + machineTypeClient, err := compute.NewMachineTypesRESTClient( + ctx, + option.WithCredentials(c.GCP.credentials), + ) + if err != nil { + return err + } + // log.Println(instancesClient) - c.client = instancesClient + c.instancesClient = instancesClient + c.machineTypeClient = machineTypeClient return nil } func (c *Compute) CloseClient() error { - err := c.client.Close() + err := c.instancesClient.Close() + if err != nil { + return err + } + err = c.machineTypeClient.Close() if err != nil { return err } @@ -59,7 +73,7 @@ func (c *Compute) ListAllInstances() error { Project: c.ProjectID, } - it := c.client.AggregatedList(context.Background(), req) + it := c.instancesClient.AggregatedList(context.Background(), req) log.Println("instances found: ") @@ -92,7 +106,7 @@ func (c *Compute) GetAllInstances() ([]*computepb.Instance, error) { Project: c.ProjectID, } - it := c.client.AggregatedList(context.Background(), req) + it := c.instancesClient.AggregatedList(context.Background(), req) log.Println("instances found: ") @@ -121,3 +135,22 @@ func (c *Compute) GetAllInstances() ([]*computepb.Instance, error) { } return allInstances, nil } + +func (c *Compute) GetMemory(InstanceMachineType string, zone string) (*int32, error) { + + request := &computepb.GetMachineTypeRequest{ + Project: c.ProjectID, + MachineType: InstanceMachineType, + Zone: zone, + } + + machineType, err := c.machineTypeClient.Get(context.Background(), request) + if err != nil { + return nil, err + } + + memory := machineType.GetMemoryMb() + + return &memory, nil + +} diff --git a/plugin/gcp/compute_test.go b/plugin/gcp/compute_test.go index 36f5fc8..dd7a8cc 100644 --- a/plugin/gcp/compute_test.go +++ b/plugin/gcp/compute_test.go @@ -3,6 +3,7 @@ package gcp import ( "context" "log" + "os" "testing" ) @@ -59,3 +60,29 @@ func TestGetAllInstances(t *testing.T) { compute.CloseClient() } + +// TEST_INSTANCE_ZONE="us-east1-b" TEST_INSTANCE_MACHINE_TYPE="e2-micro" TEST_INSTANCE_ID="7828543314219019363" make testgcp +func TestGetMemory(t *testing.T) { + + machineType := os.Getenv("TEST_INSTANCE_MACHINE_TYPE") + zone := os.Getenv("TEST_INSTANCE_ZONE") + + log.Printf("running %s", t.Name()) + compute := NewCompute( + []string{ + "https://www.googleapis.com/auth/compute.readonly", + }, + ) + err := compute.InitializeClient(context.Background()) + if err != nil { + t.Errorf("[%s]: %s", t.Name(), err.Error()) + } + + memory, err := compute.GetMemory(machineType, zone) + if err != nil { + t.Errorf("[%s]: %s", t.Name(), err.Error()) + } + + log.Printf("Memory : %d", &memory) + +} From 6b7713af427a54a54259c9f3c6a3caff3312f6bf Mon Sep 17 00:00:00 2001 From: Adnan Gulegulzar Date: Sun, 16 Jun 2024 12:18:33 -0400 Subject: [PATCH 04/20] ram used metric added --- plugin/gcp/metrics.go | 17 ++++++ plugin/gcp/metrics_test.go | 6 +- .../compute_instance/compute_instance.go | 2 +- .../job_compute_instance_list.go | 6 -- .../job_get_compute_instance_metrics.go | 58 ++++++++++++------- plugin/service.go | 14 +++++ 6 files changed, 73 insertions(+), 30 deletions(-) diff --git a/plugin/gcp/metrics.go b/plugin/gcp/metrics.go index 54849f3..2293efd 100644 --- a/plugin/gcp/metrics.go +++ b/plugin/gcp/metrics.go @@ -44,6 +44,22 @@ func (c *CloudMonitoring) CloseClient() error { return nil } +func (c *CloudMonitoring) NewTimeSeriesRequest( + filter string, // filter for time series metric, containing metric name and resource label + interval *monitoringpb.TimeInterval, // interval containing start and end time of the requested time series + aggregation *monitoringpb.Aggregation, // operations to perform on time series data before returning +) *monitoringpb.ListTimeSeriesRequest { + + return &monitoringpb.ListTimeSeriesRequest{ + Name: fmt.Sprintf("projects/%s", c.ProjectID), + Filter: filter, + Interval: interval, + Aggregation: aggregation, + View: monitoringpb.ListTimeSeriesRequest_FULL, + } + +} + func (c *CloudMonitoring) NewInstanceMetricRequest( metricName string, // fully qualified name of the metric instanceID string, // compute instance ID @@ -73,6 +89,7 @@ func (c *CloudMonitoring) NewInstanceMetricRequest( } return request + } func (c *CloudMonitoring) GetMetric(request *monitoringpb.ListTimeSeriesRequest) (*monitoringpb.TimeSeries, error) { diff --git a/plugin/gcp/metrics_test.go b/plugin/gcp/metrics_test.go index c57bdca..7c2e631 100644 --- a/plugin/gcp/metrics_test.go +++ b/plugin/gcp/metrics_test.go @@ -33,7 +33,7 @@ func TestGetMetrics(t *testing.T) { // creating the metric request for the instance request := metric.NewInstanceMetricRequest( - "compute.googleapis.com/instance/cpu/utilization", + "compute.googleapis.com/instance/memory/balloon/ram_used", id, starttime, endtime, @@ -49,9 +49,11 @@ func TestGetMetrics(t *testing.T) { log.Printf("metrics: %s", resp.GetMetric().String()) log.Printf("resource: %s", resp.GetResource().String()) log.Printf("# of points: %d", len(resp.Points)) + log.Println(resp.Unit) + log.Printf("Point 1 : %.0f %s", resp.GetPoints()[0].GetValue().GetDoubleValue(), resp.GetUnit()) // for _, point := range resp.Points { - // log.Printf("Point : %.10f", point.GetValue().GetDoubleValue()) + // log.Printf("Point : %.0f", point.GetValue().GetDoubleValue()) // } metric.CloseClient() diff --git a/plugin/processor/compute_instance/compute_instance.go b/plugin/processor/compute_instance/compute_instance.go index abf44ad..9e1dda9 100644 --- a/plugin/processor/compute_instance/compute_instance.go +++ b/plugin/processor/compute_instance/compute_instance.go @@ -28,6 +28,7 @@ func NewComputeInstanceProcessor( kaytuAcccessToken string, jobQueue *sdk.JobQueue, ) *ComputeInstanceProcessor { + log.Println("creating processor") r := &ComputeInstanceProcessor{ provider: prv, metricProvider: metricPrv, @@ -40,7 +41,6 @@ func NewComputeInstanceProcessor( // configuration: configurations, // lazyloadCounter: lazyloadCounter, } - log.Println("creating processor") jobQueue.Push(NewListComputeInstancesJob(r)) return r diff --git a/plugin/processor/compute_instance/job_compute_instance_list.go b/plugin/processor/compute_instance/job_compute_instance_list.go index ce5af5a..9f7ab77 100644 --- a/plugin/processor/compute_instance/job_compute_instance_list.go +++ b/plugin/processor/compute_instance/job_compute_instance_list.go @@ -1,7 +1,6 @@ package compute_instance import ( - "context" "log" "strconv" @@ -31,11 +30,6 @@ func (job *ListComputeInstancesJob) Run() error { log.Println("Running list compute instance job") - err := job.processor.provider.InitializeClient(context.Background()) - if err != nil { - return err - } - instances, err := job.processor.provider.GetAllInstances() if err != nil { return err diff --git a/plugin/processor/compute_instance/job_get_compute_instance_metrics.go b/plugin/processor/compute_instance/job_get_compute_instance_metrics.go index b9c7f78..eb9d7de 100644 --- a/plugin/processor/compute_instance/job_get_compute_instance_metrics.go +++ b/plugin/processor/compute_instance/job_get_compute_instance_metrics.go @@ -1,7 +1,6 @@ package compute_instance import ( - "context" "fmt" "log" "strconv" @@ -10,6 +9,8 @@ import ( "cloud.google.com/go/compute/apiv1/computepb" "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb" "github.com/kaytu-io/plugin-gcp/plugin/preferences" + "google.golang.org/protobuf/types/known/durationpb" + "google.golang.org/protobuf/types/known/timestamppb" ) type GetComputeInstanceMetricsJob struct { @@ -35,20 +36,25 @@ func (job *GetComputeInstanceMetricsJob) Description() string { func (job *GetComputeInstanceMetricsJob) Run() error { - err := job.processor.metricProvider.InitializeClient(context.Background()) - if err != nil { - return err - } - - endtime := time.Now() - starttime := endtime.Add(-24 * 1 * time.Hour) - - cpuRequest := job.processor.metricProvider.NewInstanceMetricRequest( - "compute.googleapis.com/instance/cpu/utilization", - fmt.Sprint(job.instance.GetId()), - starttime, - endtime, - 60, // 1 minute + endTime := time.Now() + startTime := endTime.Add(-24 * 1 * time.Hour) + + cpuRequest := job.processor.metricProvider.NewTimeSeriesRequest( + fmt.Sprintf( + `metric.type="%s" AND resource.labels.instance_id="%s"`, + "compute.googleapis.com/instance/cpu/utilization", + fmt.Sprint(job.instance.GetId()), + ), + &monitoringpb.TimeInterval{ + EndTime: timestamppb.New(endTime), + StartTime: timestamppb.New(startTime), + }, + &monitoringpb.Aggregation{ + AlignmentPeriod: &durationpb.Duration{ + Seconds: 60, + }, + PerSeriesAligner: monitoringpb.Aggregation_ALIGN_MEAN, // will represent all the datapoints in the above period, with a mean + }, ) cpumetric, err := job.processor.metricProvider.GetMetric(cpuRequest) @@ -56,12 +62,22 @@ func (job *GetComputeInstanceMetricsJob) Run() error { return err } - memoryRequest := job.processor.metricProvider.NewInstanceMetricRequest( - "compute.googleapis.com/instance/cpu/utilization", - fmt.Sprint(job.instance.GetId()), - starttime, - endtime, - 60, // 1 minute + memoryRequest := job.processor.metricProvider.NewTimeSeriesRequest( + fmt.Sprintf( + `metric.type="%s" AND resource.labels.instance_id="%s"`, + "compute.googleapis.com/instance/memory/balloon/ram_used", + fmt.Sprint(job.instance.GetId()), + ), + &monitoringpb.TimeInterval{ + EndTime: timestamppb.New(endTime), + StartTime: timestamppb.New(startTime), + }, + &monitoringpb.Aggregation{ + AlignmentPeriod: &durationpb.Duration{ + Seconds: 60, + }, + PerSeriesAligner: monitoringpb.Aggregation_ALIGN_MEAN, // will represent all the datapoints in the above period, with a mean + }, ) memoryMetric, err := job.processor.metricProvider.GetMetric(memoryRequest) diff --git a/plugin/service.go b/plugin/service.go index c2bfbb1..349277b 100644 --- a/plugin/service.go +++ b/plugin/service.go @@ -1,7 +1,9 @@ package plugin import ( + "context" "fmt" + "log" "github.com/kaytu-io/kaytu/pkg/plugin/proto/src/golang" "github.com/kaytu-io/kaytu/pkg/plugin/sdk" @@ -98,6 +100,18 @@ func (p *GCPPlugin) StartProcess(cmd string, flags map[string]string, kaytuAcces }, ) + log.Println("Initializing clients") + + err := gcpProvider.InitializeClient(context.Background()) + if err != nil { + return err + } + + err = metricClient.InitializeClient(context.Background()) + if err != nil { + return err + } + publishOptimizationItem := func(item *golang.ChartOptimizationItem) { p.stream.Send(&golang.PluginMessage{ PluginMessage: &golang.PluginMessage_Coi{ From 9563f3479b48059cc615535da75b85a76ee74704 Mon Sep 17 00:00:00 2001 From: Adnan Gulegulzar Date: Sun, 16 Jun 2024 23:22:58 -0400 Subject: [PATCH 05/20] utility function --- utils/extract_string.go | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 utils/extract_string.go diff --git a/utils/extract_string.go b/utils/extract_string.go new file mode 100644 index 0000000..1315b58 --- /dev/null +++ b/utils/extract_string.go @@ -0,0 +1,11 @@ +package util + +import "strings" + +func TrimmedString(s string, sep string) string { + + slc := strings.Split(s, sep) + + return slc[len(slc)-1] + +} From 208552e29a0648786b00a3052a68dc2289e39b96 Mon Sep 17 00:00:00 2001 From: Adnan Gulegulzar Date: Sun, 16 Jun 2024 23:26:01 -0400 Subject: [PATCH 06/20] adding devices --- .../compute_instance/compute_instance_item.go | 95 +++++++++++++++---- 1 file changed, 79 insertions(+), 16 deletions(-) diff --git a/plugin/processor/compute_instance/compute_instance_item.go b/plugin/processor/compute_instance/compute_instance_item.go index 744e7b1..f5785e7 100644 --- a/plugin/processor/compute_instance/compute_instance_item.go +++ b/plugin/processor/compute_instance/compute_instance_item.go @@ -1,8 +1,13 @@ package compute_instance import ( + "fmt" + "maps" + "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb" "github.com/kaytu-io/kaytu/pkg/plugin/proto/src/golang" + "github.com/kaytu-io/kaytu/pkg/utils" + "github.com/kaytu-io/plugin-gcp/plugin/kaytu" "google.golang.org/protobuf/types/known/wrapperspb" ) @@ -17,11 +22,79 @@ type ComputeInstanceItem struct { LazyLoadingEnabled bool SkipReason string Metrics map[string][]*monitoringpb.Point - // Wastage kaytu.EC2InstanceWastageResponse + Wastage kaytu.GcpComputeInstanceWastageResponse +} + +func (i ComputeInstanceItem) ComputeInstanceDevice() (*golang.ChartRow, map[string]*golang.Properties) { + row := golang.ChartRow{ + RowId: i.Id, + Values: make(map[string]*golang.ChartRowItem), + } + row.RowId = i.Id + + row.Values["resource_id"] = &golang.ChartRowItem{ + Value: i.Id, + } + row.Values["resource_name"] = &golang.ChartRowItem{ + Value: i.Name, + } + row.Values["resource_type"] = &golang.ChartRowItem{ + Value: "Compute Instance", + } + + row.Values["current_cost"] = &golang.ChartRowItem{ + Value: utils.FormatPriceFloat(i.Wastage.RightSizing.Current.Cost), + } + + regionProperty := &golang.Property{ + Key: "Zone", + Current: i.Wastage.RightSizing.Current.Zone, + } + + MachineTypeProperty := &golang.Property{ + Key: "Machine Type", + Current: i.Wastage.RightSizing.Current.MachineType, + } + + memoryProperty := &golang.Property{ + Key: " Memory", + Current: fmt.Sprintf("%d MB", i.Wastage.RightSizing.Current.MemoryMb), + Average: utils.Percentage(i.Wastage.RightSizing.Memory.Avg), + Max: utils.Percentage(i.Wastage.RightSizing.Memory.Max), + } + + props := make(map[string]*golang.Properties) + properties := &golang.Properties{} + + properties.Properties = append(properties.Properties, regionProperty) + properties.Properties = append(properties.Properties, MachineTypeProperty) + properties.Properties = append(properties.Properties, &golang.Property{ + Key: "Compute", + }) + properties.Properties = append(properties.Properties, memoryProperty) + + props[i.Id] = properties + + return &row, props +} + +func (i ComputeInstanceItem) Devices() ([]*golang.ChartRow, map[string]*golang.Properties) { + + var deviceRows []*golang.ChartRow + deviceProps := make(map[string]*golang.Properties) + + instanceRows, instanceProps := i.ComputeInstanceDevice() + + deviceRows = append(deviceRows, instanceRows) + maps.Copy(deviceProps, instanceProps) + + return deviceRows, deviceProps } func (i ComputeInstanceItem) ToOptimizationItem() *golang.ChartOptimizationItem { + deviceRows, deviceProps := i.Devices() + chartrow := &golang.ChartRow{ RowId: i.Id, Values: map[string]*golang.ChartRowItem{ @@ -34,13 +107,10 @@ func (i ComputeInstanceItem) ToOptimizationItem() *golang.ChartOptimizationItem }, } - oi := &golang.ChartOptimizationItem{ - OverviewChartRow: chartrow, - // Id: i.Id, - // Name: i.Name, - // ResourceType: i.MachineType, - // Region: i.Region, - // Devices: nil, + coi := &golang.ChartOptimizationItem{ + OverviewChartRow: chartrow, + DevicesChartRows: deviceRows, + DevicesProperties: deviceProps, Preferences: i.Preferences, Description: "description placeholder", Loading: i.OptimizationLoading, @@ -49,12 +119,5 @@ func (i ComputeInstanceItem) ToOptimizationItem() *golang.ChartOptimizationItem LazyLoadingEnabled: i.LazyLoadingEnabled, } - // if i.Instance.PlatformDetails != nil { - // oi.Platform = *i.Instance.PlatformDetails - // } - // if oi.Name == "" { - // oi.Name = string(i.Name) - // } - - return oi + return coi } From b62197560eb916165b94541fa717f04c05613192 Mon Sep 17 00:00:00 2001 From: Adnan Gulegulzar Date: Sun, 16 Jun 2024 23:38:12 -0400 Subject: [PATCH 07/20] adding identify --- plugin/gcp/config.go | 17 +++++++++++++---- plugin/gcp/config_test.go | 22 ++++++++++++++++++++++ 2 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 plugin/gcp/config_test.go diff --git a/plugin/gcp/config.go b/plugin/gcp/config.go index 144723f..95e0173 100644 --- a/plugin/gcp/config.go +++ b/plugin/gcp/config.go @@ -21,7 +21,9 @@ func NewGCP(scopes []string) GCP { } func (g *GCP) GetCredentials(ctx context.Context) error { - credentials, err := google.FindDefaultCredentials( + var err error + + g.credentials, err = google.FindDefaultCredentials( ctx, g.Scopes..., ) @@ -29,9 +31,16 @@ func (g *GCP) GetCredentials(ctx context.Context) error { return err } - json.Unmarshal(credentials.JSON, g) //this will store project id from credentials + json.Unmarshal(g.credentials.JSON, g) //this will store project id from credentials - g.credentials = credentials - // log.Println(g.ProjectID) return nil } + +func (g *GCP) Identify() map[string]string { + + identification := map[string]string{ + "project_id": g.ProjectID, + } + + return identification +} diff --git a/plugin/gcp/config_test.go b/plugin/gcp/config_test.go new file mode 100644 index 0000000..a9904d7 --- /dev/null +++ b/plugin/gcp/config_test.go @@ -0,0 +1,22 @@ +package gcp + +import ( + "log" + "testing" +) + +func TestIdentify(t *testing.T) { + + test_project_id := "test-project-id" + gcp := GCP{ + ProjectID: test_project_id, + } + + identification := gcp.Identify() + log.Println(identification) + + if identification["project_id"] != test_project_id { + t.Error("TestIdentify failed") + } + +} From 251f3a016683d4c52ff21ebffede12602b1cb6d1 Mon Sep 17 00:00:00 2001 From: Adnan Gulegulzar Date: Sun, 16 Jun 2024 23:48:20 -0400 Subject: [PATCH 08/20] metrics updated --- plugin/gcp/metrics.go | 35 ----------------------------------- plugin/gcp/metrics_test.go | 33 ++++++++++++++++++++++++--------- 2 files changed, 24 insertions(+), 44 deletions(-) diff --git a/plugin/gcp/metrics.go b/plugin/gcp/metrics.go index 2293efd..73aea05 100644 --- a/plugin/gcp/metrics.go +++ b/plugin/gcp/metrics.go @@ -3,12 +3,9 @@ package gcp import ( "context" "fmt" - "time" monitoring "cloud.google.com/go/monitoring/apiv3/v2" "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb" - "google.golang.org/protobuf/types/known/durationpb" - "google.golang.org/protobuf/types/known/timestamppb" ) type CloudMonitoring struct { @@ -60,38 +57,6 @@ func (c *CloudMonitoring) NewTimeSeriesRequest( } -func (c *CloudMonitoring) NewInstanceMetricRequest( - metricName string, // fully qualified name of the metric - instanceID string, // compute instance ID - startTime time.Time, // start time of requested time series - endTime time.Time, // end time of requested time series - periodInSeconds int64, // period, for which the datapoints will be aggregated into one, in seconds -) *monitoringpb.ListTimeSeriesRequest { - - request := &monitoringpb.ListTimeSeriesRequest{ - Name: fmt.Sprintf("projects/%s", c.ProjectID), - Filter: fmt.Sprintf( - `metric.type="%s" AND resource.labels.instance_id="%s"`, - metricName, - instanceID, - ), - Interval: &monitoringpb.TimeInterval{ - EndTime: timestamppb.New(endTime), - StartTime: timestamppb.New(startTime), - }, - Aggregation: &monitoringpb.Aggregation{ - AlignmentPeriod: &durationpb.Duration{ - Seconds: periodInSeconds, - }, - PerSeriesAligner: monitoringpb.Aggregation_ALIGN_MEAN, // will represent all the datapoints in the above period, with a mean - }, - View: monitoringpb.ListTimeSeriesRequest_FULL, - } - - return request - -} - func (c *CloudMonitoring) GetMetric(request *monitoringpb.ListTimeSeriesRequest) (*monitoringpb.TimeSeries, error) { it := c.client.ListTimeSeries(context.Background(), request) diff --git a/plugin/gcp/metrics_test.go b/plugin/gcp/metrics_test.go index 7c2e631..af8dc43 100644 --- a/plugin/gcp/metrics_test.go +++ b/plugin/gcp/metrics_test.go @@ -2,10 +2,15 @@ package gcp import ( "context" + "fmt" "log" "os" "testing" "time" + + "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb" + "google.golang.org/protobuf/types/known/durationpb" + "google.golang.org/protobuf/types/known/timestamppb" ) // run this test as @@ -15,8 +20,8 @@ func TestGetMetrics(t *testing.T) { //test variables id := os.Getenv("TEST_INSTANCE_ID") - endtime := time.Now() - starttime := endtime.Add(-24 * 1 * time.Hour) // 24 hours before current time + endTime := time.Now() + startTime := endTime.Add(-24 * 1 * time.Hour) // 24 hours before current time log.Printf("running %s", t.Name()) @@ -32,16 +37,26 @@ func TestGetMetrics(t *testing.T) { } // creating the metric request for the instance - request := metric.NewInstanceMetricRequest( - "compute.googleapis.com/instance/memory/balloon/ram_used", - id, - starttime, - endtime, - 60, + memoryRequest := metric.NewTimeSeriesRequest( + fmt.Sprintf( + `metric.type="%s" AND resource.labels.instance_id="%s"`, + "compute.googleapis.com/instance/memory/balloon/ram_used", + id, + ), + &monitoringpb.TimeInterval{ + EndTime: timestamppb.New(endTime), + StartTime: timestamppb.New(startTime), + }, + &monitoringpb.Aggregation{ + AlignmentPeriod: &durationpb.Duration{ + Seconds: 60, + }, + PerSeriesAligner: monitoringpb.Aggregation_ALIGN_NONE, // will represent all the datapoints in the above period, with a mean + }, ) // execute the request - resp, err := metric.GetMetric(request) + resp, err := metric.GetMetric(memoryRequest) if err != nil { t.Error(err) } From e6971ba702dab398e6b626658b2d0bdcc3161eed Mon Sep 17 00:00:00 2001 From: Adnan Gulegulzar Date: Sun, 16 Jun 2024 23:48:39 -0400 Subject: [PATCH 09/20] removing identification --- plugin/processor/compute_instance/compute_instance.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/plugin/processor/compute_instance/compute_instance.go b/plugin/processor/compute_instance/compute_instance.go index 9e1dda9..8f6cf41 100644 --- a/plugin/processor/compute_instance/compute_instance.go +++ b/plugin/processor/compute_instance/compute_instance.go @@ -10,9 +10,8 @@ import ( ) type ComputeInstanceProcessor struct { - provider *gcp.Compute - metricProvider *gcp.CloudMonitoring - // identification map[string]string + provider *gcp.Compute + metricProvider *gcp.CloudMonitoring items util.ConcurrentMap[string, ComputeInstanceItem] publishOptimizationItem func(item *golang.ChartOptimizationItem) publishResultSummary func(summary *golang.ResultSummary) @@ -30,9 +29,8 @@ func NewComputeInstanceProcessor( ) *ComputeInstanceProcessor { log.Println("creating processor") r := &ComputeInstanceProcessor{ - provider: prv, - metricProvider: metricPrv, - // identification: identification, + provider: prv, + metricProvider: metricPrv, items: util.NewMap[string, ComputeInstanceItem](), publishOptimizationItem: publishOptimizationItem, publishResultSummary: publishResultSummary, From 28b4939c2e4e2918da4e6bce375440bc27455078 Mon Sep 17 00:00:00 2001 From: Adnan Gulegulzar Date: Sun, 16 Jun 2024 23:49:41 -0400 Subject: [PATCH 10/20] optimize instance job --- go.mod | 2 - go.sum | 4 - .../job_get_compute_instance_metrics.go | 26 ++++--- .../job_optimize_compute_instance.go | 76 +++++++++++++++++++ 4 files changed, 93 insertions(+), 15 deletions(-) create mode 100644 plugin/processor/compute_instance/job_optimize_compute_instance.go diff --git a/go.mod b/go.mod index f260518..ad453bf 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,6 @@ go 1.21.5 require ( cloud.google.com/go/compute v1.25.1 cloud.google.com/go/monitoring v1.18.0 - github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.38.6 github.com/google/uuid v1.6.0 github.com/kaytu-io/kaytu v0.10.5 golang.org/x/oauth2 v0.21.0 @@ -15,7 +14,6 @@ require ( require ( cloud.google.com/go/compute/metadata v0.3.0 // indirect - github.com/aws/smithy-go v1.20.2 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect diff --git a/go.sum b/go.sum index 66df2df..7755ea7 100644 --- a/go.sum +++ b/go.sum @@ -8,10 +8,6 @@ cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1h cloud.google.com/go/monitoring v1.18.0 h1:NfkDLQDG2UR3WYZVQE8kwSbUIEyIqJUPl+aOQdFH1T4= cloud.google.com/go/monitoring v1.18.0/go.mod h1:c92vVBCeq/OB4Ioyo+NbN2U7tlg5ZH41PZcdvfc+Lcg= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.38.6 h1:UVjxYe8VGpwXYcmBcciBHlQrNssdEvntXCPWmnRR15U= -github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.38.6/go.mod h1:4V6VDA0kZavRn71+sLpVna75oobnlG+gwtnNcBwZhu4= -github.com/aws/smithy-go v1.20.2 h1:tbp628ireGtzcHDDmLT/6ADHidqnwgF57XOXZe6tp4Q= -github.com/aws/smithy-go v1.20.2/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= diff --git a/plugin/processor/compute_instance/job_get_compute_instance_metrics.go b/plugin/processor/compute_instance/job_get_compute_instance_metrics.go index eb9d7de..7a48dd9 100644 --- a/plugin/processor/compute_instance/job_get_compute_instance_metrics.go +++ b/plugin/processor/compute_instance/job_get_compute_instance_metrics.go @@ -9,6 +9,7 @@ import ( "cloud.google.com/go/compute/apiv1/computepb" "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb" "github.com/kaytu-io/plugin-gcp/plugin/preferences" + util "github.com/kaytu-io/plugin-gcp/utils" "google.golang.org/protobuf/types/known/durationpb" "google.golang.org/protobuf/types/known/timestamppb" ) @@ -26,31 +27,36 @@ func NewGetComputeInstanceMetricsJob(processor *ComputeInstanceProcessor, instan } func (job *GetComputeInstanceMetricsJob) Id() string { - return "get_compute_instance_metrics" + return fmt.Sprintf("get_compute_instance_metrics_%d", job.instance.GetId()) } func (job *GetComputeInstanceMetricsJob) Description() string { - return "Get metrics for the specified compute instance" + return fmt.Sprintf("Get metrics for compute instance: %d", job.instance.GetId()) } func (job *GetComputeInstanceMetricsJob) Run() error { - endTime := time.Now() - startTime := endTime.Add(-24 * 1 * time.Hour) + endTime := time.Now() // end time of requested time series + startTime := endTime.Add(-24 * 1 * time.Hour) // start time of requested time series + // metricName string, + // instanceID string, + // startTime time.Time, + // endTime time.Time, + // periodInSeconds int64, cpuRequest := job.processor.metricProvider.NewTimeSeriesRequest( fmt.Sprintf( `metric.type="%s" AND resource.labels.instance_id="%s"`, - "compute.googleapis.com/instance/cpu/utilization", - fmt.Sprint(job.instance.GetId()), + "compute.googleapis.com/instance/cpu/utilization", // fully qualified name of the metric + fmt.Sprint(job.instance.GetId()), // compute instance ID ), &monitoringpb.TimeInterval{ EndTime: timestamppb.New(endTime), StartTime: timestamppb.New(startTime), }, &monitoringpb.Aggregation{ - AlignmentPeriod: &durationpb.Duration{ + AlignmentPeriod: &durationpb.Duration{ // period, for which the datapoints will be aggregated into one, in seconds Seconds: 60, }, PerSeriesAligner: monitoringpb.Aggregation_ALIGN_MEAN, // will represent all the datapoints in the above period, with a mean @@ -93,8 +99,8 @@ func (job *GetComputeInstanceMetricsJob) Run() error { oi := ComputeInstanceItem{ Name: *job.instance.Name, Id: strconv.FormatUint(job.instance.GetId(), 10), - MachineType: job.instance.GetMachineType(), - Region: job.instance.GetZone(), + MachineType: util.TrimmedString(*job.instance.MachineType, "/"), + Region: util.TrimmedString(*job.instance.Zone, "/"), OptimizationLoading: false, Preferences: preferences.DefaultComputeEnginePreferences, Skipped: false, @@ -110,6 +116,8 @@ func (job *GetComputeInstanceMetricsJob) Run() error { job.processor.items.Set(oi.Id, oi) job.processor.publishOptimizationItem(oi.ToOptimizationItem()) + job.processor.jobQueue.Push(NewOptimizeComputeInstancesJob(job.processor, oi)) + return nil } diff --git a/plugin/processor/compute_instance/job_optimize_compute_instance.go b/plugin/processor/compute_instance/job_optimize_compute_instance.go new file mode 100644 index 0000000..22e625b --- /dev/null +++ b/plugin/processor/compute_instance/job_optimize_compute_instance.go @@ -0,0 +1,76 @@ +package compute_instance + +import ( + "fmt" + + "github.com/google/uuid" + "github.com/kaytu-io/kaytu/pkg/utils" + "github.com/kaytu-io/kaytu/preferences" + "github.com/kaytu-io/plugin-gcp/plugin/kaytu" + "github.com/kaytu-io/plugin-gcp/plugin/version" +) + +type OptimizeComputeInstancesJob struct { + processor *ComputeInstanceProcessor + item ComputeInstanceItem +} + +func NewOptimizeComputeInstancesJob(processor *ComputeInstanceProcessor, item ComputeInstanceItem) *OptimizeComputeInstancesJob { + return &OptimizeComputeInstancesJob{ + processor: processor, + item: item, + } +} + +func (job *OptimizeComputeInstancesJob) Id() string { + return fmt.Sprintf("optimize_compute_isntance_%s", job.item.Id) +} + +func (job *OptimizeComputeInstancesJob) Description() string { + return fmt.Sprintf("Optimizing %s", job.item.Id) + +} + +func (job *OptimizeComputeInstancesJob) Run() error { + + requestId := uuid.NewString() + + request := kaytu.GcpComputeInstanceWastageRequest{ + RequestId: &requestId, + CliVersion: &version.VERSION, + Identification: job.processor.provider.Identify(), + Instance: kaytu.GcpComputeInstance{ + HashedInstanceId: utils.HashString(job.item.Id), + Zone: job.item.Region, + MachineType: job.item.MachineType, + }, + Metrics: job.item.Metrics, + Region: job.item.Region, + Preferences: preferences.Export(job.item.Preferences), + Loading: false, + } + + response, err := kaytu.Ec2InstanceWastageRequest(request, job.processor.kaytuAcccessToken) + if err != nil { + return err + } + + job.item = ComputeInstanceItem{ + Name: job.item.Name, + Id: job.item.Id, + MachineType: job.item.MachineType, + Region: job.item.Region, + OptimizationLoading: false, + Preferences: job.item.Preferences, + Skipped: false, + LazyLoadingEnabled: false, + SkipReason: "NA", + Metrics: job.item.Metrics, + Wastage: *response, + } + + job.processor.items.Set(job.item.Id, job.item) + job.processor.publishOptimizationItem(job.item.ToOptimizationItem()) + + return nil +} From 07d637b380e4ad21cf279fe7e7097d1ac371419e Mon Sep 17 00:00:00 2001 From: artaasadi Date: Tue, 18 Jun 2024 00:44:04 +0200 Subject: [PATCH 11/20] fix: change metrics type --- plugin/gcp/config.go | 2 ++ plugin/gcp/metrics.go | 34 +++++++++++++++---- plugin/kaytu/compute_instance.go | 26 ++++++++------ plugin/kaytu/request.go | 1 - .../compute_instance/compute_instance_item.go | 3 +- .../job_get_compute_instance_metrics.go | 7 ++-- 6 files changed, 50 insertions(+), 23 deletions(-) diff --git a/plugin/gcp/config.go b/plugin/gcp/config.go index 95e0173..694b968 100644 --- a/plugin/gcp/config.go +++ b/plugin/gcp/config.go @@ -31,6 +31,8 @@ func (g *GCP) GetCredentials(ctx context.Context) error { return err } + g.ProjectID = g.credentials.ProjectID + json.Unmarshal(g.credentials.JSON, g) //this will store project id from credentials return nil diff --git a/plugin/gcp/metrics.go b/plugin/gcp/metrics.go index 73aea05..911c203 100644 --- a/plugin/gcp/metrics.go +++ b/plugin/gcp/metrics.go @@ -3,6 +3,8 @@ package gcp import ( "context" "fmt" + "github.com/kaytu-io/plugin-gcp/plugin/kaytu" + "google.golang.org/api/iterator" monitoring "cloud.google.com/go/monitoring/apiv3/v2" "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb" @@ -57,15 +59,35 @@ func (c *CloudMonitoring) NewTimeSeriesRequest( } -func (c *CloudMonitoring) GetMetric(request *monitoringpb.ListTimeSeriesRequest) (*monitoringpb.TimeSeries, error) { +func (c *CloudMonitoring) GetMetric(request *monitoringpb.ListTimeSeriesRequest) ([]kaytu.Datapoint, error) { + var dps []kaytu.Datapoint it := c.client.ListTimeSeries(context.Background(), request) - - resp, err := it.Next() - if err != nil { - return nil, err + for { + resp, err := it.Next() + + if err != nil { + if err == iterator.Done { + break + } else { + return nil, err + } + } + dps = append(dps, convertDatapoints(resp)...) } - return resp, err + return dps, nil } + +func convertDatapoints(resp *monitoringpb.TimeSeries) []kaytu.Datapoint { + var dps []kaytu.Datapoint + for _, dp := range resp.GetPoints() { + dps = append(dps, kaytu.Datapoint{ + Value: dp.GetValue().GetDoubleValue(), + StartTime: dp.GetInterval().GetStartTime().AsTime(), + EndTime: dp.GetInterval().GetEndTime().AsTime(), + }) + } + return dps +} diff --git a/plugin/kaytu/compute_instance.go b/plugin/kaytu/compute_instance.go index b71a2b3..2c11927 100644 --- a/plugin/kaytu/compute_instance.go +++ b/plugin/kaytu/compute_instance.go @@ -1,8 +1,6 @@ package kaytu -import ( - "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb" -) +import "time" type GcpComputeInstance struct { HashedInstanceId string `json:"hashedInstanceId"` @@ -31,20 +29,26 @@ 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][]*monitoringpb.Point `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"` + Metrics map[string][]Datapoint `json:"metrics"` + Region string `json:"region"` + Preferences map[string]*string `json:"preferences"` + Loading bool `json:"loading"` } type GcpComputeInstanceWastageResponse struct { RightSizing GcpComputeInstanceRightsizingRecommendation `json:"rightSizing"` } +type Datapoint struct { + StartTime time.Time + EndTime time.Time + Value float64 +} + type Usage struct { Avg *float64 Min *float64 diff --git a/plugin/kaytu/request.go b/plugin/kaytu/request.go index c117f22..c2a3ea2 100644 --- a/plugin/kaytu/request.go +++ b/plugin/kaytu/request.go @@ -17,7 +17,6 @@ func Ec2InstanceWastageRequest(reqBody GcpComputeInstanceWastageRequest, token s return nil, err } req, err := http.NewRequest("POST", "https://api.kaytu.io/kaytu/wastage/api/v1/wastage/gcp-compute", bytes.NewBuffer(payloadEncoded)) - //req, err := http.NewRequest("POST", "http://localhost:8000/api/v1/wastage/ec2-instance", bytes.NewBuffer(payloadEncoded)) if err != nil { return nil, fmt.Errorf("[ec2-instance]: %v", err) } diff --git a/plugin/processor/compute_instance/compute_instance_item.go b/plugin/processor/compute_instance/compute_instance_item.go index f5785e7..110b44b 100644 --- a/plugin/processor/compute_instance/compute_instance_item.go +++ b/plugin/processor/compute_instance/compute_instance_item.go @@ -4,7 +4,6 @@ import ( "fmt" "maps" - "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb" "github.com/kaytu-io/kaytu/pkg/plugin/proto/src/golang" "github.com/kaytu-io/kaytu/pkg/utils" "github.com/kaytu-io/plugin-gcp/plugin/kaytu" @@ -21,7 +20,7 @@ type ComputeInstanceItem struct { Skipped bool LazyLoadingEnabled bool SkipReason string - Metrics map[string][]*monitoringpb.Point + Metrics map[string][]kaytu.Datapoint Wastage kaytu.GcpComputeInstanceWastageResponse } diff --git a/plugin/processor/compute_instance/job_get_compute_instance_metrics.go b/plugin/processor/compute_instance/job_get_compute_instance_metrics.go index 7a48dd9..c864b05 100644 --- a/plugin/processor/compute_instance/job_get_compute_instance_metrics.go +++ b/plugin/processor/compute_instance/job_get_compute_instance_metrics.go @@ -2,6 +2,7 @@ package compute_instance import ( "fmt" + "github.com/kaytu-io/plugin-gcp/plugin/kaytu" "log" "strconv" "time" @@ -91,10 +92,10 @@ func (job *GetComputeInstanceMetricsJob) Run() error { return err } - instanceMetrics := make(map[string][]*monitoringpb.Point) + instanceMetrics := make(map[string][]kaytu.Datapoint) - instanceMetrics["cpuUtilization"] = cpumetric.GetPoints() - instanceMetrics["memoryUtilization"] = memoryMetric.GetPoints() + instanceMetrics["cpuUtilization"] = cpumetric + instanceMetrics["memoryUtilization"] = memoryMetric oi := ComputeInstanceItem{ Name: *job.instance.Name, From 1791659f1ee7551e8437b22e907b7a314e6789b5 Mon Sep 17 00:00:00 2001 From: artaasadi Date: Wed, 19 Jun 2024 15:22:37 +0200 Subject: [PATCH 12/20] fix: update kaytu package --- go.mod | 59 +++++- go.sum | 179 ++++++++++++++++++ .../compute_instance/compute_instance.go | 4 + .../job_compute_instance_list.go | 3 +- .../job_get_compute_instance_metrics.go | 3 +- .../job_optimize_compute_instance.go | 3 +- plugin/processor/interface.go | 1 + plugin/service.go | 10 +- 8 files changed, 255 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index ad453bf..a8b19b6 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( cloud.google.com/go/compute v1.25.1 cloud.google.com/go/monitoring v1.18.0 github.com/google/uuid v1.6.0 - github.com/kaytu-io/kaytu v0.10.5 + github.com/kaytu-io/kaytu v0.14.0-rc.0.0.20240619114201-51f5733d10b6 golang.org/x/oauth2 v0.21.0 google.golang.org/api v0.169.0 google.golang.org/protobuf v1.34.2 @@ -14,17 +14,69 @@ require ( require ( cloud.google.com/go/compute/metadata v0.3.0 // indirect + dario.cat/mergo v1.0.0 // indirect + github.com/Microsoft/go-winio v0.6.2 // indirect + github.com/ProtonMail/go-crypto v1.0.0 // indirect + github.com/agext/levenshtein v1.2.3 // indirect + github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect + github.com/atotto/clipboard v0.1.4 // indirect + github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect + github.com/charmbracelet/bubbles v0.18.0 // indirect + github.com/charmbracelet/bubbletea v0.26.4 // indirect + github.com/charmbracelet/lipgloss v0.10.0 // indirect + github.com/charmbracelet/x/ansi v0.1.2 // indirect + github.com/charmbracelet/x/input v0.1.1 // indirect + github.com/charmbracelet/x/term v0.1.1 // indirect + github.com/charmbracelet/x/windows v0.1.2 // indirect + github.com/cloudflare/circl v1.3.8 // indirect + github.com/cyphar/filepath-securejoin v0.2.5 // indirect + github.com/emirpasic/gods v1.18.1 // indirect + github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect + github.com/evertras/bubble-table v0.16.0 // indirect + github.com/fatih/color v1.17.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect + github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect + github.com/go-git/go-billy/v5 v5.5.0 // indirect + github.com/go-git/go-git/v5 v5.12.0 // indirect github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect + github.com/golang-jwt/jwt/v4 v4.5.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.4 // indirect + github.com/google/go-cmp v0.6.0 // indirect + github.com/google/go-github v17.0.0+incompatible // indirect + github.com/google/go-github/v62 v62.0.0 // indirect + github.com/google/go-querystring v1.1.0 // indirect github.com/google/s2a-go v0.1.7 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect github.com/googleapis/gax-go/v2 v2.12.2 // indirect + github.com/hashicorp/hcl/v2 v2.20.1 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect + github.com/jedib0t/go-pretty/v6 v6.5.9 // indirect + github.com/kevinburke/ssh_config v1.2.0 // indirect + github.com/lucasb-eyer/go-colorful v1.2.0 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mattn/go-localereader v0.0.1 // indirect + github.com/mattn/go-runewidth v0.0.15 // indirect + github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect + github.com/mitchellh/go-wordwrap v1.0.1 // indirect + github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect + github.com/muesli/cancelreader v0.2.2 // indirect + github.com/muesli/reflow v0.3.0 // indirect + github.com/muesli/termenv v0.15.2 // indirect + github.com/pjbgf/sha1cd v0.3.0 // indirect + github.com/rivo/uniseg v0.4.7 // indirect + github.com/rogpeppe/go-internal v1.12.0 // indirect + github.com/schollz/progressbar/v3 v3.14.3 // indirect + github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect + github.com/skeema/knownhosts v1.2.2 // indirect github.com/spf13/cobra v1.8.0 // indirect github.com/spf13/pflag v1.0.5 // indirect + github.com/xanzy/ssh-agent v0.3.3 // indirect + github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect + github.com/zclconf/go-cty v1.14.4 // indirect go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect @@ -32,13 +84,18 @@ require ( go.opentelemetry.io/otel/metric v1.24.0 // indirect go.opentelemetry.io/otel/trace v1.24.0 // indirect golang.org/x/crypto v0.24.0 // indirect + golang.org/x/mod v0.17.0 // indirect golang.org/x/net v0.26.0 // indirect golang.org/x/sync v0.7.0 // indirect golang.org/x/sys v0.21.0 // indirect + golang.org/x/term v0.21.0 // indirect golang.org/x/text v0.16.0 // indirect golang.org/x/time v0.5.0 // indirect + golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240610135401-a8a62080eff3 // indirect google.golang.org/grpc v1.64.0 // indirect + gopkg.in/warnings.v0 v0.1.2 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/go.sum b/go.sum index 7755ea7..f89c839 100644 --- a/go.sum +++ b/go.sum @@ -7,25 +7,76 @@ cloud.google.com/go/compute/metadata v0.3.0 h1:Tz+eQXMEqDIKRsmY3cHTL6FVaynIjX2Qx cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= cloud.google.com/go/monitoring v1.18.0 h1:NfkDLQDG2UR3WYZVQE8kwSbUIEyIqJUPl+aOQdFH1T4= cloud.google.com/go/monitoring v1.18.0/go.mod h1:c92vVBCeq/OB4Ioyo+NbN2U7tlg5ZH41PZcdvfc+Lcg= +dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= +dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= +github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= +github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= +github.com/ProtonMail/go-crypto v1.0.0 h1:LRuvITjQWX+WIfr930YHG2HNfjR1uOfyf5vE0kC2U78= +github.com/ProtonMail/go-crypto v1.0.0/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= +github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo= +github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= +github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= +github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= +github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4= +github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI= +github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= +github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= +github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/charmbracelet/bubbles v0.18.0 h1:PYv1A036luoBGroX6VWjQIE9Syf2Wby2oOl/39KLfy0= +github.com/charmbracelet/bubbles v0.18.0/go.mod h1:08qhZhtIwzgrtBjAcJnij1t1H0ZRjwHyGsy6AL11PSw= +github.com/charmbracelet/bubbletea v0.26.4 h1:2gDkkzLZaTjMl/dQBpNVtnvcCxsh/FCkimep7FC9c40= +github.com/charmbracelet/bubbletea v0.26.4/go.mod h1:P+r+RRA5qtI1DOHNFn0otoNwB4rn+zNAzSj/EXz6xU0= +github.com/charmbracelet/lipgloss v0.10.0 h1:KWeXFSexGcfahHX+54URiZGkBFazf70JNMtwg/AFW3s= +github.com/charmbracelet/lipgloss v0.10.0/go.mod h1:Wig9DSfvANsxqkRsqj6x87irdy123SR4dOXlKa91ciE= +github.com/charmbracelet/x/ansi v0.1.2 h1:6+LR39uG8DE6zAmbu023YlqjJHkYXDF1z36ZwzO4xZY= +github.com/charmbracelet/x/ansi v0.1.2/go.mod h1:dk73KoMTT5AX5BsX0KrqhsTqAnhZZoCBjs7dGWp4Ktw= +github.com/charmbracelet/x/input v0.1.1 h1:YDOJaTUKCqtGnq9PHzx3pkkl4pXDOANUHmhH3DqMtM4= +github.com/charmbracelet/x/input v0.1.1/go.mod h1:jvdTVUnNWj/RD6hjC4FsoB0SeZCJ2ZBkiuFP9zXvZI0= +github.com/charmbracelet/x/term v0.1.1 h1:3cosVAiPOig+EV4X9U+3LDgtwwAoEzJjNdwbXDjF6yI= +github.com/charmbracelet/x/term v0.1.1/go.mod h1:wB1fHt5ECsu3mXYusyzcngVWWlu1KKUmmLhfgr/Flxw= +github.com/charmbracelet/x/windows v0.1.2 h1:Iumiwq2G+BRmgoayww/qfcvof7W/3uLoelhxojXlRWg= +github.com/charmbracelet/x/windows v0.1.2/go.mod h1:GLEO/l+lizvFDBPLIOk+49gdX49L9YWMB5t+DZd0jkQ= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= +github.com/cloudflare/circl v1.3.8 h1:j+V8jJt09PoeMFIu2uh5JUyEaIHTXVOHslFoLNAKqwI= +github.com/cloudflare/circl v1.3.8/go.mod h1:PDRU+oXvdD7KCtgKxW95M5Z8BpSCJXQORiZFnBQS5QU= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cyphar/filepath-securejoin v0.2.5 h1:6iR5tXJ/e6tJZzzdMc1km3Sa7RRIVBKAK32O2s7AYfo= +github.com/cyphar/filepath-securejoin v0.2.5/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= +github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6baUTXGLOoWe4PQhGxaX0KpnayAqC48p4= +github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97MGsxSvLiUE2X8qFplwetxpGLQrlU1Q9AUEIzCaM= +github.com/evertras/bubble-table v0.16.0 h1:Bt2cPukoP8DSWVpBcPSq2E3W2fs7R0mf5BaIFQxFPfM= +github.com/evertras/bubble-table v0.16.0/go.mod h1:SPOZKbIpyYWPHBNki3fyNpiPBQkvkULAtOT7NTD5fKY= +github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= +github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= +github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= +github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU= +github.com/go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow= +github.com/go-git/go-git/v5 v5.12.0 h1:7Md+ndsjrzZxbddRDZjF14qK+NN56sy6wkqaVrjZtys= +github.com/go-git/go-git/v5 v5.12.0/go.mod h1:FTM9VKtnI2m65hNI/TenDDDnUf2Q9FHnXYjuz9i5OEY= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= +github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= @@ -47,9 +98,16 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY= +github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= +github.com/google/go-github/v62 v62.0.0 h1:/6mGCaRywZz9MuHyw9gD1CwsbmBX8GWsbFkwMmHdhl4= +github.com/google/go-github/v62 v62.0.0/go.mod h1:EMxeUqGJq2xRu9DYBMwel/mr7kZrzUOfQmmpYrZn2a4= +github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= +github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -59,14 +117,68 @@ github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfF github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= github.com/googleapis/gax-go/v2 v2.12.2 h1:mhN09QQW1jEWeMF74zGR81R30z4VJzjZsfkUhuHF+DA= github.com/googleapis/gax-go/v2 v2.12.2/go.mod h1:61M8vcyyXR2kqKFxKrfA22jaA8JGF7Dc8App1U3H6jc= +github.com/hashicorp/hcl/v2 v2.20.1 h1:M6hgdyz7HYt1UN9e61j+qKJBqR3orTWbI1HKBJEdxtc= +github.com/hashicorp/hcl/v2 v2.20.1/go.mod h1:TZDqQ4kNKCbh1iJp99FdPiUaVDDUPivbqxZulxDYqL4= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= +github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= +github.com/jedib0t/go-pretty/v6 v6.5.9 h1:ACteMBRrrmm1gMsXe9PSTOClQ63IXDUt03H5U+UV8OU= +github.com/jedib0t/go-pretty/v6 v6.5.9/go.mod h1:zbn98qrYlh95FIhwwsbIip0LYpwSG8SUOScs+v9/t0E= +github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213/go.mod h1:vNUNkEQ1e29fT/6vq2aBdFsgNPmy8qMdSay1npru+Sw= github.com/kaytu-io/kaytu v0.10.5 h1:EGrvEQTjnIC06ix2rUt0RBlxHjS50pHKifSVQJOH1Ho= github.com/kaytu-io/kaytu v0.10.5/go.mod h1:BhFDEm+6ckgusHsrDCdgSH+b/wMhuRsq29L8/PJe2Sk= +github.com/kaytu-io/kaytu v0.14.0-rc.0.0.20240619114201-51f5733d10b6 h1:OyrvbIttya/35K+6N1tyI953BlKclIkHGWIZ/IPYheg= +github.com/kaytu-io/kaytu v0.14.0-rc.0.0.20240619114201-51f5733d10b6/go.mod h1:csDLaCgTnp/D9SZuo55KjOzp/BYfkhkeSkGuEiCljtc= +github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= +github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= +github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4= +github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88= +github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= +github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= +github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ= +github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw= +github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0= +github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0= +github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI= +github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo= +github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA= +github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo= +github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s= +github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8= +github.com/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo= +github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8= +github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= +github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= +github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/schollz/progressbar/v3 v3.14.3 h1:oOuWW19ka12wxYU1XblR4n16wF/2Y1dBLMarMo6p4xU= +github.com/schollz/progressbar/v3 v3.14.3/go.mod h1:aT3UQ7yGm+2ZjeXPqsjTenwL3ddUiuZ0kfQ/2tHlyNI= +github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= +github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= +github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/skeema/knownhosts v1.2.2 h1:Iug2P4fLmDw9f41PB6thxUkNUkJzB5i+1/exaj40L3A= +github.com/skeema/knownhosts v1.2.2/go.mod h1:xYbVRSPxqBZFrdmDyMmsOs+uX1UZC3nTN3ThzgDxUwo= github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= @@ -74,11 +186,21 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= +github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= +github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no= +github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +github.com/zclconf/go-cty v1.14.4 h1:uXXczd9QDGsgu0i/QFR/hzI5NYCHLf6NQw/atrbnhq8= +github.com/zclconf/go-cty v1.14.4/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 h1:4Pp6oUg3+e/6M4C0A/3kJ2VYa++dsWVTtGgLVj5xtHg= @@ -95,18 +217,33 @@ go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= +golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -115,16 +252,46 @@ golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbht golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= +golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= +golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA= +golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= @@ -134,6 +301,12 @@ golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.169.0 h1:QwWPy71FgMWqJN/l6jVlFHUa29a7dcUy02I8o799nPY= google.golang.org/api v0.169.0/go.mod h1:gpNOiMA2tZ4mf5R9Iwf4rK/Dcz0fbdIgWYWVoxmsyLg= @@ -167,6 +340,12 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= +gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/plugin/processor/compute_instance/compute_instance.go b/plugin/processor/compute_instance/compute_instance.go index 8f6cf41..8449ab3 100644 --- a/plugin/processor/compute_instance/compute_instance.go +++ b/plugin/processor/compute_instance/compute_instance.go @@ -51,3 +51,7 @@ func (m *ComputeInstanceProcessor) ReEvaluate(id string, items []*golang.Prefere // m.items.Set(id, v) // m.jobQueue.Push(NewOptimizeEC2InstanceJob(m, v)) } + +func (p *ComputeInstanceProcessor) ExportNonInteractive() *golang.NonInteractiveExport { + return nil +} diff --git a/plugin/processor/compute_instance/job_compute_instance_list.go b/plugin/processor/compute_instance/job_compute_instance_list.go index 9f7ab77..ffea062 100644 --- a/plugin/processor/compute_instance/job_compute_instance_list.go +++ b/plugin/processor/compute_instance/job_compute_instance_list.go @@ -1,6 +1,7 @@ package compute_instance import ( + "context" "log" "strconv" @@ -26,7 +27,7 @@ func (job *ListComputeInstancesJob) Description() string { } -func (job *ListComputeInstancesJob) Run() error { +func (job *ListComputeInstancesJob) Run(ctx context.Context) error { log.Println("Running list compute instance job") diff --git a/plugin/processor/compute_instance/job_get_compute_instance_metrics.go b/plugin/processor/compute_instance/job_get_compute_instance_metrics.go index c864b05..67abffa 100644 --- a/plugin/processor/compute_instance/job_get_compute_instance_metrics.go +++ b/plugin/processor/compute_instance/job_get_compute_instance_metrics.go @@ -1,6 +1,7 @@ package compute_instance import ( + "context" "fmt" "github.com/kaytu-io/plugin-gcp/plugin/kaytu" "log" @@ -36,7 +37,7 @@ func (job *GetComputeInstanceMetricsJob) Description() string { } -func (job *GetComputeInstanceMetricsJob) Run() error { +func (job *GetComputeInstanceMetricsJob) Run(ctx context.Context) error { endTime := time.Now() // end time of requested time series startTime := endTime.Add(-24 * 1 * time.Hour) // start time of requested time series diff --git a/plugin/processor/compute_instance/job_optimize_compute_instance.go b/plugin/processor/compute_instance/job_optimize_compute_instance.go index 22e625b..87689e7 100644 --- a/plugin/processor/compute_instance/job_optimize_compute_instance.go +++ b/plugin/processor/compute_instance/job_optimize_compute_instance.go @@ -1,6 +1,7 @@ package compute_instance import ( + "context" "fmt" "github.com/google/uuid" @@ -31,7 +32,7 @@ func (job *OptimizeComputeInstancesJob) Description() string { } -func (job *OptimizeComputeInstancesJob) Run() error { +func (job *OptimizeComputeInstancesJob) Run(ctx context.Context) error { requestId := uuid.NewString() diff --git a/plugin/processor/interface.go b/plugin/processor/interface.go index 9b0a71e..e53220b 100644 --- a/plugin/processor/interface.go +++ b/plugin/processor/interface.go @@ -4,4 +4,5 @@ import "github.com/kaytu-io/kaytu/pkg/plugin/proto/src/golang" type PluginProcessor interface { ReEvaluate(id string, items []*golang.PreferenceItem) + ExportNonInteractive() *golang.NonInteractiveExport } diff --git a/plugin/service.go b/plugin/service.go index 349277b..00aa039 100644 --- a/plugin/service.go +++ b/plugin/service.go @@ -15,7 +15,7 @@ import ( ) type GCPPlugin struct { - stream golang.Plugin_RegisterClient + stream *sdk.StreamController processor processor.PluginProcessor } @@ -80,7 +80,7 @@ func (p *GCPPlugin) GetConfig() golang.RegisterConfig { } } -func (p *GCPPlugin) SetStream(stream golang.Plugin_RegisterClient) { +func (p *GCPPlugin) SetStream(stream *sdk.StreamController) { p.stream = stream } @@ -152,7 +152,7 @@ func (p *GCPPlugin) StartProcess(cmd string, flags map[string]string, kaytuAcces } else { return fmt.Errorf("invalid command: %s", cmd) } - jobQueue.SetOnFinish(func() { + jobQueue.SetOnFinish(func(ctx context.Context) { publishResultsReady(true) }) @@ -162,3 +162,7 @@ func (p *GCPPlugin) StartProcess(cmd string, flags map[string]string, kaytuAcces func (p *GCPPlugin) ReEvaluate(evaluate *golang.ReEvaluate) { p.processor.ReEvaluate(evaluate.Id, evaluate.Preferences) } + +func (p *GCPPlugin) ExportNonInteractive() *golang.NonInteractiveExport { + return nil +} From 145769794cbb2129ea197c90baf85959c562038a Mon Sep 17 00:00:00 2001 From: Adnan Gulegulzar Date: Wed, 19 Jun 2024 21:33:34 -0400 Subject: [PATCH 13/20] fixing tests --- plugin/gcp/metrics_test.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/plugin/gcp/metrics_test.go b/plugin/gcp/metrics_test.go index af8dc43..8f2a388 100644 --- a/plugin/gcp/metrics_test.go +++ b/plugin/gcp/metrics_test.go @@ -3,7 +3,6 @@ package gcp import ( "context" "fmt" - "log" "os" "testing" "time" @@ -23,7 +22,7 @@ func TestGetMetrics(t *testing.T) { endTime := time.Now() startTime := endTime.Add(-24 * 1 * time.Hour) // 24 hours before current time - log.Printf("running %s", t.Name()) + t.Logf("running %s", t.Name()) // creating and initializing client metric := NewCloudMonitoring( @@ -61,11 +60,11 @@ func TestGetMetrics(t *testing.T) { t.Error(err) } - log.Printf("metrics: %s", resp.GetMetric().String()) - log.Printf("resource: %s", resp.GetResource().String()) - log.Printf("# of points: %d", len(resp.Points)) - log.Println(resp.Unit) - log.Printf("Point 1 : %.0f %s", resp.GetPoints()[0].GetValue().GetDoubleValue(), resp.GetUnit()) + // log.Printf("metrics: %s", resp.GetMetric().String()) + // log.Printf("resource: %s", resp.GetResource().String()) + t.Logf("datapoints: %d", len(resp)) + // log.Println(resp.Unit) + // log.Printf("Point 1 : %.0f %s", resp.GetPoints()[0].GetValue().GetDoubleValue(), resp.GetUnit()) // for _, point := range resp.Points { // log.Printf("Point : %.0f", point.GetValue().GetDoubleValue()) From b10dd716cf50f1ff19ff18909aa13c356a02c710 Mon Sep 17 00:00:00 2001 From: Adnan Gulegulzar Date: Wed, 19 Jun 2024 22:59:05 -0400 Subject: [PATCH 14/20] displaying recommendation information --- go.mod | 57 ------ go.sum | 179 ------------------ .../compute_instance/compute_instance_item.go | 49 ++++- plugin/service.go | 73 +++++-- 4 files changed, 101 insertions(+), 257 deletions(-) diff --git a/go.mod b/go.mod index a8b19b6..1f419ec 100644 --- a/go.mod +++ b/go.mod @@ -14,69 +14,17 @@ require ( require ( cloud.google.com/go/compute/metadata v0.3.0 // indirect - dario.cat/mergo v1.0.0 // indirect - github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/ProtonMail/go-crypto v1.0.0 // indirect - github.com/agext/levenshtein v1.2.3 // indirect - github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect - github.com/atotto/clipboard v0.1.4 // indirect - github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect - github.com/charmbracelet/bubbles v0.18.0 // indirect - github.com/charmbracelet/bubbletea v0.26.4 // indirect - github.com/charmbracelet/lipgloss v0.10.0 // indirect - github.com/charmbracelet/x/ansi v0.1.2 // indirect - github.com/charmbracelet/x/input v0.1.1 // indirect - github.com/charmbracelet/x/term v0.1.1 // indirect - github.com/charmbracelet/x/windows v0.1.2 // indirect - github.com/cloudflare/circl v1.3.8 // indirect - github.com/cyphar/filepath-securejoin v0.2.5 // indirect - github.com/emirpasic/gods v1.18.1 // indirect - github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect - github.com/evertras/bubble-table v0.16.0 // indirect - github.com/fatih/color v1.17.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect - github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect - github.com/go-git/go-billy/v5 v5.5.0 // indirect - github.com/go-git/go-git/v5 v5.12.0 // indirect github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang-jwt/jwt/v4 v4.5.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.4 // indirect - github.com/google/go-cmp v0.6.0 // indirect - github.com/google/go-github v17.0.0+incompatible // indirect - github.com/google/go-github/v62 v62.0.0 // indirect - github.com/google/go-querystring v1.1.0 // indirect github.com/google/s2a-go v0.1.7 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect github.com/googleapis/gax-go/v2 v2.12.2 // indirect - github.com/hashicorp/hcl/v2 v2.20.1 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect - github.com/jedib0t/go-pretty/v6 v6.5.9 // indirect - github.com/kevinburke/ssh_config v1.2.0 // indirect - github.com/lucasb-eyer/go-colorful v1.2.0 // indirect - github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mattn/go-localereader v0.0.1 // indirect - github.com/mattn/go-runewidth v0.0.15 // indirect - github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect - github.com/mitchellh/go-wordwrap v1.0.1 // indirect - github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect - github.com/muesli/cancelreader v0.2.2 // indirect - github.com/muesli/reflow v0.3.0 // indirect - github.com/muesli/termenv v0.15.2 // indirect - github.com/pjbgf/sha1cd v0.3.0 // indirect - github.com/rivo/uniseg v0.4.7 // indirect - github.com/rogpeppe/go-internal v1.12.0 // indirect - github.com/schollz/progressbar/v3 v3.14.3 // indirect - github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect - github.com/skeema/knownhosts v1.2.2 // indirect github.com/spf13/cobra v1.8.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/xanzy/ssh-agent v0.3.3 // indirect - github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect - github.com/zclconf/go-cty v1.14.4 // indirect go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect @@ -84,18 +32,13 @@ require ( go.opentelemetry.io/otel/metric v1.24.0 // indirect go.opentelemetry.io/otel/trace v1.24.0 // indirect golang.org/x/crypto v0.24.0 // indirect - golang.org/x/mod v0.17.0 // indirect golang.org/x/net v0.26.0 // indirect golang.org/x/sync v0.7.0 // indirect golang.org/x/sys v0.21.0 // indirect - golang.org/x/term v0.21.0 // indirect golang.org/x/text v0.16.0 // indirect golang.org/x/time v0.5.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240610135401-a8a62080eff3 // indirect google.golang.org/grpc v1.64.0 // indirect - gopkg.in/warnings.v0 v0.1.2 // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/go.sum b/go.sum index f89c839..ea7dd46 100644 --- a/go.sum +++ b/go.sum @@ -7,76 +7,25 @@ cloud.google.com/go/compute/metadata v0.3.0 h1:Tz+eQXMEqDIKRsmY3cHTL6FVaynIjX2Qx cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= cloud.google.com/go/monitoring v1.18.0 h1:NfkDLQDG2UR3WYZVQE8kwSbUIEyIqJUPl+aOQdFH1T4= cloud.google.com/go/monitoring v1.18.0/go.mod h1:c92vVBCeq/OB4Ioyo+NbN2U7tlg5ZH41PZcdvfc+Lcg= -dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= -dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= -github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= -github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= -github.com/ProtonMail/go-crypto v1.0.0 h1:LRuvITjQWX+WIfr930YHG2HNfjR1uOfyf5vE0kC2U78= -github.com/ProtonMail/go-crypto v1.0.0/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= -github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo= -github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= -github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= -github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= -github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4= -github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI= -github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= -github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= -github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/charmbracelet/bubbles v0.18.0 h1:PYv1A036luoBGroX6VWjQIE9Syf2Wby2oOl/39KLfy0= -github.com/charmbracelet/bubbles v0.18.0/go.mod h1:08qhZhtIwzgrtBjAcJnij1t1H0ZRjwHyGsy6AL11PSw= -github.com/charmbracelet/bubbletea v0.26.4 h1:2gDkkzLZaTjMl/dQBpNVtnvcCxsh/FCkimep7FC9c40= -github.com/charmbracelet/bubbletea v0.26.4/go.mod h1:P+r+RRA5qtI1DOHNFn0otoNwB4rn+zNAzSj/EXz6xU0= -github.com/charmbracelet/lipgloss v0.10.0 h1:KWeXFSexGcfahHX+54URiZGkBFazf70JNMtwg/AFW3s= -github.com/charmbracelet/lipgloss v0.10.0/go.mod h1:Wig9DSfvANsxqkRsqj6x87irdy123SR4dOXlKa91ciE= -github.com/charmbracelet/x/ansi v0.1.2 h1:6+LR39uG8DE6zAmbu023YlqjJHkYXDF1z36ZwzO4xZY= -github.com/charmbracelet/x/ansi v0.1.2/go.mod h1:dk73KoMTT5AX5BsX0KrqhsTqAnhZZoCBjs7dGWp4Ktw= -github.com/charmbracelet/x/input v0.1.1 h1:YDOJaTUKCqtGnq9PHzx3pkkl4pXDOANUHmhH3DqMtM4= -github.com/charmbracelet/x/input v0.1.1/go.mod h1:jvdTVUnNWj/RD6hjC4FsoB0SeZCJ2ZBkiuFP9zXvZI0= -github.com/charmbracelet/x/term v0.1.1 h1:3cosVAiPOig+EV4X9U+3LDgtwwAoEzJjNdwbXDjF6yI= -github.com/charmbracelet/x/term v0.1.1/go.mod h1:wB1fHt5ECsu3mXYusyzcngVWWlu1KKUmmLhfgr/Flxw= -github.com/charmbracelet/x/windows v0.1.2 h1:Iumiwq2G+BRmgoayww/qfcvof7W/3uLoelhxojXlRWg= -github.com/charmbracelet/x/windows v0.1.2/go.mod h1:GLEO/l+lizvFDBPLIOk+49gdX49L9YWMB5t+DZd0jkQ= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= -github.com/cloudflare/circl v1.3.8 h1:j+V8jJt09PoeMFIu2uh5JUyEaIHTXVOHslFoLNAKqwI= -github.com/cloudflare/circl v1.3.8/go.mod h1:PDRU+oXvdD7KCtgKxW95M5Z8BpSCJXQORiZFnBQS5QU= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/cyphar/filepath-securejoin v0.2.5 h1:6iR5tXJ/e6tJZzzdMc1km3Sa7RRIVBKAK32O2s7AYfo= -github.com/cyphar/filepath-securejoin v0.2.5/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= -github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6baUTXGLOoWe4PQhGxaX0KpnayAqC48p4= -github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97MGsxSvLiUE2X8qFplwetxpGLQrlU1Q9AUEIzCaM= -github.com/evertras/bubble-table v0.16.0 h1:Bt2cPukoP8DSWVpBcPSq2E3W2fs7R0mf5BaIFQxFPfM= -github.com/evertras/bubble-table v0.16.0/go.mod h1:SPOZKbIpyYWPHBNki3fyNpiPBQkvkULAtOT7NTD5fKY= -github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= -github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= -github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= -github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU= -github.com/go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow= -github.com/go-git/go-git/v5 v5.12.0 h1:7Md+ndsjrzZxbddRDZjF14qK+NN56sy6wkqaVrjZtys= -github.com/go-git/go-git/v5 v5.12.0/go.mod h1:FTM9VKtnI2m65hNI/TenDDDnUf2Q9FHnXYjuz9i5OEY= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= -github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= @@ -98,16 +47,9 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY= -github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= -github.com/google/go-github/v62 v62.0.0 h1:/6mGCaRywZz9MuHyw9gD1CwsbmBX8GWsbFkwMmHdhl4= -github.com/google/go-github/v62 v62.0.0/go.mod h1:EMxeUqGJq2xRu9DYBMwel/mr7kZrzUOfQmmpYrZn2a4= -github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= -github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -117,68 +59,14 @@ github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfF github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= github.com/googleapis/gax-go/v2 v2.12.2 h1:mhN09QQW1jEWeMF74zGR81R30z4VJzjZsfkUhuHF+DA= github.com/googleapis/gax-go/v2 v2.12.2/go.mod h1:61M8vcyyXR2kqKFxKrfA22jaA8JGF7Dc8App1U3H6jc= -github.com/hashicorp/hcl/v2 v2.20.1 h1:M6hgdyz7HYt1UN9e61j+qKJBqR3orTWbI1HKBJEdxtc= -github.com/hashicorp/hcl/v2 v2.20.1/go.mod h1:TZDqQ4kNKCbh1iJp99FdPiUaVDDUPivbqxZulxDYqL4= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= -github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= -github.com/jedib0t/go-pretty/v6 v6.5.9 h1:ACteMBRrrmm1gMsXe9PSTOClQ63IXDUt03H5U+UV8OU= -github.com/jedib0t/go-pretty/v6 v6.5.9/go.mod h1:zbn98qrYlh95FIhwwsbIip0LYpwSG8SUOScs+v9/t0E= -github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213/go.mod h1:vNUNkEQ1e29fT/6vq2aBdFsgNPmy8qMdSay1npru+Sw= -github.com/kaytu-io/kaytu v0.10.5 h1:EGrvEQTjnIC06ix2rUt0RBlxHjS50pHKifSVQJOH1Ho= -github.com/kaytu-io/kaytu v0.10.5/go.mod h1:BhFDEm+6ckgusHsrDCdgSH+b/wMhuRsq29L8/PJe2Sk= github.com/kaytu-io/kaytu v0.14.0-rc.0.0.20240619114201-51f5733d10b6 h1:OyrvbIttya/35K+6N1tyI953BlKclIkHGWIZ/IPYheg= github.com/kaytu-io/kaytu v0.14.0-rc.0.0.20240619114201-51f5733d10b6/go.mod h1:csDLaCgTnp/D9SZuo55KjOzp/BYfkhkeSkGuEiCljtc= -github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= -github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= -github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= -github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= -github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= -github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4= -github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88= -github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= -github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= -github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ= -github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw= -github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0= -github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0= -github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI= -github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo= -github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA= -github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo= -github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s= -github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8= -github.com/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo= -github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8= -github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= -github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= -github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= -github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/schollz/progressbar/v3 v3.14.3 h1:oOuWW19ka12wxYU1XblR4n16wF/2Y1dBLMarMo6p4xU= -github.com/schollz/progressbar/v3 v3.14.3/go.mod h1:aT3UQ7yGm+2ZjeXPqsjTenwL3ddUiuZ0kfQ/2tHlyNI= -github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= -github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= -github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/skeema/knownhosts v1.2.2 h1:Iug2P4fLmDw9f41PB6thxUkNUkJzB5i+1/exaj40L3A= -github.com/skeema/knownhosts v1.2.2/go.mod h1:xYbVRSPxqBZFrdmDyMmsOs+uX1UZC3nTN3ThzgDxUwo= github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= @@ -186,21 +74,11 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= -github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= -github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no= -github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/zclconf/go-cty v1.14.4 h1:uXXczd9QDGsgu0i/QFR/hzI5NYCHLf6NQw/atrbnhq8= -github.com/zclconf/go-cty v1.14.4/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 h1:4Pp6oUg3+e/6M4C0A/3kJ2VYa++dsWVTtGgLVj5xtHg= @@ -217,33 +95,18 @@ go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= -golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -252,46 +115,16 @@ golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbht golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= -golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA= -golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= @@ -301,12 +134,6 @@ golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.169.0 h1:QwWPy71FgMWqJN/l6jVlFHUa29a7dcUy02I8o799nPY= google.golang.org/api v0.169.0/go.mod h1:gpNOiMA2tZ4mf5R9Iwf4rK/Dcz0fbdIgWYWVoxmsyLg= @@ -340,12 +167,6 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= -gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/plugin/processor/compute_instance/compute_instance_item.go b/plugin/processor/compute_instance/compute_instance_item.go index 110b44b..067de42 100644 --- a/plugin/processor/compute_instance/compute_instance_item.go +++ b/plugin/processor/compute_instance/compute_instance_item.go @@ -45,7 +45,7 @@ func (i ComputeInstanceItem) ComputeInstanceDevice() (*golang.ChartRow, map[stri Value: utils.FormatPriceFloat(i.Wastage.RightSizing.Current.Cost), } - regionProperty := &golang.Property{ + ZoneProperty := &golang.Property{ Key: "Zone", Current: i.Wastage.RightSizing.Current.Zone, } @@ -54,22 +54,49 @@ func (i ComputeInstanceItem) ComputeInstanceDevice() (*golang.ChartRow, map[stri Key: "Machine Type", Current: i.Wastage.RightSizing.Current.MachineType, } + MachineFamilyProperty := &golang.Property{ + Key: "Machine Family", + Current: i.Wastage.RightSizing.Current.MachineFamily, + } + CPUProperty := &golang.Property{ + Key: " CPU", + Current: i.Wastage.RightSizing.Current.MachineType, + } memoryProperty := &golang.Property{ - Key: " Memory", + Key: " MemoryMB", Current: fmt.Sprintf("%d MB", i.Wastage.RightSizing.Current.MemoryMb), Average: utils.Percentage(i.Wastage.RightSizing.Memory.Avg), Max: utils.Percentage(i.Wastage.RightSizing.Memory.Max), } + row.Values["current_cost"] = &golang.ChartRowItem{ + Value: utils.FormatPriceFloat(i.Wastage.RightSizing.Current.Cost), + } + + if i.Wastage.RightSizing.Recommended != nil { + row.Values["right_sized_cost"] = &golang.ChartRowItem{ + Value: utils.FormatPriceFloat(i.Wastage.RightSizing.Recommended.Cost), + } + row.Values["savings"] = &golang.ChartRowItem{ + Value: utils.FormatPriceFloat(i.Wastage.RightSizing.Current.Cost - i.Wastage.RightSizing.Recommended.Cost), + } + ZoneProperty.Recommended = i.Wastage.RightSizing.Recommended.Zone + MachineTypeProperty.Recommended = i.Wastage.RightSizing.Recommended.MachineType + CPUProperty.Recommended = fmt.Sprintf("%d", i.Wastage.RightSizing.Recommended.CPU) + memoryProperty.Recommended = fmt.Sprintf("%d GiB", i.Wastage.RightSizing.Recommended.MemoryMb) + } + props := make(map[string]*golang.Properties) properties := &golang.Properties{} - properties.Properties = append(properties.Properties, regionProperty) + properties.Properties = append(properties.Properties, ZoneProperty) properties.Properties = append(properties.Properties, MachineTypeProperty) + properties.Properties = append(properties.Properties, MachineFamilyProperty) properties.Properties = append(properties.Properties, &golang.Property{ Key: "Compute", }) + properties.Properties = append(properties.Properties, CPUProperty) properties.Properties = append(properties.Properties, memoryProperty) props[i.Id] = properties @@ -97,12 +124,24 @@ func (i ComputeInstanceItem) ToOptimizationItem() *golang.ChartOptimizationItem chartrow := &golang.ChartRow{ RowId: i.Id, Values: map[string]*golang.ChartRowItem{ - "instance_id": { + "x_kaytu_right_arrow": { + Value: "→", + }, + "resource_id": { Value: i.Id, }, - "instance_name": { + "resource_name": { Value: i.Name, }, + "resource_type": { + Value: i.MachineType, + }, + "Region": { + Value: i.Region, + }, + "Total Savings": { + Value: i.Region, + }, }, } diff --git a/plugin/service.go b/plugin/service.go index 00aa039..5644795 100644 --- a/plugin/service.go +++ b/plugin/service.go @@ -48,32 +48,73 @@ func (p *GCPPlugin) GetConfig() golang.RegisterConfig { Columns: []*golang.ChartColumnItem{ { - Id: "instance_id", - Name: "Instance ID", - Width: uint32(10), - Sortable: true, + Id: "resource_id", + Name: "Resource ID", + Width: uint32(10), }, { - Id: "instance_name", - Name: "Instance Name", - Width: uint32(10), - Sortable: true, + Id: "resource_name", + Name: "Resource Name", + Width: uint32(10), + }, + { + Id: "region", + Name: "Region", + Width: uint32(15), + }, + { + Id: "platform", + Name: "Platform", + Width: uint32(15), + }, + { + Id: "total_saving", + Name: "Total Saving (Monthly)", + Width: uint32(40), + }, + { + Id: "x_kaytu_right_arrow", + Name: "", + Width: uint32(1), }, }, }, DevicesChart: &golang.ChartDefinition{ Columns: []*golang.ChartColumnItem{ { - Id: "instance_name", - Name: "Instance Name", - Width: uint32(10), - Sortable: true, + Id: "resource_id", + Name: "Resource ID", + Width: uint32(10), + }, + { + Id: "resource_name", + Name: "Resource Name", + Width: uint32(10), + }, + { + Id: "resource_type", + Name: "Resource Type", + Width: uint32(10), + }, + { + Id: "project_id", + Name: "Project ID", + Width: uint32(10), + }, + { + Id: "current_cost", + Name: "Current Cost", + Width: uint32(20), + }, + { + Id: "right_sized_cost", + Name: "Right sized Cost", + Width: 20, }, { - Id: "project_id", - Name: "Project ID", - Width: uint32(10), - Sortable: true, + Id: "savings", + Name: "Savings", + Width: 20, }, }, }, From 4c42e1b4204cc3e4f9d600e65d22d162ffee5671 Mon Sep 17 00:00:00 2001 From: artaasadi Date: Thu, 20 Jun 2024 11:21:53 +0200 Subject: [PATCH 15/20] fix: add preferences --- plugin/preferences/default.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/plugin/preferences/default.go b/plugin/preferences/default.go index 04568bb..9192ab2 100644 --- a/plugin/preferences/default.go +++ b/plugin/preferences/default.go @@ -1,5 +1,17 @@ package preferences -import "github.com/kaytu-io/kaytu/pkg/plugin/proto/src/golang" +import ( + "github.com/kaytu-io/kaytu/pkg/plugin/proto/src/golang" + "google.golang.org/protobuf/types/known/wrapperspb" +) -var DefaultComputeEnginePreferences = []*golang.PreferenceItem{} +var DefaultComputeEnginePreferences = []*golang.PreferenceItem{ + {Service: "ComputeInstance", Key: "vCPU", IsNumber: true}, + {Service: "ComputeInstance", Key: "Region", Pinned: true}, + {Service: "ComputeInstance", Key: "Zone"}, + {Service: "ComputeInstance", Key: "MachineFamily", Pinned: true}, + {Service: "ComputeInstance", Key: "MachineType"}, + {Service: "ComputeInstance", Key: "MemoryGB", Alias: "Memory", IsNumber: true, Unit: "GiB"}, + {Service: "ComputeInstance", Key: "CPUBreathingRoom", IsNumber: true, Value: wrapperspb.String("10"), PreventPinning: true, Unit: "%"}, + {Service: "ComputeInstance", Key: "MemoryBreathingRoom", IsNumber: true, Value: wrapperspb.String("10"), PreventPinning: true, Unit: "%"}, +} From d52b32de563a6d57c1e9d3d3430e771fd930ec3d Mon Sep 17 00:00:00 2001 From: artaasadi Date: Thu, 20 Jun 2024 17:23:19 +0200 Subject: [PATCH 16/20] fix: update preferences --- plugin/preferences/default.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugin/preferences/default.go b/plugin/preferences/default.go index 9192ab2..7f2cc4a 100644 --- a/plugin/preferences/default.go +++ b/plugin/preferences/default.go @@ -8,9 +8,7 @@ import ( var DefaultComputeEnginePreferences = []*golang.PreferenceItem{ {Service: "ComputeInstance", Key: "vCPU", IsNumber: true}, {Service: "ComputeInstance", Key: "Region", Pinned: true}, - {Service: "ComputeInstance", Key: "Zone"}, {Service: "ComputeInstance", Key: "MachineFamily", Pinned: true}, - {Service: "ComputeInstance", Key: "MachineType"}, {Service: "ComputeInstance", Key: "MemoryGB", Alias: "Memory", IsNumber: true, Unit: "GiB"}, {Service: "ComputeInstance", Key: "CPUBreathingRoom", IsNumber: true, Value: wrapperspb.String("10"), PreventPinning: true, Unit: "%"}, {Service: "ComputeInstance", Key: "MemoryBreathingRoom", IsNumber: true, Value: wrapperspb.String("10"), PreventPinning: true, Unit: "%"}, From 10ed960bdf7ee82e1b59dc63f05e04ad49c7f72f Mon Sep 17 00:00:00 2001 From: Adnan Gulegulzar Date: Thu, 20 Jun 2024 12:27:18 -0400 Subject: [PATCH 17/20] adding platform details --- .../compute_instance/compute_instance_item.go | 12 ++++++++---- .../compute_instance/job_compute_instance_list.go | 6 ++++-- .../job_get_compute_instance_metrics.go | 4 +++- .../job_optimize_compute_instance.go | 1 + 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/plugin/processor/compute_instance/compute_instance_item.go b/plugin/processor/compute_instance/compute_instance_item.go index 067de42..5e106f3 100644 --- a/plugin/processor/compute_instance/compute_instance_item.go +++ b/plugin/processor/compute_instance/compute_instance_item.go @@ -15,6 +15,7 @@ type ComputeInstanceItem struct { Id string MachineType string Region string + Platform string OptimizationLoading bool Preferences []*golang.PreferenceItem Skipped bool @@ -60,7 +61,7 @@ func (i ComputeInstanceItem) ComputeInstanceDevice() (*golang.ChartRow, map[stri } CPUProperty := &golang.Property{ Key: " CPU", - Current: i.Wastage.RightSizing.Current.MachineType, + Current: fmt.Sprintf("%d", i.Wastage.RightSizing.Current.CPU), } memoryProperty := &golang.Property{ @@ -84,7 +85,7 @@ func (i ComputeInstanceItem) ComputeInstanceDevice() (*golang.ChartRow, map[stri ZoneProperty.Recommended = i.Wastage.RightSizing.Recommended.Zone MachineTypeProperty.Recommended = i.Wastage.RightSizing.Recommended.MachineType CPUProperty.Recommended = fmt.Sprintf("%d", i.Wastage.RightSizing.Recommended.CPU) - memoryProperty.Recommended = fmt.Sprintf("%d GiB", i.Wastage.RightSizing.Recommended.MemoryMb) + memoryProperty.Recommended = fmt.Sprintf("%d MB", i.Wastage.RightSizing.Recommended.MemoryMb) } props := make(map[string]*golang.Properties) @@ -136,10 +137,13 @@ func (i ComputeInstanceItem) ToOptimizationItem() *golang.ChartOptimizationItem "resource_type": { Value: i.MachineType, }, - "Region": { + "region": { Value: i.Region, }, - "Total Savings": { + "platform": { + Value: i.Platform, + }, + "total_saving": { Value: i.Region, }, }, diff --git a/plugin/processor/compute_instance/job_compute_instance_list.go b/plugin/processor/compute_instance/job_compute_instance_list.go index ffea062..c2e9e7a 100644 --- a/plugin/processor/compute_instance/job_compute_instance_list.go +++ b/plugin/processor/compute_instance/job_compute_instance_list.go @@ -6,6 +6,7 @@ import ( "strconv" "github.com/kaytu-io/plugin-gcp/plugin/preferences" + util "github.com/kaytu-io/plugin-gcp/utils" ) type ListComputeInstancesJob struct { @@ -42,8 +43,9 @@ func (job *ListComputeInstancesJob) Run(ctx context.Context) error { oi := ComputeInstanceItem{ Name: *instance.Name, Id: strconv.FormatUint(instance.GetId(), 10), - MachineType: instance.GetMachineType(), - Region: instance.GetZone(), + MachineType: util.TrimmedString(*instance.MachineType, "/"), + Region: util.TrimmedString(*instance.Zone, "/"), + Platform: instance.GetCpuPlatform(), OptimizationLoading: false, Preferences: preferences.DefaultComputeEnginePreferences, Skipped: false, diff --git a/plugin/processor/compute_instance/job_get_compute_instance_metrics.go b/plugin/processor/compute_instance/job_get_compute_instance_metrics.go index 67abffa..8be1aa1 100644 --- a/plugin/processor/compute_instance/job_get_compute_instance_metrics.go +++ b/plugin/processor/compute_instance/job_get_compute_instance_metrics.go @@ -3,11 +3,12 @@ package compute_instance import ( "context" "fmt" - "github.com/kaytu-io/plugin-gcp/plugin/kaytu" "log" "strconv" "time" + "github.com/kaytu-io/plugin-gcp/plugin/kaytu" + "cloud.google.com/go/compute/apiv1/computepb" "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb" "github.com/kaytu-io/plugin-gcp/plugin/preferences" @@ -103,6 +104,7 @@ func (job *GetComputeInstanceMetricsJob) Run(ctx context.Context) error { Id: strconv.FormatUint(job.instance.GetId(), 10), MachineType: util.TrimmedString(*job.instance.MachineType, "/"), Region: util.TrimmedString(*job.instance.Zone, "/"), + Platform: job.instance.GetCpuPlatform(), OptimizationLoading: false, Preferences: preferences.DefaultComputeEnginePreferences, Skipped: false, diff --git a/plugin/processor/compute_instance/job_optimize_compute_instance.go b/plugin/processor/compute_instance/job_optimize_compute_instance.go index 87689e7..7f90076 100644 --- a/plugin/processor/compute_instance/job_optimize_compute_instance.go +++ b/plugin/processor/compute_instance/job_optimize_compute_instance.go @@ -61,6 +61,7 @@ func (job *OptimizeComputeInstancesJob) Run(ctx context.Context) error { Id: job.item.Id, MachineType: job.item.MachineType, Region: job.item.Region, + Platform: job.item.Platform, OptimizationLoading: false, Preferences: job.item.Preferences, Skipped: false, From f6898bc88c627d3c5a9ec21e45bb80e3650d6307 Mon Sep 17 00:00:00 2001 From: Adnan Gulegulzar Date: Thu, 20 Jun 2024 12:41:04 -0400 Subject: [PATCH 18/20] calculate savings --- .../compute_instance/compute_instance_item.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugin/processor/compute_instance/compute_instance_item.go b/plugin/processor/compute_instance/compute_instance_item.go index 5e106f3..dd794dd 100644 --- a/plugin/processor/compute_instance/compute_instance_item.go +++ b/plugin/processor/compute_instance/compute_instance_item.go @@ -122,6 +122,15 @@ func (i ComputeInstanceItem) ToOptimizationItem() *golang.ChartOptimizationItem deviceRows, deviceProps := i.Devices() + status := "" + if i.Wastage.RightSizing.Recommended != nil { + totalSaving := 0.0 + totalCurrentCost := 0.0 + totalSaving += i.Wastage.RightSizing.Current.Cost - i.Wastage.RightSizing.Recommended.Cost + totalCurrentCost += i.Wastage.RightSizing.Current.Cost + status = fmt.Sprintf("%s (%.2f%%)", utils.FormatPriceFloat(totalSaving), (totalSaving/totalCurrentCost)*100) + } + chartrow := &golang.ChartRow{ RowId: i.Id, Values: map[string]*golang.ChartRowItem{ @@ -144,7 +153,7 @@ func (i ComputeInstanceItem) ToOptimizationItem() *golang.ChartOptimizationItem Value: i.Platform, }, "total_saving": { - Value: i.Region, + Value: status, }, }, } From 1a058020f2f39c71e3a96e42b635eb675e29a02a Mon Sep 17 00:00:00 2001 From: Adnan Gulegulzar Date: Thu, 20 Jun 2024 14:54:31 -0400 Subject: [PATCH 19/20] project id added --- plugin/processor/compute_instance/compute_instance_item.go | 5 +++++ .../processor/compute_instance/job_compute_instance_list.go | 1 + .../compute_instance/job_get_compute_instance_metrics.go | 1 + .../compute_instance/job_optimize_compute_instance.go | 1 + 4 files changed, 8 insertions(+) diff --git a/plugin/processor/compute_instance/compute_instance_item.go b/plugin/processor/compute_instance/compute_instance_item.go index dd794dd..5d65319 100644 --- a/plugin/processor/compute_instance/compute_instance_item.go +++ b/plugin/processor/compute_instance/compute_instance_item.go @@ -11,6 +11,7 @@ import ( ) type ComputeInstanceItem struct { + ProjectId string Name string Id string MachineType string @@ -71,6 +72,10 @@ func (i ComputeInstanceItem) ComputeInstanceDevice() (*golang.ChartRow, map[stri Max: utils.Percentage(i.Wastage.RightSizing.Memory.Max), } + row.Values["project_id"] = &golang.ChartRowItem{ + Value: i.ProjectId, + } + row.Values["current_cost"] = &golang.ChartRowItem{ Value: utils.FormatPriceFloat(i.Wastage.RightSizing.Current.Cost), } diff --git a/plugin/processor/compute_instance/job_compute_instance_list.go b/plugin/processor/compute_instance/job_compute_instance_list.go index c2e9e7a..7fd26a7 100644 --- a/plugin/processor/compute_instance/job_compute_instance_list.go +++ b/plugin/processor/compute_instance/job_compute_instance_list.go @@ -41,6 +41,7 @@ func (job *ListComputeInstancesJob) Run(ctx context.Context) error { for _, instance := range instances { oi := ComputeInstanceItem{ + ProjectId: job.processor.provider.ProjectID, Name: *instance.Name, Id: strconv.FormatUint(instance.GetId(), 10), MachineType: util.TrimmedString(*instance.MachineType, "/"), diff --git a/plugin/processor/compute_instance/job_get_compute_instance_metrics.go b/plugin/processor/compute_instance/job_get_compute_instance_metrics.go index 8be1aa1..7890ab7 100644 --- a/plugin/processor/compute_instance/job_get_compute_instance_metrics.go +++ b/plugin/processor/compute_instance/job_get_compute_instance_metrics.go @@ -100,6 +100,7 @@ func (job *GetComputeInstanceMetricsJob) Run(ctx context.Context) error { instanceMetrics["memoryUtilization"] = memoryMetric oi := ComputeInstanceItem{ + ProjectId: job.processor.provider.ProjectID, Name: *job.instance.Name, Id: strconv.FormatUint(job.instance.GetId(), 10), MachineType: util.TrimmedString(*job.instance.MachineType, "/"), diff --git a/plugin/processor/compute_instance/job_optimize_compute_instance.go b/plugin/processor/compute_instance/job_optimize_compute_instance.go index 7f90076..9bdb4a9 100644 --- a/plugin/processor/compute_instance/job_optimize_compute_instance.go +++ b/plugin/processor/compute_instance/job_optimize_compute_instance.go @@ -57,6 +57,7 @@ func (job *OptimizeComputeInstancesJob) Run(ctx context.Context) error { } job.item = ComputeInstanceItem{ + ProjectId: job.item.ProjectId, Name: job.item.Name, Id: job.item.Id, MachineType: job.item.MachineType, From a6f1bf7d8abd12368e8a0c4d16b073f9a1b485a1 Mon Sep 17 00:00:00 2001 From: artaasadi Date: Fri, 21 Jun 2024 08:40:58 +0200 Subject: [PATCH 20/20] fix: deactive goreleaser: --- .github/workflows/main.yaml | 44 +++++++++++++++++------------------ plugin/preferences/default.go | 2 +- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 8654c83..91b07b4 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -46,26 +46,26 @@ jobs: with: name: new_tag path: new_tag.txt - release: - runs-on: ubuntu-latest - needs: - - tag - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - token: ${{ secrets.GH_TOKEN }} - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version: stable - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v5 - with: - distribution: goreleaser - version: latest - args: release --clean - env: - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} +# release: +# runs-on: ubuntu-latest +# needs: +# - tag +# steps: +# - name: Checkout +# uses: actions/checkout@v4 +# with: +# fetch-depth: 0 +# token: ${{ secrets.GH_TOKEN }} +# - name: Set up Go +# uses: actions/setup-go@v4 +# with: +# go-version: stable +# - name: Run GoReleaser +# uses: goreleaser/goreleaser-action@v5 +# with: +# distribution: goreleaser +# version: latest +# args: release --clean +# env: +# GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} diff --git a/plugin/preferences/default.go b/plugin/preferences/default.go index 7f2cc4a..15de420 100644 --- a/plugin/preferences/default.go +++ b/plugin/preferences/default.go @@ -7,7 +7,7 @@ import ( var DefaultComputeEnginePreferences = []*golang.PreferenceItem{ {Service: "ComputeInstance", Key: "vCPU", IsNumber: true}, - {Service: "ComputeInstance", Key: "Region", Pinned: true}, + //{Service: "ComputeInstance", Key: "Region", Pinned: true}, {Service: "ComputeInstance", Key: "MachineFamily", Pinned: true}, {Service: "ComputeInstance", Key: "MemoryGB", Alias: "Memory", IsNumber: true, Unit: "GiB"}, {Service: "ComputeInstance", Key: "CPUBreathingRoom", IsNumber: true, Value: wrapperspb.String("10"), PreventPinning: true, Unit: "%"},