registry/response: rename Collection to ProviderVersionCollection for clarity
This commit is contained in:
parent
44f52e47c5
commit
5e7956f440
|
@ -137,7 +137,7 @@ func (i *ProviderInstaller) Get(provider string, req Constraints) (PluginMeta, e
|
|||
}
|
||||
|
||||
// sort them newest to oldest. The newest version wins!
|
||||
response.Collection(versions).Sort()
|
||||
response.ProviderVersionCollection(versions).Sort()
|
||||
|
||||
// if the chosen provider version does not support the requested platform,
|
||||
// filter the list of acceptable versions to those that support that platform
|
||||
|
|
|
@ -160,7 +160,7 @@ func TestVersionListing(t *testing.T) {
|
|||
versions = append(versions, v)
|
||||
}
|
||||
|
||||
response.Collection(versions).Sort()
|
||||
response.ProviderVersionCollection(versions).Sort()
|
||||
|
||||
expected := []*response.TerraformProviderVersion{
|
||||
{Version: "1.2.4"},
|
||||
|
|
|
@ -10,10 +10,6 @@ import (
|
|||
var (
|
||||
// DefaultProviderNamespace represents the namespace for canonical
|
||||
// HashiCorp-controlled providers.
|
||||
// REVIEWERS: Naming things is hard.
|
||||
// * HashiCorpProviderNameSpace?
|
||||
// * OfficialP...?
|
||||
// * CanonicalP...?
|
||||
DefaultProviderNamespace = "terraform-providers"
|
||||
)
|
||||
|
||||
|
|
|
@ -53,10 +53,10 @@ type TerraformProviderPlatformLocation struct {
|
|||
}
|
||||
|
||||
// Collection type for TerraformProviderVersion
|
||||
type Collection []*TerraformProviderVersion
|
||||
type ProviderVersionCollection []*TerraformProviderVersion
|
||||
|
||||
// Sort sorts versions from newest to oldest.
|
||||
func (v Collection) Sort() {
|
||||
func (v ProviderVersionCollection) Sort() {
|
||||
sort.Slice(v, func(i, j int) bool {
|
||||
versionA, _ := version.NewVersion(v[i].Version)
|
||||
versionB, _ := version.NewVersion(v[j].Version)
|
||||
|
|
Loading…
Reference in New Issue