Remove BPA from Makefile
[icn.git] / cmd / bpa-operator / vendor / k8s.io / client-go / dynamic / interface.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 dynamic
18
19 import (
20         metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21         "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
22         "k8s.io/apimachinery/pkg/runtime/schema"
23         "k8s.io/apimachinery/pkg/types"
24         "k8s.io/apimachinery/pkg/watch"
25 )
26
27 type Interface interface {
28         Resource(resource schema.GroupVersionResource) NamespaceableResourceInterface
29 }
30
31 type ResourceInterface interface {
32         Create(obj *unstructured.Unstructured, options metav1.CreateOptions, subresources ...string) (*unstructured.Unstructured, error)
33         Update(obj *unstructured.Unstructured, options metav1.UpdateOptions, subresources ...string) (*unstructured.Unstructured, error)
34         UpdateStatus(obj *unstructured.Unstructured, options metav1.UpdateOptions) (*unstructured.Unstructured, error)
35         Delete(name string, options *metav1.DeleteOptions, subresources ...string) error
36         DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error
37         Get(name string, options metav1.GetOptions, subresources ...string) (*unstructured.Unstructured, error)
38         List(opts metav1.ListOptions) (*unstructured.UnstructuredList, error)
39         Watch(opts metav1.ListOptions) (watch.Interface, error)
40         Patch(name string, pt types.PatchType, data []byte, options metav1.UpdateOptions, subresources ...string) (*unstructured.Unstructured, error)
41 }
42
43 type NamespaceableResourceInterface interface {
44         Namespace(string) ResourceInterface
45         ResourceInterface
46 }
47
48 // APIPathResolverFunc knows how to convert a groupVersion to its API path. The Kind field is optional.
49 // TODO find a better place to move this for existing callers
50 type APIPathResolverFunc func(kind schema.GroupVersionKind) string
51
52 // LegacyAPIPathResolverFunc can resolve paths properly with the legacy API.
53 // TODO find a better place to move this for existing callers
54 func LegacyAPIPathResolverFunc(kind schema.GroupVersionKind) string {
55         if len(kind.Group) == 0 {
56                 return "/api"
57         }
58         return "/apis"
59 }