k8s.io/client-go@v0.31.1/metadata/interface.go (about) 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 metadata 18 19 import ( 20 "context" 21 22 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 23 "k8s.io/apimachinery/pkg/runtime/schema" 24 "k8s.io/apimachinery/pkg/types" 25 "k8s.io/apimachinery/pkg/watch" 26 ) 27 28 // Interface allows a caller to get the metadata (in the form of PartialObjectMetadata objects) 29 // from any Kubernetes compatible resource API. 30 type Interface interface { 31 Resource(resource schema.GroupVersionResource) Getter 32 } 33 34 // ResourceInterface contains the set of methods that may be invoked on objects by their metadata. 35 // Update is not supported by the server, but Patch can be used for the actions Update would handle. 36 type ResourceInterface interface { 37 Delete(ctx context.Context, name string, options metav1.DeleteOptions, subresources ...string) error 38 DeleteCollection(ctx context.Context, options metav1.DeleteOptions, listOptions metav1.ListOptions) error 39 Get(ctx context.Context, name string, options metav1.GetOptions, subresources ...string) (*metav1.PartialObjectMetadata, error) 40 List(ctx context.Context, opts metav1.ListOptions) (*metav1.PartialObjectMetadataList, error) 41 Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) 42 Patch(ctx context.Context, name string, pt types.PatchType, data []byte, options metav1.PatchOptions, subresources ...string) (*metav1.PartialObjectMetadata, error) 43 } 44 45 // Getter handles both namespaced and non-namespaced resource types consistently. 46 type Getter interface { 47 Namespace(string) ResourceInterface 48 ResourceInterface 49 }