apiserver builds again

This commit is contained in:
Daniel Smith
2014-06-16 18:03:44 -07:00
parent 1c6342a794
commit 154ec0db1e
4 changed files with 51 additions and 98 deletions

44
pkg/labels/labels.go Normal file
View File

@@ -0,0 +1,44 @@
/*
Copyright 2014 Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package labels
import (
"strings"
)
// Labels allows you to present labels independently from their storage.
type Labels interface {
Get(label string) (value string)
}
// A map of label:value. Implements Labels.
type LabelSet map[string]string
// All labels listed as a human readable string. Conveiently, exactly the format
// that ParseQuery takes.
func (ls LabelSet) String() string {
query := make([]string, 0, len(ls))
for key, value := range ls {
query = append(query, key+"="+value)
}
return strings.Join(query, ",")
}
// Implement Labels interface.
func (ls LabelSet) Get(label string) string {
return ls[label]
}