1/*
2Copyright 2018 The Kubernetes Authors.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8    http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
17// Package ifc holds miscellaneous interfaces used by kustomize.
18package ifc
19
20import (
21	"sigs.k8s.io/kustomize/pkg/gvk"
22	"sigs.k8s.io/kustomize/pkg/types"
23)
24
25// Validator provides functions to validate annotations and labels
26type Validator interface {
27	MakeAnnotationValidator() func(map[string]string) error
28	MakeLabelValidator() func(map[string]string) error
29	ValidateNamespace(string) []string
30}
31
32// Loader interface exposes methods to read bytes.
33type Loader interface {
34	// Root returns the root location for this Loader.
35	Root() string
36	// New returns Loader located at newRoot.
37	New(newRoot string) (Loader, error)
38	// Load returns the bytes read from the location or an error.
39	Load(location string) ([]byte, error)
40	// Cleanup cleans the loader
41	Cleanup() error
42}
43
44// Kunstructured allows manipulation of k8s objects
45// that do not have Golang structs.
46type Kunstructured interface {
47	Map() map[string]interface{}
48	SetMap(map[string]interface{})
49	Copy() Kunstructured
50	GetFieldValue(string) (string, error)
51	MarshalJSON() ([]byte, error)
52	UnmarshalJSON([]byte) error
53	GetGvk() gvk.Gvk
54	GetKind() string
55	GetName() string
56	SetName(string)
57	GetLabels() map[string]string
58	SetLabels(map[string]string)
59	GetAnnotations() map[string]string
60	SetAnnotations(map[string]string)
61}
62
63// KunstructuredFactory makes instances of Kunstructured.
64type KunstructuredFactory interface {
65	SliceFromBytes([]byte) ([]Kunstructured, error)
66	FromMap(m map[string]interface{}) Kunstructured
67	MakeConfigMap(args *types.ConfigMapArgs, options *types.GeneratorOptions) (Kunstructured, error)
68	MakeSecret(args *types.SecretArgs, options *types.GeneratorOptions) (Kunstructured, error)
69	Set(ldr Loader)
70}
71
72// See core.v1.SecretTypeOpaque
73const SecretTypeOpaque = "Opaque"
74