| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
package v1 |
| 20 |
|
| 21 |
import ( |
| 22 |
http "net/http" |
| 23 |
|
| 24 |
rbacv1 "k8s.io/api/rbac/v1" |
| 25 |
scheme "k8s.io/client-go/kubernetes/scheme" |
| 26 |
rest "k8s.io/client-go/rest" |
| 27 |
) |
| 28 |
|
| 29 |
type RbacV1Interface interface { |
| 30 |
RESTClient() rest.Interface |
| 31 |
ClusterRolesGetter |
| 32 |
ClusterRoleBindingsGetter |
| 33 |
RolesGetter |
| 34 |
RoleBindingsGetter |
| 35 |
} |
| 36 |
|
| 37 |
|
| 38 |
type RbacV1Client struct { |
| 39 |
restClient rest.Interface |
| 40 |
} |
| 41 |
|
| 42 |
func (c *RbacV1Client) ClusterRoles() ClusterRoleInterface { |
| 43 |
return newClusterRoles(c) |
| 44 |
} |
| 45 |
|
| 46 |
func (c *RbacV1Client) ClusterRoleBindings() ClusterRoleBindingInterface { |
| 47 |
return newClusterRoleBindings(c) |
| 48 |
} |
| 49 |
|
| 50 |
func (c *RbacV1Client) Roles(namespace string) RoleInterface { |
| 51 |
return newRoles(c, namespace) |
| 52 |
} |
| 53 |
|
| 54 |
func (c *RbacV1Client) RoleBindings(namespace string) RoleBindingInterface { |
| 55 |
return newRoleBindings(c, namespace) |
| 56 |
} |
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
func NewForConfig(c *rest.Config) (*RbacV1Client, error) { |
| 62 |
config := *c |
| 63 |
setConfigDefaults(&config) |
| 64 |
httpClient, err := rest.HTTPClientFor(&config) |
| 65 |
if err != nil { |
| 66 |
return nil, err |
| 67 |
} |
| 68 |
return NewForConfigAndClient(&config, httpClient) |
| 69 |
} |
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
func NewForConfigAndClient(c *rest.Config, h *http.Client) (*RbacV1Client, error) { |
| 74 |
config := *c |
| 75 |
setConfigDefaults(&config) |
| 76 |
client, err := rest.RESTClientForConfigAndClient(&config, h) |
| 77 |
if err != nil { |
| 78 |
return nil, err |
| 79 |
} |
| 80 |
return &RbacV1Client{client}, nil |
| 81 |
} |
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
func NewForConfigOrDie(c *rest.Config) *RbacV1Client { |
| 86 |
client, err := NewForConfig(c) |
| 87 |
if err != nil { |
| 88 |
panic(err) |
| 89 |
} |
| 90 |
return client |
| 91 |
} |
| 92 |
|
| 93 |
|
| 94 |
func New(c rest.Interface) *RbacV1Client { |
| 95 |
return &RbacV1Client{c} |
| 96 |
} |
| 97 |
|
| 98 |
func setConfigDefaults(config *rest.Config) { |
| 99 |
gv := rbacv1.SchemeGroupVersion |
| 100 |
config.GroupVersion = &gv |
| 101 |
config.APIPath = "/apis" |
| 102 |
config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion() |
| 103 |
|
| 104 |
if config.UserAgent == "" { |
| 105 |
config.UserAgent = rest.DefaultKubernetesUserAgent() |
| 106 |
} |
| 107 |
} |
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
func (c *RbacV1Client) RESTClient() rest.Interface { |
| 112 |
if c == nil { |
| 113 |
return nil |
| 114 |
} |
| 115 |
return c.restClient |
| 116 |
} |