// LabelSelectorAsSelector converts the LabelSelector api type into a struct that implements // labels.Selector // Note: This function should be kept in sync with the selector methods in pkg/labels/selector.go func LabelSelectorAsSelector(ps *LabelSelector) (labels.Selector, error) { … } // LabelSelectorAsMap converts the LabelSelector api type into a map of strings, ie. the // original structure of a label selector. Operators that cannot be converted into plain // labels (Exists, DoesNotExist, NotIn, and In with more than one value) will result in // an error. func LabelSelectorAsMap(ps *LabelSelector) (map[string]string, error) { … } // ParseToLabelSelector parses a string representing a selector into a LabelSelector object. // Note: This function should be kept in sync with the parser in pkg/labels/selector.go func ParseToLabelSelector(selector string) (*LabelSelector, error) { … } // SetAsLabelSelector converts the labels.Set object into a LabelSelector api object. func SetAsLabelSelector(ls labels.Set) *LabelSelector { … } // FormatLabelSelector convert labelSelector into plain string func FormatLabelSelector(labelSelector *LabelSelector) string { … } func ExtractGroupVersions(l *APIGroupList) []string { … } // HasAnnotation returns a bool if passed in annotation exists func HasAnnotation(obj ObjectMeta, ann string) bool { … } // SetMetaDataAnnotation sets the annotation and value func SetMetaDataAnnotation(obj *ObjectMeta, ann string, value string) { … } // HasLabel returns a bool if passed in label exists func HasLabel(obj ObjectMeta, label string) bool { … } // SetMetaDataLabel sets the label and value func SetMetaDataLabel(obj *ObjectMeta, label string, value string) { … } // SingleObject returns a ListOptions for watching a single object. func SingleObject(meta ObjectMeta) ListOptions { … } // NewDeleteOptions returns a DeleteOptions indicating the resource should // be deleted within the specified grace period. Use zero to indicate // immediate deletion. If you would prefer to use the default grace period, // use &metav1.DeleteOptions{} directly. func NewDeleteOptions(grace int64) *DeleteOptions { … } // NewPreconditionDeleteOptions returns a DeleteOptions with a UID precondition set. func NewPreconditionDeleteOptions(uid string) *DeleteOptions { … } // NewUIDPreconditions returns a Preconditions with UID set. func NewUIDPreconditions(uid string) *Preconditions { … } // NewRVDeletionPrecondition returns a DeleteOptions with a ResourceVersion precondition set. func NewRVDeletionPrecondition(rv string) *DeleteOptions { … } // HasObjectMetaSystemFieldValues returns true if fields that are managed by the system on ObjectMeta have values. func HasObjectMetaSystemFieldValues(meta Object) bool { … } // ResetObjectMetaForStatus forces the meta fields for a status update to match the meta fields // for a pre-existing object. This is opt-in for new objects with Status subresource. func ResetObjectMetaForStatus(meta, existingMeta Object) { … } // MarshalJSON implements json.Marshaler // MarshalJSON may get called on pointers or values, so implement MarshalJSON on value. // http://stackoverflow.com/questions/21390979/custom-marshaljson-never-gets-called-in-go func (f FieldsV1) MarshalJSON() ([]byte, error) { … } // UnmarshalJSON implements json.Unmarshaler func (f *FieldsV1) UnmarshalJSON(b []byte) error { … } var _ … var _ … func (f FieldsV1) MarshalCBOR() ([]byte, error) { … } var cborNull … func (f *FieldsV1) UnmarshalCBOR(b []byte) error { … } const fieldsV1InvalidOrEmpty … const fieldsV1InvalidOrValidJSONObject … const fieldsV1InvalidOrValidCBORObject … // getContentType returns one of fieldsV1InvalidOrEmpty, fieldsV1InvalidOrValidJSONObject, // fieldsV1InvalidOrValidCBORObject based on the value of Raw. // // Raw can be encoded in JSON or CBOR and is only valid if it is empty, null, or an object (map) // value. It is invalid if it contains a JSON string, number, boolean, or array. If Raw is nonempty // and represents an allowable value, then the initial byte unambiguously distinguishes a // JSON-encoded value from a CBOR-encoded value. // // A valid JSON-encoded value can begin with any of the four JSON whitespace characters, the first // character 'n' of null, or '{' (0x09, 0x0a, 0x0d, 0x20, 0x6e, or 0x7b, respectively). A valid // CBOR-encoded value can begin with the null simple value, an initial byte with major type "map", // or, if a tag-enclosed map, an initial byte with major type "tag" (0xf6, 0xa0...0xbf, or // 0xc6...0xdb). The two sets of valid initial bytes don't intersect. func (f FieldsV1) getContentType() int { … }