registry/response: rename Collection to ProviderVersionCollection for clarity

This commit is contained in:
Kristin Laemmert 2018-08-09 10:05:17 -07:00 committed by Martin Atkins
parent 44f52e47c5
commit 5e7956f440
4 changed files with 4 additions and 8 deletions

View File

@ -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

View File

@ -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"},

View File

@ -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"
)

View File

@ -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)