blob: c83b93575e6f83f06cbcf5acecae388941fa1920 [file] [log] [blame]
Matteo Scandoloa4285862020-12-01 18:10:10 -08001/*
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 v1
20
21import (
22 v1 "k8s.io/api/networking/v1"
23 "k8s.io/client-go/kubernetes/scheme"
24 rest "k8s.io/client-go/rest"
25)
26
27type NetworkingV1Interface interface {
28 RESTClient() rest.Interface
29 IngressesGetter
30 IngressClassesGetter
31 NetworkPoliciesGetter
32}
33
34// NetworkingV1Client is used to interact with features provided by the networking.k8s.io group.
35type NetworkingV1Client struct {
36 restClient rest.Interface
37}
38
39func (c *NetworkingV1Client) Ingresses(namespace string) IngressInterface {
40 return newIngresses(c, namespace)
41}
42
43func (c *NetworkingV1Client) IngressClasses() IngressClassInterface {
44 return newIngressClasses(c)
45}
46
47func (c *NetworkingV1Client) NetworkPolicies(namespace string) NetworkPolicyInterface {
48 return newNetworkPolicies(c, namespace)
49}
50
51// NewForConfig creates a new NetworkingV1Client for the given config.
52func NewForConfig(c *rest.Config) (*NetworkingV1Client, 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 &NetworkingV1Client{client}, nil
62}
63
64// NewForConfigOrDie creates a new NetworkingV1Client for the given config and
65// panics if there is an error in the config.
66func NewForConfigOrDie(c *rest.Config) *NetworkingV1Client {
67 client, err := NewForConfig(c)
68 if err != nil {
69 panic(err)
70 }
71 return client
72}
73
74// New creates a new NetworkingV1Client for the given RESTClient.
75func New(c rest.Interface) *NetworkingV1Client {
76 return &NetworkingV1Client{c}
77}
78
79func setConfigDefaults(config *rest.Config) error {
80 gv := v1.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 *NetworkingV1Client) RESTClient() rest.Interface {
95 if c == nil {
96 return nil
97 }
98 return c.restClient
99}