Remove BPA from Makefile
[icn.git] / cmd / bpa-operator / vendor / k8s.io / apimachinery / pkg / apis / meta / v1 / meta.go
1 /*
2 Copyright 2016 The Kubernetes Authors.
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8     http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15 */
16
17 package v1
18
19 import (
20         "k8s.io/apimachinery/pkg/runtime/schema"
21         "k8s.io/apimachinery/pkg/types"
22 )
23
24 // TODO: move this, Object, List, and Type to a different package
25 type ObjectMetaAccessor interface {
26         GetObjectMeta() Object
27 }
28
29 // Object lets you work with object metadata from any of the versioned or
30 // internal API objects. Attempting to set or retrieve a field on an object that does
31 // not support that field (Name, UID, Namespace on lists) will be a no-op and return
32 // a default value.
33 type Object interface {
34         GetNamespace() string
35         SetNamespace(namespace string)
36         GetName() string
37         SetName(name string)
38         GetGenerateName() string
39         SetGenerateName(name string)
40         GetUID() types.UID
41         SetUID(uid types.UID)
42         GetResourceVersion() string
43         SetResourceVersion(version string)
44         GetGeneration() int64
45         SetGeneration(generation int64)
46         GetSelfLink() string
47         SetSelfLink(selfLink string)
48         GetCreationTimestamp() Time
49         SetCreationTimestamp(timestamp Time)
50         GetDeletionTimestamp() *Time
51         SetDeletionTimestamp(timestamp *Time)
52         GetDeletionGracePeriodSeconds() *int64
53         SetDeletionGracePeriodSeconds(*int64)
54         GetLabels() map[string]string
55         SetLabels(labels map[string]string)
56         GetAnnotations() map[string]string
57         SetAnnotations(annotations map[string]string)
58         GetInitializers() *Initializers
59         SetInitializers(initializers *Initializers)
60         GetFinalizers() []string
61         SetFinalizers(finalizers []string)
62         GetOwnerReferences() []OwnerReference
63         SetOwnerReferences([]OwnerReference)
64         GetClusterName() string
65         SetClusterName(clusterName string)
66 }
67
68 // ListMetaAccessor retrieves the list interface from an object
69 type ListMetaAccessor interface {
70         GetListMeta() ListInterface
71 }
72
73 // Common lets you work with core metadata from any of the versioned or
74 // internal API objects. Attempting to set or retrieve a field on an object that does
75 // not support that field will be a no-op and return a default value.
76 // TODO: move this, and TypeMeta and ListMeta, to a different package
77 type Common interface {
78         GetResourceVersion() string
79         SetResourceVersion(version string)
80         GetSelfLink() string
81         SetSelfLink(selfLink string)
82 }
83
84 // ListInterface lets you work with list metadata from any of the versioned or
85 // internal API objects. Attempting to set or retrieve a field on an object that does
86 // not support that field will be a no-op and return a default value.
87 // TODO: move this, and TypeMeta and ListMeta, to a different package
88 type ListInterface interface {
89         GetResourceVersion() string
90         SetResourceVersion(version string)
91         GetSelfLink() string
92         SetSelfLink(selfLink string)
93         GetContinue() string
94         SetContinue(c string)
95 }
96
97 // Type exposes the type and APIVersion of versioned or internal API objects.
98 // TODO: move this, and TypeMeta and ListMeta, to a different package
99 type Type interface {
100         GetAPIVersion() string
101         SetAPIVersion(version string)
102         GetKind() string
103         SetKind(kind string)
104 }
105
106 func (meta *ListMeta) GetResourceVersion() string        { return meta.ResourceVersion }
107 func (meta *ListMeta) SetResourceVersion(version string) { meta.ResourceVersion = version }
108 func (meta *ListMeta) GetSelfLink() string               { return meta.SelfLink }
109 func (meta *ListMeta) SetSelfLink(selfLink string)       { meta.SelfLink = selfLink }
110 func (meta *ListMeta) GetContinue() string               { return meta.Continue }
111 func (meta *ListMeta) SetContinue(c string)              { meta.Continue = c }
112
113 func (obj *TypeMeta) GetObjectKind() schema.ObjectKind { return obj }
114
115 // SetGroupVersionKind satisfies the ObjectKind interface for all objects that embed TypeMeta
116 func (obj *TypeMeta) SetGroupVersionKind(gvk schema.GroupVersionKind) {
117         obj.APIVersion, obj.Kind = gvk.ToAPIVersionAndKind()
118 }
119
120 // GroupVersionKind satisfies the ObjectKind interface for all objects that embed TypeMeta
121 func (obj *TypeMeta) GroupVersionKind() schema.GroupVersionKind {
122         return schema.FromAPIVersionAndKind(obj.APIVersion, obj.Kind)
123 }
124
125 func (obj *ListMeta) GetListMeta() ListInterface { return obj }
126
127 func (obj *ObjectMeta) GetObjectMeta() Object { return obj }
128
129 // Namespace implements metav1.Object for any object with an ObjectMeta typed field. Allows
130 // fast, direct access to metadata fields for API objects.
131 func (meta *ObjectMeta) GetNamespace() string                { return meta.Namespace }
132 func (meta *ObjectMeta) SetNamespace(namespace string)       { meta.Namespace = namespace }
133 func (meta *ObjectMeta) GetName() string                     { return meta.Name }
134 func (meta *ObjectMeta) SetName(name string)                 { meta.Name = name }
135 func (meta *ObjectMeta) GetGenerateName() string             { return meta.GenerateName }
136 func (meta *ObjectMeta) SetGenerateName(generateName string) { meta.GenerateName = generateName }
137 func (meta *ObjectMeta) GetUID() types.UID                   { return meta.UID }
138 func (meta *ObjectMeta) SetUID(uid types.UID)                { meta.UID = uid }
139 func (meta *ObjectMeta) GetResourceVersion() string          { return meta.ResourceVersion }
140 func (meta *ObjectMeta) SetResourceVersion(version string)   { meta.ResourceVersion = version }
141 func (meta *ObjectMeta) GetGeneration() int64                { return meta.Generation }
142 func (meta *ObjectMeta) SetGeneration(generation int64)      { meta.Generation = generation }
143 func (meta *ObjectMeta) GetSelfLink() string                 { return meta.SelfLink }
144 func (meta *ObjectMeta) SetSelfLink(selfLink string)         { meta.SelfLink = selfLink }
145 func (meta *ObjectMeta) GetCreationTimestamp() Time          { return meta.CreationTimestamp }
146 func (meta *ObjectMeta) SetCreationTimestamp(creationTimestamp Time) {
147         meta.CreationTimestamp = creationTimestamp
148 }
149 func (meta *ObjectMeta) GetDeletionTimestamp() *Time { return meta.DeletionTimestamp }
150 func (meta *ObjectMeta) SetDeletionTimestamp(deletionTimestamp *Time) {
151         meta.DeletionTimestamp = deletionTimestamp
152 }
153 func (meta *ObjectMeta) GetDeletionGracePeriodSeconds() *int64 { return meta.DeletionGracePeriodSeconds }
154 func (meta *ObjectMeta) SetDeletionGracePeriodSeconds(deletionGracePeriodSeconds *int64) {
155         meta.DeletionGracePeriodSeconds = deletionGracePeriodSeconds
156 }
157 func (meta *ObjectMeta) GetLabels() map[string]string                 { return meta.Labels }
158 func (meta *ObjectMeta) SetLabels(labels map[string]string)           { meta.Labels = labels }
159 func (meta *ObjectMeta) GetAnnotations() map[string]string            { return meta.Annotations }
160 func (meta *ObjectMeta) SetAnnotations(annotations map[string]string) { meta.Annotations = annotations }
161 func (meta *ObjectMeta) GetInitializers() *Initializers               { return meta.Initializers }
162 func (meta *ObjectMeta) SetInitializers(initializers *Initializers)   { meta.Initializers = initializers }
163 func (meta *ObjectMeta) GetFinalizers() []string                      { return meta.Finalizers }
164 func (meta *ObjectMeta) SetFinalizers(finalizers []string)            { meta.Finalizers = finalizers }
165 func (meta *ObjectMeta) GetOwnerReferences() []OwnerReference         { return meta.OwnerReferences }
166 func (meta *ObjectMeta) SetOwnerReferences(references []OwnerReference) {
167         meta.OwnerReferences = references
168 }
169 func (meta *ObjectMeta) GetClusterName() string            { return meta.ClusterName }
170 func (meta *ObjectMeta) SetClusterName(clusterName string) { meta.ClusterName = clusterName }