Adding a 'Typename' strongtype for representing all compute resource types.

This commit is contained in:
Vishnu Kannan
2015-01-17 00:34:47 +00:00
parent 4c413e794e
commit c32295a180
8 changed files with 146 additions and 0 deletions

View File

@@ -21,6 +21,7 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/resource"
"github.com/GoogleCloudPlatform/kubernetes/pkg/conversion"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/davecgh/go-spew/spew"
)
@@ -60,3 +61,9 @@ var Semantic = conversion.EqualitiesOrDie(
return a.Amount.Cmp(b.Amount) == 0
},
)
var standardResources = util.NewStringSet(string(ResourceMemory), string(ResourceCPU))
func IsStandardResourceName(str string) bool {
return standardResources.Has(str)
}