Skip to content
This repository has been archived by the owner on Dec 8, 2024. It is now read-only.

Commit

Permalink
feat: add usage operation (#8)
Browse files Browse the repository at this point in the history
* feat: add usage operation

* feat: default to pinned on usage operation

* fix: tenancy pinning
  • Loading branch information
Mahanmmi authored Apr 26, 2024
1 parent b44b399 commit 8734569
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/optimize/preferences/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func DefaultPreferences() []PreferenceItem {
{Service: "EC2Instance", Key: "OperatingSystem", Pinned: true, PossibleValues: []string{"", "Windows", "Linux/UNIX"}},
{Service: "EC2Instance", Key: "ProcessorArchitecture", Pinned: true, PossibleValues: []string{"", "x86_64", "arm64", "arm64_mac"}},
{Service: "EC2Instance", Key: "InstanceFamily", PossibleValues: []string{"", "General purpose", "Compute optimized", "Memory optimized", "Storage optimized", "FPGA Instances", "GPU instance", "Machine Learning ASIC Instances", "Media Accelerator Instances"}},
{Service: "EC2Instance", Key: "UsageOperation", Pinned: true, PossibleValues: []string{"", "Linux/UNIX", "Red Hat BYOL Linux", "Red Hat Enterprise Linux", "Red Hat Enterprise Linux with HA", "Red Hat Enterprise Linux with SQL Server Standard and HA", "Red Hat Enterprise Linux with SQL Server Enterprise and HA", "Red Hat Enterprise Linux with SQL Server Standard", "Red Hat Enterprise Linux with SQL Server Web", "Red Hat Enterprise Linux with SQL Server Enterprise", "SQL Server Enterprise", "SQL Server Standard", "SQL Server Web", "SUSE Linux", "Ubuntu Pro", "Windows", "Windows BYOL", "Windows with SQL Server Enterprise", "Windows with SQL Server Standard", "Windows with SQL Server Web"}},
{Service: "EC2Instance", Key: "ENASupported"},
{Service: "EC2Instance", Key: "SupportedRootDeviceTypes", Value: aws.String("EBSOnly"), PreventPinning: true, PossibleValues: []string{"EBSOnly"}},
{Service: "EC2Instance", Key: "vCPU", IsNumber: true},
Expand Down
2 changes: 2 additions & 0 deletions cmd/optimize/view/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,8 @@ func (m *App) getEc2InstanceRequestData(ctx context.Context, cfg aws.Config, ins
InstanceLifecycle: instance.InstanceLifecycle,
Monitoring: monitoring,
Placement: placement,
UsageOperation: *instance.UsageOperation,
Tenancy: instance.Placement.Tenancy,
},
Volumes: kaytuVolumes,
Metrics: metrics,
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/wastage/ec2_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ type EC2Instance struct {
InstanceLifecycle types.InstanceLifecycleType `json:"instanceLifecycle"`
Monitoring *types.MonitoringState `json:"monitoring"`
Placement *EC2Placement `json:"placement"`
UsageOperation string `json:"usageOperation"`
Tenancy types.Tenancy `json:"tenancy"`
}

type EC2Volume struct {
Expand Down

0 comments on commit 8734569

Please sign in to comment.