k8s.io/client-go@v0.22.2/kubernetes/typed/rbac/v1alpha1/rbac_client.go (about)

     1  /*
     2  Copyright 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  // Code generated by client-gen. DO NOT EDIT.
    18  
    19  package v1alpha1
    20  
    21  import (
    22  	v1alpha1 "k8s.io/api/rbac/v1alpha1"
    23  	"k8s.io/client-go/kubernetes/scheme"
    24  	rest "k8s.io/client-go/rest"
    25  )
    26  
    27  type 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.
    36  type RbacV1alpha1Client struct {
    37  	restClient rest.Interface
    38  }
    39  
    40  func (c *RbacV1alpha1Client) ClusterRoles() ClusterRoleInterface {
    41  	return newClusterRoles(c)
    42  }
    43  
    44  func (c *RbacV1alpha1Client) ClusterRoleBindings() ClusterRoleBindingInterface {
    45  	return newClusterRoleBindings(c)
    46  }
    47  
    48  func (c *RbacV1alpha1Client) Roles(namespace string) RoleInterface {
    49  	return newRoles(c, namespace)
    50  }
    51  
    52  func (c *RbacV1alpha1Client) RoleBindings(namespace string) RoleBindingInterface {
    53  	return newRoleBindings(c, namespace)
    54  }
    55  
    56  // NewForConfig creates a new RbacV1alpha1Client for the given config.
    57  func 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.
    71  func 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.
    80  func New(c rest.Interface) *RbacV1alpha1Client {
    81  	return &RbacV1alpha1Client{c}
    82  }
    83  
    84  func 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.
    99  func (c *RbacV1alpha1Client) RESTClient() rest.Interface {
   100  	if c == nil {
   101  		return nil
   102  	}
   103  	return c.restClient
   104  }