1/* 2Copyright 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// Code generated by client-gen. DO NOT EDIT. 18 19package v1beta1 20 21import ( 22 v1beta1 "k8s.io/api/policy/v1beta1" 23 "k8s.io/client-go/kubernetes/scheme" 24 rest "k8s.io/client-go/rest" 25) 26 27type PolicyV1beta1Interface interface { 28 RESTClient() rest.Interface 29 EvictionsGetter 30 PodDisruptionBudgetsGetter 31 PodSecurityPoliciesGetter 32} 33 34// PolicyV1beta1Client is used to interact with features provided by the policy group. 35type PolicyV1beta1Client struct { 36 restClient rest.Interface 37} 38 39func (c *PolicyV1beta1Client) Evictions(namespace string) EvictionInterface { 40 return newEvictions(c, namespace) 41} 42 43func (c *PolicyV1beta1Client) PodDisruptionBudgets(namespace string) PodDisruptionBudgetInterface { 44 return newPodDisruptionBudgets(c, namespace) 45} 46 47func (c *PolicyV1beta1Client) PodSecurityPolicies() PodSecurityPolicyInterface { 48 return newPodSecurityPolicies(c) 49} 50 51// NewForConfig creates a new PolicyV1beta1Client for the given config. 52func NewForConfig(c *rest.Config) (*PolicyV1beta1Client, error) { 53 config := *c 54 if err := setConfigDefaults(&config); err != nil { 55 return nil, err 56 } 57 client, err := rest.RESTClientFor(&config) 58 if err != nil { 59 return nil, err 60 } 61 return &PolicyV1beta1Client{client}, nil 62} 63 64// NewForConfigOrDie creates a new PolicyV1beta1Client for the given config and 65// panics if there is an error in the config. 66func NewForConfigOrDie(c *rest.Config) *PolicyV1beta1Client { 67 client, err := NewForConfig(c) 68 if err != nil { 69 panic(err) 70 } 71 return client 72} 73 74// New creates a new PolicyV1beta1Client for the given RESTClient. 75func New(c rest.Interface) *PolicyV1beta1Client { 76 return &PolicyV1beta1Client{c} 77} 78 79func setConfigDefaults(config *rest.Config) error { 80 gv := v1beta1.SchemeGroupVersion 81 config.GroupVersion = &gv 82 config.APIPath = "/apis" 83 config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() 84 85 if config.UserAgent == "" { 86 config.UserAgent = rest.DefaultKubernetesUserAgent() 87 } 88 89 return nil 90} 91 92// RESTClient returns a RESTClient that is used to communicate 93// with API server by this client implementation. 94func (c *PolicyV1beta1Client) RESTClient() rest.Interface { 95 if c == nil { 96 return nil 97 } 98 return c.restClient 99} 100