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 v1alpha1
20
21import (
22	v1alpha1 "k8s.io/api/rbac/v1alpha1"
23	"k8s.io/client-go/kubernetes/scheme"
24	rest "k8s.io/client-go/rest"
25)
26
27type RbacV1alpha1Interface interface {
28	RESTClient() rest.Interface
29	ClusterRolesGetter
30	ClusterRoleBindingsGetter
31	RolesGetter
32	RoleBindingsGetter
33}
34
35// RbacV1alpha1Client is used to interact with features provided by the rbac.authorization.k8s.io group.
36type RbacV1alpha1Client struct {
37	restClient rest.Interface
38}
39
40func (c *RbacV1alpha1Client) ClusterRoles() ClusterRoleInterface {
41	return newClusterRoles(c)
42}
43
44func (c *RbacV1alpha1Client) ClusterRoleBindings() ClusterRoleBindingInterface {
45	return newClusterRoleBindings(c)
46}
47
48func (c *RbacV1alpha1Client) Roles(namespace string) RoleInterface {
49	return newRoles(c, namespace)
50}
51
52func (c *RbacV1alpha1Client) RoleBindings(namespace string) RoleBindingInterface {
53	return newRoleBindings(c, namespace)
54}
55
56// NewForConfig creates a new RbacV1alpha1Client for the given config.
57func NewForConfig(c *rest.Config) (*RbacV1alpha1Client, error) {
58	config := *c
59	if err := setConfigDefaults(&config); err != nil {
60		return nil, err
61	}
62	client, err := rest.RESTClientFor(&config)
63	if err != nil {
64		return nil, err
65	}
66	return &RbacV1alpha1Client{client}, nil
67}
68
69// NewForConfigOrDie creates a new RbacV1alpha1Client for the given config and
70// panics if there is an error in the config.
71func NewForConfigOrDie(c *rest.Config) *RbacV1alpha1Client {
72	client, err := NewForConfig(c)
73	if err != nil {
74		panic(err)
75	}
76	return client
77}
78
79// New creates a new RbacV1alpha1Client for the given RESTClient.
80func New(c rest.Interface) *RbacV1alpha1Client {
81	return &RbacV1alpha1Client{c}
82}
83
84func setConfigDefaults(config *rest.Config) error {
85	gv := v1alpha1.SchemeGroupVersion
86	config.GroupVersion = &gv
87	config.APIPath = "/apis"
88	config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
89
90	if config.UserAgent == "" {
91		config.UserAgent = rest.DefaultKubernetesUserAgent()
92	}
93
94	return nil
95}
96
97// RESTClient returns a RESTClient that is used to communicate
98// with API server by this client implementation.
99func (c *RbacV1alpha1Client) RESTClient() rest.Interface {
100	if c == nil {
101		return nil
102	}
103	return c.restClient
104}
105