diff --git a/cmd/mapt/cmd/aws/hosts/fedora.go b/cmd/mapt/cmd/aws/hosts/fedora.go index 5034ee712..d325f9251 100644 --- a/cmd/mapt/cmd/aws/hosts/fedora.go +++ b/cmd/mapt/cmd/aws/hosts/fedora.go @@ -4,7 +4,9 @@ import ( params "github.com/redhat-developer/mapt/cmd/mapt/cmd/constants" maptContext "github.com/redhat-developer/mapt/pkg/manager/context" "github.com/redhat-developer/mapt/pkg/provider/aws/action/fedora" + "github.com/redhat-developer/mapt/pkg/util" "github.com/redhat-developer/mapt/pkg/util/logging" + "github.com/redhat-developer/mapt/pkg/util/resources" "github.com/spf13/cobra" "github.com/spf13/pflag" "github.com/spf13/viper" @@ -50,13 +52,28 @@ func getFedoraCreate() *cobra.Command { viper.GetString(params.ConnectionDetailsOutput), viper.GetStringMapString(params.Tags)) + // Get the VM instance type name based on cpus, memory and arch + var ec2Types []string + if viper.GetInt32(params.CPUs) > 0 && viper.GetInt32(params.Memory) > 0 { + var arch resources.Arch = resources.Amd64 + if viper.GetString(params.LinuxArch) == "arm64" { + arch = resources.Arm64 + } + ec2Types, _ = resources.GetAwsMachineTypes(viper.GetInt32(params.CPUs), viper.GetInt32(params.Memory), arch) + if len(ec2Types) > 0 { + logging.Info("Using dynamic vm types: ", ec2Types) + } else { + logging.Info("Using the default instance type") + } + } + // Run create if err := fedora.Create( &fedora.Request{ Prefix: "main", Version: viper.GetString(rhelVersion), Arch: viper.GetString(params.LinuxArch), - VMType: viper.GetStringSlice(vmTypes), + VMType: util.If(len(ec2Types) > 0, ec2Types, viper.GetStringSlice(vmTypes)), Spot: viper.IsSet(spot), Airgap: viper.IsSet(airgap)}); err != nil { logging.Error(err) @@ -72,6 +89,7 @@ func getFedoraCreate() *cobra.Command { flagSet.StringSliceP(vmTypes, "", []string{}, vmTypesDescription) flagSet.Bool(airgap, false, airgapDesc) flagSet.Bool(spot, false, spotDesc) + flagSet.AddFlagSet(params.GetCpusAndMemoryFlagset()) c.PersistentFlags().AddFlagSet(flagSet) return c } diff --git a/cmd/mapt/cmd/aws/hosts/rhel.go b/cmd/mapt/cmd/aws/hosts/rhel.go index bdaccdcd7..17fe19eda 100644 --- a/cmd/mapt/cmd/aws/hosts/rhel.go +++ b/cmd/mapt/cmd/aws/hosts/rhel.go @@ -4,8 +4,10 @@ import ( params "github.com/redhat-developer/mapt/cmd/mapt/cmd/constants" maptContext "github.com/redhat-developer/mapt/pkg/manager/context" "github.com/redhat-developer/mapt/pkg/provider/aws/action/rhel" + "github.com/redhat-developer/mapt/pkg/util" "github.com/redhat-developer/mapt/pkg/util/ghactions" "github.com/redhat-developer/mapt/pkg/util/logging" + "github.com/redhat-developer/mapt/pkg/util/resources" "github.com/spf13/cobra" "github.com/spf13/pflag" "github.com/spf13/viper" @@ -67,13 +69,28 @@ func getRHELCreate() *cobra.Command { } } + // Get the VM instance type name based on cpus, memory and arch + var ec2Types []string + if viper.GetInt32(params.CPUs) > 0 && viper.GetInt32(params.Memory) > 0 { + var arch resources.Arch = resources.Amd64 + if viper.GetString(params.LinuxArch) == "arm64" { + arch = resources.Arm64 + } + ec2Types, _ = resources.GetAwsMachineTypes(viper.GetInt32(params.CPUs), viper.GetInt32(params.Memory), arch) + if len(ec2Types) > 0 { + logging.Info("Using dynamic vm types: ", ec2Types) + } else { + logging.Info("Using the default instance type") + } + } + // Run create if err := rhel.Create( &rhel.Request{ Prefix: "main", Version: viper.GetString(rhelVersion), Arch: viper.GetString(params.LinuxArch), - VMType: viper.GetStringSlice(vmTypes), + VMType: util.If(len(ec2Types) > 0, ec2Types, viper.GetStringSlice(vmTypes)), SubsUsername: viper.GetString(subsUsername), SubsUserpass: viper.GetString(subsUserpass), ProfileSNC: viper.IsSet(profileSNC), @@ -98,6 +115,7 @@ func getRHELCreate() *cobra.Command { flagSet.Bool(spot, false, spotDesc) flagSet.Bool(profileSNC, false, profileSNCDesc) flagSet.AddFlagSet(params.GetGHActionsFlagset()) + flagSet.AddFlagSet(params.GetCpusAndMemoryFlagset()) c.PersistentFlags().AddFlagSet(flagSet) // if err := c.MarkFlagRequired(subsUsername); err != nil { // logging.Error(err) diff --git a/cmd/mapt/cmd/aws/hosts/windows.go b/cmd/mapt/cmd/aws/hosts/windows.go index 3397e8da8..f50e49eaf 100644 --- a/cmd/mapt/cmd/aws/hosts/windows.go +++ b/cmd/mapt/cmd/aws/hosts/windows.go @@ -101,6 +101,7 @@ func getWindowsCreate() *cobra.Command { flagSet.Bool(spot, false, spotDesc) flagSet.Bool(amiKeepCopy, false, amiKeepCopyDesc) flagSet.AddFlagSet(params.GetGHActionsFlagset()) + flagSet.AddFlagSet(params.GetCpusAndMemoryFlagset()) c.PersistentFlags().AddFlagSet(flagSet) return c } diff --git a/cmd/mapt/cmd/azure/hosts/linux.go b/cmd/mapt/cmd/azure/hosts/linux.go index 6fdcf9a9e..51eb796a4 100644 --- a/cmd/mapt/cmd/azure/hosts/linux.go +++ b/cmd/mapt/cmd/azure/hosts/linux.go @@ -9,6 +9,7 @@ import ( spotprice "github.com/redhat-developer/mapt/pkg/provider/azure/module/spot-price" "github.com/redhat-developer/mapt/pkg/util/logging" + "github.com/redhat-developer/mapt/pkg/util/resources" "github.com/spf13/cobra" "github.com/spf13/pflag" "github.com/spf13/viper" @@ -74,11 +75,27 @@ func getCreateLinux(ostype azureLinux.OSType, defaultOSVersion string) *cobra.Co return fmt.Errorf("%s is not a valid spot tolerance value", viper.GetString(paramSpotTolerance)) } } + + // Get the VM instance type name based on cpus, memory and arch + var vmTypes []string + if viper.GetInt32(params.CPUs) > 0 && viper.GetInt32(params.Memory) > 0 { + var arch resources.Arch = resources.Amd64 + if viper.GetString(params.LinuxArch) == "arm64" { + arch = resources.Arm64 + } + vmTypes = resources.GetAzureMachineTypes(viper.GetInt32(params.CPUs), viper.GetInt32(params.Memory), arch) + if len(vmTypes) > 0 { + logging.Info("Using dynamic vm types: ", vmTypes) + } else { + logging.Info("Using the default instance type") + } + } + if err := azureLinux.Create( &azureLinux.LinuxRequest{ Prefix: viper.GetString(params.ProjectName), Location: viper.GetString(paramLocation), - VMSize: viper.GetString(paramVMSize), + VMSizes: vmTypes, Version: viper.GetString(paramLinuxVersion), Arch: viper.GetString(params.LinuxArch), OSType: ostype, @@ -100,6 +117,7 @@ func getCreateLinux(ostype azureLinux.OSType, defaultOSVersion string) *cobra.Co flagSet.StringP(paramUsername, "", defaultUsername, paramUsernameDesc) flagSet.Bool(paramSpot, false, paramSpotDesc) flagSet.StringP(paramSpotTolerance, "", defaultSpotTolerance, paramSpotToleranceDesc) + flagSet.AddFlagSet(params.GetCpusAndMemoryFlagset()) c.PersistentFlags().AddFlagSet(flagSet) return c } diff --git a/cmd/mapt/cmd/azure/hosts/windows.go b/cmd/mapt/cmd/azure/hosts/windows.go index 8a693e164..615d242be 100644 --- a/cmd/mapt/cmd/azure/hosts/windows.go +++ b/cmd/mapt/cmd/azure/hosts/windows.go @@ -7,8 +7,10 @@ import ( maptContext "github.com/redhat-developer/mapt/pkg/manager/context" azureWindows "github.com/redhat-developer/mapt/pkg/provider/azure/action/windows" spotprice "github.com/redhat-developer/mapt/pkg/provider/azure/module/spot-price" + "github.com/redhat-developer/mapt/pkg/util" "github.com/redhat-developer/mapt/pkg/util/ghactions" "github.com/redhat-developer/mapt/pkg/util/logging" + "github.com/redhat-developer/mapt/pkg/util/resources" "github.com/spf13/cobra" "github.com/spf13/pflag" "github.com/spf13/viper" @@ -83,11 +85,22 @@ func getCreateWindowsDesktop() *cobra.Command { } } + // Get the VM instance type name based on cpus, memory and arch + var vmTypes []string + if viper.GetInt32(params.CPUs) > 0 && viper.GetInt32(params.Memory) > 0 { + vmTypes = resources.GetAzureMachineTypes(viper.GetInt32(params.CPUs), viper.GetInt32(params.Memory), resources.Amd64) + if len(vmTypes) > 0 { + logging.Info("Using dynamic vm types: ", vmTypes) + } else { + logging.Info("Using the default instance type") + } + } + if err := azureWindows.Create( &azureWindows.WindowsRequest{ Prefix: viper.GetString(params.ProjectName), Location: viper.GetString(paramLocation), - VMSize: viper.GetString(paramVMSize), + VMSizes: util.If(len(vmTypes) > 0, vmTypes, []string{viper.GetString(paramVMSize)}), Version: viper.GetString(paramWindowsVersion), Feature: viper.GetString(paramFeature), Username: viper.GetString(paramUsername), @@ -114,6 +127,7 @@ func getCreateWindowsDesktop() *cobra.Command { flagSet.Bool(paramSpot, false, paramSpotDesc) flagSet.StringP(paramSpotTolerance, "", defaultSpotTolerance, paramSpotToleranceDesc) flagSet.AddFlagSet(params.GetGHActionsFlagset()) + flagSet.AddFlagSet(params.GetCpusAndMemoryFlagset()) c.PersistentFlags().AddFlagSet(flagSet) return c } diff --git a/cmd/mapt/cmd/constants/constants.go b/cmd/mapt/cmd/constants/constants.go index 8905f6f9d..8c624a31b 100644 --- a/cmd/mapt/cmd/constants/constants.go +++ b/cmd/mapt/cmd/constants/constants.go @@ -38,6 +38,10 @@ const ( GHActionsRunnerTokenDesc string = "Token needed for registering the Github Actions Runner token" GHActionsRunnerNameDesc string = "Name for the Github Actions Runner" GHActionsRunnerRepoDesc string = "Full URL of the repository where the Github Actions Runner should be registered" + Memory string = "memory" + MemoryDesc string = "Amount of RAM for the cloud instance in GiB" + CPUs string = "cpus" + CPUsDesc string = "Number of CPUs for the cloud instance" CreateCmdName string = "create" DestroyCmdName string = "destroy" @@ -56,3 +60,10 @@ func GetGHActionsFlagset() *pflag.FlagSet { flagSet.StringP(GHActionsRunnerRepo, "", "", GHActionsRunnerRepoDesc) return flagSet } + +func GetCpusAndMemoryFlagset() *pflag.FlagSet { + flagSet := pflag.NewFlagSet(CreateCmdName, pflag.ExitOnError) + flagSet.Int32P(CPUs, "", 0, CPUsDesc) + flagSet.Int32P(Memory, "", 0, MemoryDesc) + return flagSet +} diff --git a/go.mod b/go.mod index 77a6d1938..9bb19b36d 100644 --- a/go.mod +++ b/go.mod @@ -13,9 +13,11 @@ require ( ) require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.12.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.6.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v6 v6.0.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph v0.9.0 + github.com/aws/amazon-ec2-instance-selector/v2 v2.4.2-0.20231006140257-d989c5d76f0e github.com/aws/aws-sdk-go-v2 v1.27.2 github.com/aws/aws-sdk-go-v2/config v1.27.18 github.com/aws/aws-sdk-go-v2/service/ec2 v1.142.0 @@ -28,14 +30,23 @@ require ( ) require ( + github.com/aws/aws-sdk-go v1.45.6 // indirect + github.com/aws/aws-sdk-go-v2/service/pricing v1.21.6 // indirect + github.com/blang/semver/v4 v4.0.0 // indirect + github.com/evertras/bubble-table v0.15.2 // indirect github.com/hashicorp/hcl v1.0.0 // indirect + github.com/imdario/mergo v0.3.16 // indirect + github.com/mitchellh/go-homedir v1.1.0 // indirect + github.com/oliveagle/jsonpath v0.0.0-20180606110733-2e52cf6e6852 // indirect + github.com/patrickmn/go-cache v2.1.0+incompatible // indirect + github.com/sahilm/fuzzy v0.1.0 // indirect golang.org/x/mod v0.18.0 // indirect golang.org/x/tools v0.22.0 // indirect ) require ( dario.cat/mergo v1.0.0 // indirect - github.com/Azure/azure-sdk-for-go/sdk/internal v1.9.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect github.com/agext/levenshtein v1.2.3 // indirect github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect @@ -93,7 +104,7 @@ require ( github.com/spf13/cast v1.6.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/zclconf/go-cty v1.13.2 // indirect - go.uber.org/multierr v1.9.0 // indirect + go.uber.org/multierr v1.11.0 // indirect golang.org/x/sync v0.7.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240314234333-6e1732d8331c // indirect gopkg.in/ini.v1 v1.67.0 // indirect @@ -125,7 +136,7 @@ require ( github.com/nxadm/tail v1.4.11 // indirect github.com/opentracing/basictracer-go v1.1.0 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect - github.com/pkg/errors v0.9.1 // indirect + github.com/pkg/errors v0.9.1 github.com/pkg/term v1.1.0 // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -139,10 +150,10 @@ require ( github.com/uber/jaeger-lib v2.4.1+incompatible // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect go.uber.org/atomic v1.9.0 // indirect - golang.org/x/crypto v0.24.0 // indirect - golang.org/x/net v0.26.0 // indirect - golang.org/x/sys v0.21.0 // indirect - golang.org/x/term v0.21.0 // indirect + golang.org/x/crypto v0.25.0 // indirect + golang.org/x/net v0.27.0 // indirect + golang.org/x/sys v0.22.0 // indirect + golang.org/x/term v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect google.golang.org/grpc v1.63.2 // indirect google.golang.org/protobuf v1.34.2 // indirect diff --git a/go.sum b/go.sum index 6b64ea4c6..0d1e8fa59 100644 --- a/go.sum +++ b/go.sum @@ -1,13 +1,20 @@ dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.12.0 h1:1nGuui+4POelzDwI7RG56yfQJHCnKvwfMoU7VsEp+Zg= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.12.0/go.mod h1:99EvauvlcJ1U06amZiksfYz/3aFGyIhWGHVyiZXtBAI= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.6.0 h1:U2rTu3Ef+7w9FHKIAXM6ZyqF3UOWJZ12zIm8zECAFfg= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.6.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.9.0 h1:H+U3Gk9zY56G3u872L82bk4thcsy2Gghb9ExT4Zvm1o= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.9.0/go.mod h1:mgrmMSgaLp9hmax62XQTd0N4aAqSE5E0DulSpVYK7vc= +github.com/Azure/azure-sdk-for-go v66.0.0+incompatible h1:bmmC38SlE8/E81nNADlgmVGurPWMHDX2YNXVQMrBpEE= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v6 v6.0.0 h1:ubTqH0Sqcc7KgjHGKstw446zi7SurSXESKgd4hJea7w= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v6 v6.0.0/go.mod h1:zflC9v4VfViJrSvcvplqws/yGXVbUEMZi/iHpZdSPWA= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.1.0 h1:2qsIIvxVT+uE6yrNldntJKlLRgxGbZ85kgtz5SNBhMw= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.1.0/go.mod h1:AW8VEadnhw9xox+VaVd9sP7NjzOAnaZBLRH6Tq3cJ38= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph v0.9.0 h1:zLzoX5+W2l95UJoVwiyNS4dX8vHyQ6x2xRLoBBL9wMk= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph v0.9.0/go.mod h1:wVEOJfGTj0oPAUGA1JuRAvz/lxXQsWW16axmHPP47Bk= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 h1:Dd+RhdJn0OTtVGaeDLZpcumkIVCtA/3/Fo42+eoYvVM= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0/go.mod h1:5kakwfW5CjC9KK+Q4wjXAg+ShuIm2mBMua0ZFj2C8PE= github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/HdrHistogram/hdrhistogram-go v1.1.2 h1:5IcZpTvzydCQeHzK4Ef/D5rrSqwxob0t8PQPMybUNFM= @@ -31,6 +38,11 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPd github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4= github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI= +github.com/aws/amazon-ec2-instance-selector/v2 v2.4.2-0.20231006140257-d989c5d76f0e h1:WWOuG4hx+k8KjLO0tHGrYUwY95nKJMMU9A/IGeIEKnU= +github.com/aws/amazon-ec2-instance-selector/v2 v2.4.2-0.20231006140257-d989c5d76f0e/go.mod h1:xN+IXvhDWtzz9rQrNVLK+wwXvNie/bc6gv9gSP1cxlg= +github.com/aws/aws-sdk-go v1.45.6 h1:Y2isQQBZsnO15dzUQo9YQRThtHgrV200XCH05BRHVJI= +github.com/aws/aws-sdk-go v1.45.6/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= +github.com/aws/aws-sdk-go-v2 v1.21.0/go.mod h1:/RfNgGmRxI+iFOB1OeJUyxiU+9s88k3pfHvDagGEp0M= github.com/aws/aws-sdk-go-v2 v1.27.2 h1:pLsTXqX93rimAOZG2FIYraDQstZaaGVVN4tNw65v0h8= github.com/aws/aws-sdk-go-v2 v1.27.2/go.mod h1:ffIFB97e2yNsv4aTSGkqtHnppsIJzw7G7BReUZ3jCXM= github.com/aws/aws-sdk-go-v2/config v1.27.18 h1:wFvAnwOKKe7QAyIxziwSKjmer9JBMH1vzIL6W+fYuKk= @@ -39,8 +51,10 @@ github.com/aws/aws-sdk-go-v2/credentials v1.17.18 h1:D/ALDWqK4JdY3OFgA2thcPO1c9a github.com/aws/aws-sdk-go-v2/credentials v1.17.18/go.mod h1:JuitCWq+F5QGUrmMPsk945rop6bB57jdscu+Glozdnc= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.5 h1:dDgptDO9dxeFkXy+tEgVkzSClHZje/6JkPW5aZyEvrQ= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.5/go.mod h1:gjvE2KBUgUQhcv89jqxrIxH9GaKs1JbZzWejj/DaHGA= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.41/go.mod h1:CrObHAuPneJBlfEJ5T3szXOUkLEThaGfvnhTf33buas= github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.9 h1:cy8ahBJuhtM8GTTSyOkfy6WVPV1IE+SS5/wfXUYuulw= github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.9/go.mod h1:CZBXGLaJnEZI6EVNcPd7a6B5IC5cA/GkRWtu9fp3S6Y= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.35/go.mod h1:SJC1nEVVva1g3pHAIdCp7QsRIkMmLAgoDquQ9Rr8kYw= github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.9 h1:A4SYk07ef04+vxZToz9LWvAXl9LW0NClpPpMsi31cz0= github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.9/go.mod h1:5jJcHuwDagxN+ErjQ3PU3ocf6Ylc/p9x+BLO/+X4iXw= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 h1:hT8rVHwugYE2lEfdFE0QWVo81lF7jMrYJVDWI+f+VxU= @@ -51,18 +65,23 @@ github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 h1:Ji0DY1x github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2/go.mod h1:5CsjAbs3NlGQyZNFACh+zztPDI7fU6eW9QsxjfnuBKg= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.11 h1:o4T+fKxA3gTMcluBNZZXE9DNaMkJuUL1O3mffCUjoJo= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.11/go.mod h1:84oZdJ+VjuJKs9v1UTC9NaodRZRseOXCTgku+vQJWR8= +github.com/aws/aws-sdk-go-v2/service/pricing v1.21.6 h1:k/f3T13s7wx/By6aKovlVsjdNkRVT0QRR2RlZEvaTGg= +github.com/aws/aws-sdk-go-v2/service/pricing v1.21.6/go.mod h1:9n3tkRCngy3+Iw/8vK3C69iXh22SCGsy3yn16nTxH+s= github.com/aws/aws-sdk-go-v2/service/sso v1.20.11 h1:gEYM2GSpr4YNWc6hCd5nod4+d4kd9vWIAWrmGuLdlMw= github.com/aws/aws-sdk-go-v2/service/sso v1.20.11/go.mod h1:gVvwPdPNYehHSP9Rs7q27U1EU+3Or2ZpXvzAYJNh63w= github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.5 h1:iXjh3uaH3vsVcnyZX7MqCoCfcyxIrVE9iOQruRaWPrQ= github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.5/go.mod h1:5ZXesEuy/QcO0WUnt+4sDkxhdXRHTu2yG0uCSH8B6os= github.com/aws/aws-sdk-go-v2/service/sts v1.28.12 h1:M/1u4HBpwLuMtjlxuI2y6HoVLzF5e2mfxHCg7ZVMYmk= github.com/aws/aws-sdk-go-v2/service/sts v1.28.12/go.mod h1:kcfd+eTdEi/40FIbLq4Hif3XMXnl5b/+t/KTfLt9xIk= +github.com/aws/smithy-go v1.14.2/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= 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/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/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ= github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= +github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= +github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= @@ -95,6 +114,8 @@ github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a h1:mATvB/9r/3gvcej github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= +github.com/evertras/bubble-table v0.15.2 h1:hVj27V9tk5TD5p6mVv0RK/KJu2sHq0U+mBMux/HptkU= +github.com/evertras/bubble-table v0.15.2/go.mod h1:SPOZKbIpyYWPHBNki3fyNpiPBQkvkULAtOT7NTD5fKY= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= @@ -124,6 +145,7 @@ github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= 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/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= @@ -139,6 +161,8 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= 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/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= +github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= 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= @@ -178,6 +202,8 @@ github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzp 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/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-ps v1.0.0 h1:i6ampVEEF4wQFF+bkYfwYgY+F/uYJDktmvLPf7qIgjc= github.com/mitchellh/go-ps v1.0.0/go.mod h1:J4lOc8z8yJs6vUwklHw2XEIiT4z4C40KtWVN3nvg8Pg= github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0= @@ -194,6 +220,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/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY= github.com/nxadm/tail v1.4.11/go.mod h1:OTaG3NK980DZzxbRq6lEuzgU+mug70nY11sMd4JXXHc= +github.com/oliveagle/jsonpath v0.0.0-20180606110733-2e52cf6e6852 h1:Yl0tPBa8QPjGmesFh1D0rDy+q1Twx6FyU7VWHi8wZbI= +github.com/oliveagle/jsonpath v0.0.0-20180606110733-2e52cf6e6852/go.mod h1:eqOVx5Vwu4gd2mmMZvVZsgIqNSaW3xxRThUJ0k/TPk4= github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= github.com/opentracing/basictracer-go v1.1.0 h1:Oa1fTSBvAl8pa3U+IJYqrKm0NALwH9OsgwOqDv4xJW0= @@ -201,6 +229,8 @@ github.com/opentracing/basictracer-go v1.1.0/go.mod h1:V2HZueSJEp879yv285Aap1BS6 github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= +github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc= +github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/pgavlin/fx v0.1.6 h1:r9jEg69DhNoCd3Xh0+5mIbdbS3PqWrVWujkY76MFRTU= @@ -253,6 +283,8 @@ github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6ke github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= +github.com/sahilm/fuzzy v0.1.0 h1:FzWGaw2Opqyu+794ZQ9SYifWv2EIXpwP4q8dY1kDAwI= +github.com/sahilm/fuzzy v0.1.0/go.mod h1:VFvziUEIMCrT6A6tw2RFIXPXXmzXbOsSHF0DOI8ZK9Y= github.com/santhosh-tekuri/jsonschema/v5 v5.0.0 h1:TToq11gyfNlrMFZiYujSekIsPd9AmsA2Bj/iv+s4JHE= github.com/santhosh-tekuri/jsonschema/v5 v5.0.0/go.mod h1:FKdcjfQW6rpZSnxxUvEA5H/cDPdvJ/SZJQLWWXWGrZ0= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= @@ -309,8 +341,8 @@ github.com/zclconf/go-cty v1.13.2 h1:4GvrUxe/QUDYuJKAav4EYqdM47/kZa672LwmXFmEKT0 github.com/zclconf/go-cty v1.13.2/go.mod h1:YKQzy/7pZ7iq2jNFzy5go57xdxdWoLLpaEp4u238AE0= go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= -go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -318,8 +350,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y 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/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= +golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/exp v0.0.0-20240604190554-fc45aab8b7f8 h1:LoYXNGAShUG3m/ehNk4iFctuhGX/+R1ZpfJ4/ia80JM= golang.org/x/exp v0.0.0-20240604190554-fc45aab8b7f8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= @@ -338,11 +370,12 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY 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.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= 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/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= +golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -371,15 +404,16 @@ 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.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= +golang.org/x/sys v0.22.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.1.0/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.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA= -golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0= +golang.org/x/term v0.22.0 h1:BbsgPEJULsl2fV/AT3v15Mjva5yXKQDyKf+TbDz7QJk= +golang.org/x/term v0.22.0/go.mod h1:F3qCibpT5AMpCRfhfT53vVJwhLtIVHhB9XDjfFvnMI4= 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= diff --git a/pkg/provider/azure/action/linux/linux.go b/pkg/provider/azure/action/linux/linux.go index 56af42234..304195911 100644 --- a/pkg/provider/azure/action/linux/linux.go +++ b/pkg/provider/azure/action/linux/linux.go @@ -33,7 +33,7 @@ const ( type LinuxRequest struct { Prefix string Location string - VMSize string + VMSizes []string Arch string OSType OSType Version string @@ -65,7 +65,7 @@ func Destroy() error { // Main function to deploy all requried resources to azure func (r *LinuxRequest) deployer(ctx *pulumi.Context) error { // Get values for spot machine - location, spotPrice, err := r.valuesCheckingSpot() + location, vmType, spotPrice, err := r.valuesCheckingSpot() if err != nil { return err } @@ -112,7 +112,7 @@ func (r *LinuxRequest) deployer(ctx *pulumi.Context) error { ComponentID: azureLinuxID, ResourceGroup: rg, NetworkInteface: n.NetworkInterface, - VMSize: r.VMSize, + VMSize: vmType, Publisher: ir.publisher, Offer: ir.offer, Sku: ir.sku, @@ -145,21 +145,21 @@ func (r *LinuxRequest) deployer(ctx *pulumi.Context) error { return err } -func (r *LinuxRequest) valuesCheckingSpot() (*string, *float64, error) { +func (r *LinuxRequest) valuesCheckingSpot() (*string, string, *float64, error) { if r.Spot { bsc, err := spotprice.GetBestSpotChoice(spotprice.BestSpotChoiceRequest{ - VMTypes: []string{r.VMSize}, + VMTypes: r.VMSizes, OSType: "linux", EvictioRateTolerance: r.SpotTolerance, }) logging.Debugf("Best spot price option found: %v", bsc) if err != nil { - return nil, nil, err + return nil, "", nil, err } - return &bsc.Location, &bsc.Price, nil + return &bsc.Location, bsc.VMType, &bsc.Price, nil } - return &r.Location, nil, nil + return &r.Location, "", nil, nil } // Write exported values in context to files o a selected target folder diff --git a/pkg/provider/azure/action/windows/windows.go b/pkg/provider/azure/action/windows/windows.go index dfc123345..d524acbd7 100644 --- a/pkg/provider/azure/action/windows/windows.go +++ b/pkg/provider/azure/action/windows/windows.go @@ -35,7 +35,7 @@ var RHQPCISetupScript []byte type WindowsRequest struct { Prefix string Location string - VMSize string + VMSizes []string Version string Feature string Username string @@ -81,7 +81,7 @@ func Destroy() error { // Main function to deploy all requried resources to azure func (r *WindowsRequest) deployer(ctx *pulumi.Context) error { // Get values for spot machine - location, spotPrice, err := r.valuesCheckingSpot() + location, vmType, spotPrice, err := r.valuesCheckingSpot() if err != nil { return err } @@ -122,7 +122,7 @@ func (r *WindowsRequest) deployer(ctx *pulumi.Context) error { ComponentID: azureWindowsDesktopID, ResourceGroup: rg, NetworkInteface: n.NetworkInterface, - VMSize: r.VMSize, + VMSize: vmType, Publisher: "MicrosoftWindowsDesktop", Offer: fmt.Sprintf("windows-%s", r.Version), Sku: fmt.Sprintf("win%s-%s", r.Version, r.Feature), @@ -161,21 +161,21 @@ func (r *WindowsRequest) deployer(ctx *pulumi.Context) error { return err } -func (r *WindowsRequest) valuesCheckingSpot() (*string, *float64, error) { +func (r *WindowsRequest) valuesCheckingSpot() (*string, string, *float64, error) { if r.Spot { bsc, err := spotprice.GetBestSpotChoice(spotprice.BestSpotChoiceRequest{ - VMTypes: []string{r.VMSize}, + VMTypes: r.VMSizes, OSType: "windows", EvictioRateTolerance: r.SpotTolerance, }) logging.Debugf("Best spot price option found: %v", bsc) if err != nil { - return nil, nil, err + return nil, "", nil, err } - return &bsc.Location, &bsc.Price, nil + return &bsc.Location, bsc.VMType, &bsc.Price, nil } - return &r.Location, nil, nil + return &r.Location, "", nil, nil } // Write exported values in context to files o a selected target folder diff --git a/pkg/provider/azure/module/identity/azidentity.go b/pkg/provider/azure/module/identity/azidentity.go new file mode 100644 index 000000000..ed1e107b2 --- /dev/null +++ b/pkg/provider/azure/module/identity/azidentity.go @@ -0,0 +1,24 @@ +package identity + +import ( + "os" + "strings" +) + +var azIdentityEnvs = []string{ + "AZURE_TENANT_ID", + "AZURE_SUBSCRIPTION_ID", + "AZURE_CLIENT_ID", + "AZURE_CLIENT_SECRET", +} + +// Envs required for auth with go sdk +// https://learn.microsoft.com/es-es/azure/developer/go/azure-sdk-authentication?tabs=bash#service-principal-with-a-secret +// do not match standard envs for pulumi envs for auth with native sdk +// https://www.pulumi.com/registry/packages/azure-native/installation-configuration/#set-configuration-using-environment-variables +func SetAZIdentityEnvs() { + for _, e := range azIdentityEnvs { + os.Setenv(e, + os.Getenv(strings.ReplaceAll(e, "AZURE", "ARM"))) + } +} diff --git a/pkg/provider/azure/module/spot-price/spot-price.go b/pkg/provider/azure/module/spot-price/spot-price.go index b74dfb030..7bf53a6d0 100644 --- a/pkg/provider/azure/module/spot-price/spot-price.go +++ b/pkg/provider/azure/module/spot-price/spot-price.go @@ -4,7 +4,6 @@ import ( "context" "encoding/json" "fmt" - "os" "slices" "sort" "strings" @@ -12,6 +11,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph" + maptAzIdentity "github.com/redhat-developer/mapt/pkg/provider/azure/module/identity" "github.com/redhat-developer/mapt/pkg/util" "github.com/redhat-developer/mapt/pkg/util/logging" "golang.org/x/exp/maps" @@ -71,22 +71,13 @@ type evictionRate struct { EvictionRate string `json:"spotEvictionRate"` } -var ( - azIdentityEnvs = []string{ - "AZURE_TENANT_ID", - "AZURE_SUBSCRIPTION_ID", - "AZURE_CLIENT_ID", - "AZURE_CLIENT_SECRET", - } - - evictionRates = map[string]evictionRateSpec{ - "lowest": {Lowest, "lowest", 0, "0-5"}, - "low": {Low, "low", 1, "5-10"}, - "medium": {Medium, "medium", 2, "10-15"}, - "high": {High, "high", 3, "15-20"}, - "highest": {Highest, "highest", 4, "20+"}, - } -) +var evictionRates = map[string]evictionRateSpec{ + "lowest": {Lowest, "lowest", 0, "0-5"}, + "low": {Low, "low", 1, "5-10"}, + "medium": {Medium, "medium", 2, "10-15"}, + "high": {High, "high", 3, "15-20"}, + "highest": {Highest, "highest", 4, "20+"}, +} // This function will return the best spot option func GetBestSpotChoice(r BestSpotChoiceRequest) (*BestSpotChoiceResponse, error) { @@ -115,7 +106,7 @@ func GetBestSpotChoice(r BestSpotChoiceRequest) (*BestSpotChoiceResponse, error) func getGraphClient() (*armresourcegraph.Client, error) { // Auth identity - setAZIdentityEnvs() + maptAzIdentity.SetAZIdentityEnvs() cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { return nil, fmt.Errorf("error getting the best spot price choice: %v", err) @@ -124,17 +115,6 @@ func getGraphClient() (*armresourcegraph.Client, error) { return armresourcegraph.NewClient(cred, nil) } -// Envs required for auth with go sdk -// https://learn.microsoft.com/es-es/azure/developer/go/azure-sdk-authentication?tabs=bash#service-principal-with-a-secret -// do not match standard envs for pulumi envs for auth with native sdk -// https://www.pulumi.com/registry/packages/azure-native/installation-configuration/#set-configuration-using-environment-variables -func setAZIdentityEnvs() { - for _, e := range azIdentityEnvs { - os.Setenv(e, - os.Getenv(strings.ReplaceAll(e, "AZURE", "ARM"))) - } -} - func getPriceHistory(ctx context.Context, client *armresourcegraph.Client, r BestSpotChoiceRequest) ([]priceHistory, error) { spr := fmt.Sprintf(querySpotPrice, diff --git a/pkg/util/resources/azure.go b/pkg/util/resources/azure.go new file mode 100644 index 000000000..a1b1f9115 --- /dev/null +++ b/pkg/util/resources/azure.go @@ -0,0 +1,186 @@ +package resources + +import ( + "context" + "log" + "os" + "slices" + "strconv" + "strings" + "sync" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + armcompute "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v6" + maptAzIdenity "github.com/redhat-developer/mapt/pkg/provider/azure/module/identity" +) + +func getAzureVMSKUs(cpus, memory int32, arch Arch) []string { + maptAzIdenity.SetAZIdentityEnvs() + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + subscriptionId := os.Getenv("AZURE_SUBSCRIPTION_ID") + clientFactory, err := armcompute.NewClientFactory(subscriptionId, cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewResourceSKUsClient().NewListPager(&armcompute.ResourceSKUsClientListOptions{Filter: nil, + IncludeExtendedLocations: nil, + }) + + vmTypes := []string{} + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + vmTypes = append(vmTypes, FilterVMs(page, filterCPUsAndMemory(cpus, memory, arch))...) + } + return vmTypes +} + +type filterFunc func(*armcompute.ResourceSKU, *sync.WaitGroup, chan<- string) + +func filterCPUsAndMemory(cpus, memory int32, arch Arch) filterFunc { + return func(res *armcompute.ResourceSKU, wg *sync.WaitGroup, vmCh chan<- string) { + defer wg.Done() + choose := false + if res.ResourceType != nil && *res.ResourceType != "virtualMachines" { + return + } + for _, capability := range res.Capabilities { + if *capability.Name == "vCPUs" { + vCpus, err := strconv.ParseInt(*capability.Value, 10, 32) + if err != nil { + return + } + if vCpus == int64(cpus) { + choose = true + } + continue + } + if *capability.Name == "MemoryGB" { + mem, err := strconv.ParseInt(*capability.Value, 10, 32) + if err != nil { + return + } + if mem == int64(memory) { + choose = choose && true + } else { + choose = choose && false + } + continue + } + if *capability.Name == "HyperVGenerations" { + if strings.Contains(*capability.Value, "V2") { + choose = choose && true + } else { + choose = choose && false + } + continue + } + if *capability.Name == "AcceleratedNetworkingEnabled" { + fastNet, err := strconv.ParseBool(*capability.Value) + if err != nil { + return + } + if fastNet { + choose = choose && true + } else { + choose = choose && false + } + continue + } + if *capability.Name == "EncryptionAtHostSupported" { + encryption, err := strconv.ParseBool(*capability.Value) + if err != nil { + return + } + if encryption { + choose = choose && true + } else { + choose = choose && false + } + continue + } + if *capability.Name == "CpuArchitectureType" { + if *capability.Value == arch.String() { + choose = choose && true + } else { + choose = choose && false + } + continue + } + if *capability.Name == "LowPriorityCapable" { + lowPriority, err := strconv.ParseBool(*capability.Value) + if err != nil { + return + } + if lowPriority { + choose = choose && true + } else { + choose = choose && false + } + continue + } + if *capability.Name == "PremiumIO" { + premiumIO, err := strconv.ParseBool(*capability.Value) + if err != nil { + return + } + if premiumIO { + choose = choose && true + } else { + choose = choose && false + } + continue + } + if *capability.Name == "MaxResourceVolumeMB" { + disk, err := strconv.ParseUint(*capability.Value, 10, 64) + if err != nil { + return + } + if disk == 0 { + choose = choose && true + } else { + choose = choose && false + } + } + } + if choose { + vmCh <- *res.Name + } + } +} + +func FilterVMs(skus armcompute.ResourceSKUsClientListResponse, filter filterFunc) []string { + chVmTypes := make(chan string) + vmTypes := []string{} + wg := &sync.WaitGroup{} + for _, v := range skus.Value { + wg.Add(1) + go filter(v, wg, chVmTypes) + } + c := make(chan int) + + go func() { + defer close(c) + wg.Wait() + }() + + for { + select { + case vmtype := <-chVmTypes: + if !slices.Contains(vmTypes, vmtype) { + vmTypes = append(vmTypes, vmtype) + } + if len(vmTypes) == 4 { + return vmTypes + } + case <-c: + return vmTypes + } + } +} diff --git a/pkg/util/resources/resources.go b/pkg/util/resources/resources.go index 5eb851170..62bcc9168 100644 --- a/pkg/util/resources/resources.go +++ b/pkg/util/resources/resources.go @@ -1,6 +1,31 @@ package resources -import "fmt" +import ( + "context" + "fmt" + + "github.com/aws/amazon-ec2-instance-selector/v2/pkg/bytequantity" + "github.com/aws/amazon-ec2-instance-selector/v2/pkg/selector" + "github.com/aws/aws-sdk-go-v2/config" + ec2types "github.com/aws/aws-sdk-go-v2/service/ec2/types" +) + +type Arch int + +func (a Arch) String() string { + switch a { + case Amd64: + return "x64" + case Arm64: + return "Arm64" + } + return "x64" +} + +const ( + Amd64 Arch = iota + 1 + Arm64 +) // Returns the unique name to identify a resoruces within // pulumi context @@ -10,3 +35,47 @@ func GetResourceName(prefix, maptComponentID, resourceTypeAbbrev string) string } return fmt.Sprintf("%s-%s", maptComponentID, resourceTypeAbbrev) } + +func GetAwsMachineTypes(vCpus, memoryGib int32, cpuArch Arch) ([]string, error) { + ctx := context.Background() + cfg, err := config.LoadDefaultConfig(ctx) + if err != nil { + return nil, err + } + instanceSelector, err := selector.New(ctx, cfg) + if err != nil { + return nil, err + } + + vcpusRange := selector.Int32RangeFilter{ + LowerBound: vCpus, + UpperBound: vCpus, + } + memoryRange := selector.ByteQuantityRangeFilter{ + LowerBound: bytequantity.FromGiB(uint64(memoryGib)), + UpperBound: bytequantity.FromGiB(uint64(memoryGib)), + } + + arch := ec2types.ArchitectureTypeX8664 + if cpuArch == Arm64 { + arch = ec2types.ArchitectureTypeArm64 + } + maxResults := 3 + + filters := selector.Filters{ + VCpusRange: &vcpusRange, + MemoryRange: &memoryRange, + CPUArchitecture: &arch, + MaxResults: &maxResults, + } + + instanceTypesSlice, err := instanceSelector.Filter(ctx, filters) + if err != nil { + return nil, err + } + return instanceTypesSlice, nil +} + +func GetAzureMachineTypes(vCpus, memoryGib int32, arch Arch) []string { + return getAzureVMSKUs(vCpus, memoryGib, arch) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/CHANGELOG.md index af095f1da..1a9cedbaf 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/CHANGELOG.md +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 1.13.0 (2024-07-16) + +### Features Added + +- Added runtime.NewRequestFromRequest(), allowing for a policy.Request to be created from an existing *http.Request. + ## 1.12.0 (2024-06-06) ### Features Added diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/internal/resource/resource_identifier.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/internal/resource/resource_identifier.go index 187fe82b9..00f2d5a0a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/internal/resource/resource_identifier.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/internal/resource/resource_identifier.go @@ -192,7 +192,7 @@ func appendNext(parent *ResourceID, parts []string, id string) (*ResourceID, err } if strings.EqualFold(parts[0], providersKey) && (len(parts) == 2 || strings.EqualFold(parts[2], providersKey)) { - //provider resource can only be on a tenant or a subscription parent + // provider resource can only be on a tenant or a subscription parent if parent.ResourceType.String() != SubscriptionResourceType.String() && parent.ResourceType.String() != TenantResourceType.String() { return nil, fmt.Errorf("invalid resource ID: %s", id) } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime/pipeline.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime/pipeline.go index 039b758bf..6a7c916b4 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime/pipeline.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime/pipeline.go @@ -34,18 +34,22 @@ func NewPipeline(module, version string, cred azcore.TokenCredential, plOpts azr InsecureAllowCredentialWithHTTP: options.InsecureAllowCredentialWithHTTP, Scopes: []string{conf.Audience + "/.default"}, }) + // we don't want to modify the underlying array in plOpts.PerRetry perRetry := make([]azpolicy.Policy, len(plOpts.PerRetry), len(plOpts.PerRetry)+1) copy(perRetry, plOpts.PerRetry) - plOpts.PerRetry = append(perRetry, authPolicy, exported.PolicyFunc(httpTraceNamespacePolicy)) + perRetry = append(perRetry, authPolicy, exported.PolicyFunc(httpTraceNamespacePolicy)) + plOpts.PerRetry = perRetry if !options.DisableRPRegistration { regRPOpts := armpolicy.RegistrationOptions{ClientOptions: options.ClientOptions} regPolicy, err := NewRPRegistrationPolicy(cred, ®RPOpts) if err != nil { return azruntime.Pipeline{}, err } + // we don't want to modify the underlying array in plOpts.PerCall perCall := make([]azpolicy.Policy, len(plOpts.PerCall), len(plOpts.PerCall)+1) copy(perCall, plOpts.PerCall) - plOpts.PerCall = append(perCall, regPolicy) + perCall = append(perCall, regPolicy) + plOpts.PerCall = perCall } if plOpts.APIVersion.Name == "" { plOpts.APIVersion.Name = "api-version" diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/request.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/request.go index 3041984d9..e3e2d4e58 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/request.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/request.go @@ -7,6 +7,7 @@ package exported import ( + "bytes" "context" "encoding/base64" "errors" @@ -67,6 +68,42 @@ func (ov opValues) get(value any) bool { return ok } +// NewRequestFromRequest creates a new policy.Request with an existing *http.Request +// Exported as runtime.NewRequestFromRequest(). +func NewRequestFromRequest(req *http.Request) (*Request, error) { + policyReq := &Request{req: req} + + if req.Body != nil { + // we can avoid a body copy here if the underlying stream is already a + // ReadSeekCloser. + readSeekCloser, isReadSeekCloser := req.Body.(io.ReadSeekCloser) + + if !isReadSeekCloser { + // since this is an already populated http.Request we want to copy + // over its body, if it has one. + bodyBytes, err := io.ReadAll(req.Body) + + if err != nil { + return nil, err + } + + if err := req.Body.Close(); err != nil { + return nil, err + } + + readSeekCloser = NopCloser(bytes.NewReader(bodyBytes)) + } + + // SetBody also takes care of updating the http.Request's body + // as well, so they should stay in-sync from this point. + if err := policyReq.SetBody(readSeekCloser, req.Header.Get("Content-Type")); err != nil { + return nil, err + } + } + + return policyReq, nil +} + // NewRequest creates a new Request with the specified input. // Exported as runtime.NewRequest(). func NewRequest(ctx context.Context, httpMethod string, endpoint string) (*Request, error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared/constants.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared/constants.go index 79651fd96..e5b28a9b1 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared/constants.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared/constants.go @@ -40,5 +40,5 @@ const ( Module = "azcore" // Version is the semantic version (see http://semver.org) of this module. - Version = "v1.12.0" + Version = "v1.13.0" ) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/request.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/request.go index 40ddc8d92..7d34b7803 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/request.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/request.go @@ -15,6 +15,7 @@ import ( "fmt" "io" "mime/multipart" + "net/http" "net/textproto" "net/url" "path" @@ -45,6 +46,11 @@ func NewRequest(ctx context.Context, httpMethod string, endpoint string) (*polic return exported.NewRequest(ctx, httpMethod, endpoint) } +// NewRequestFromRequest creates a new policy.Request with an existing *http.Request +func NewRequestFromRequest(req *http.Request) (*policy.Request, error) { + return exported.NewRequestFromRequest(req) +} + // EncodeQueryParams will parse and encode any query parameters in the specified URL. // Any semicolons will automatically be escaped. func EncodeQueryParams(u string) (string, error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/CHANGELOG.md index 6d4b6feb8..a8c2feb6d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/CHANGELOG.md +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/CHANGELOG.md @@ -1,5 +1,29 @@ # Release History +## 1.7.0 (2024-06-20) + +### Features Added +* `AzurePipelinesCredential` authenticates an Azure Pipelines service connection with + workload identity federation + +### Breaking Changes +> These changes affect only code written against a beta version such as v1.7.0-beta.1 +* Removed the persistent token caching API. It will return in v1.8.0-beta.1 + +## 1.7.0-beta.1 (2024-06-10) + +### Features Added +* Restored `AzurePipelinesCredential` and persistent token caching API + +## Breaking Changes +> These changes affect only code written against a beta version such as v1.6.0-beta.4 +* Values which `NewAzurePipelinesCredential` read from environment variables in + prior versions are now parameters +* Renamed `AzurePipelinesServiceConnectionCredentialOptions` to `AzurePipelinesCredentialOptions` + +### Bugs Fixed +* Managed identity bug fixes + ## 1.6.0 (2024-06-10) ### Features Added diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/README.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/README.md index b5acff0e6..7e201ea2f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/README.md +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/README.md @@ -140,6 +140,7 @@ client := armresources.NewResourceGroupsClient("subscription ID", chain, nil) |Credential|Usage |-|- +|[AzurePipelinesCredential](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity#AzurePipelinesCredential)|Authenticate an Azure Pipelines [service connection](https://learn.microsoft.com/azure/devops/pipelines/library/service-endpoints?view=azure-devops&tabs=yaml) |[ClientAssertionCredential](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity#ClientAssertionCredential)|Authenticate a service principal with a signed client assertion |[ClientCertificateCredential](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity#ClientCertificateCredential)|Authenticate a service principal with a certificate |[ClientSecretCredential](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity#ClientSecretCredential)|Authenticate a service principal with a secret diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/TOKEN_CACHING.MD b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/TOKEN_CACHING.MD index f9cc48943..fbaa29220 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/TOKEN_CACHING.MD +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/TOKEN_CACHING.MD @@ -57,6 +57,7 @@ The following table indicates the state of in-memory and persistent caching in e |--------------------------------|---------------------------------------------------------------------|--------------------------| | `AzureCLICredential` | Not Supported | Not Supported | | `AzureDeveloperCLICredential` | Not Supported | Not Supported | +| `AzurePipelinesCredential` | Supported | Supported | | `ClientAssertionCredential` | Supported | Supported | | `ClientCertificateCredential` | Supported | Supported | | `ClientSecretCredential` | Supported | Supported | diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/TROUBLESHOOTING.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/TROUBLESHOOTING.md index 3564e685e..54016a070 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/TROUBLESHOOTING.md +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/TROUBLESHOOTING.md @@ -10,6 +10,7 @@ This troubleshooting guide covers failure investigation techniques, common error - [Enable and configure logging](#enable-and-configure-logging) - [Troubleshoot AzureCLICredential authentication issues](#troubleshoot-azureclicredential-authentication-issues) - [Troubleshoot AzureDeveloperCLICredential authentication issues](#troubleshoot-azuredeveloperclicredential-authentication-issues) +- [Troubleshoot AzurePipelinesCredential authentication issues](#troubleshoot-azurepipelinescredential-authentication-issues) - [Troubleshoot ClientCertificateCredential authentication issues](#troubleshoot-clientcertificatecredential-authentication-issues) - [Troubleshoot ClientSecretCredential authentication issues](#troubleshoot-clientsecretcredential-authentication-issues) - [Troubleshoot DefaultAzureCredential authentication issues](#troubleshoot-defaultazurecredential-authentication-issues) @@ -226,6 +227,15 @@ azd auth token --output json --scope https://management.core.windows.net/.defaul |---|---|---| |no client ID/tenant ID/token file specified|Incomplete configuration|In most cases these values are provided via environment variables set by Azure Workload Identity.