k8s.io/client-go@v0.31.1/kubernetes/typed/certificates/v1beta1/certificates_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 v1beta1
    20  
    21  import (
    22  	"net/http"
    23  
    24  	v1beta1 "k8s.io/api/certificates/v1beta1"
    25  	"k8s.io/client-go/kubernetes/scheme"
    26  	rest "k8s.io/client-go/rest"
    27  )
    28  
    29  type CertificatesV1beta1Interface interface {
    30  	RESTClient() rest.Interface
    31  	CertificateSigningRequestsGetter
    32  }
    33  
    34  // CertificatesV1beta1Client is used to interact with features provided by the certificates.k8s.io group.
    35  type CertificatesV1beta1Client struct {
    36  	restClient rest.Interface
    37  }
    38  
    39  func (c *CertificatesV1beta1Client) CertificateSigningRequests() CertificateSigningRequestInterface {
    40  	return newCertificateSigningRequests(c)
    41  }
    42  
    43  // NewForConfig creates a new CertificatesV1beta1Client for the given config.
    44  // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
    45  // where httpClient was generated with rest.HTTPClientFor(c).
    46  func NewForConfig(c *rest.Config) (*CertificatesV1beta1Client, error) {
    47  	config := *c
    48  	if err := setConfigDefaults(&config); err != nil {
    49  		return nil, err
    50  	}
    51  	httpClient, err := rest.HTTPClientFor(&config)
    52  	if err != nil {
    53  		return nil, err
    54  	}
    55  	return NewForConfigAndClient(&config, httpClient)
    56  }
    57  
    58  // NewForConfigAndClient creates a new CertificatesV1beta1Client for the given config and http client.
    59  // Note the http client provided takes precedence over the configured transport values.
    60  func NewForConfigAndClient(c *rest.Config, h *http.Client) (*CertificatesV1beta1Client, error) {
    61  	config := *c
    62  	if err := setConfigDefaults(&config); err != nil {
    63  		return nil, err
    64  	}
    65  	client, err := rest.RESTClientForConfigAndClient(&config, h)
    66  	if err != nil {
    67  		return nil, err
    68  	}
    69  	return &CertificatesV1beta1Client{client}, nil
    70  }
    71  
    72  // NewForConfigOrDie creates a new CertificatesV1beta1Client for the given config and
    73  // panics if there is an error in the config.
    74  func NewForConfigOrDie(c *rest.Config) *CertificatesV1beta1Client {
    75  	client, err := NewForConfig(c)
    76  	if err != nil {
    77  		panic(err)
    78  	}
    79  	return client
    80  }
    81  
    82  // New creates a new CertificatesV1beta1Client for the given RESTClient.
    83  func New(c rest.Interface) *CertificatesV1beta1Client {
    84  	return &CertificatesV1beta1Client{c}
    85  }
    86  
    87  func setConfigDefaults(config *rest.Config) error {
    88  	gv := v1beta1.SchemeGroupVersion
    89  	config.GroupVersion = &gv
    90  	config.APIPath = "/apis"
    91  	config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
    92  
    93  	if config.UserAgent == "" {
    94  		config.UserAgent = rest.DefaultKubernetesUserAgent()
    95  	}
    96  
    97  	return nil
    98  }
    99  
   100  // RESTClient returns a RESTClient that is used to communicate
   101  // with API server by this client implementation.
   102  func (c *CertificatesV1beta1Client) RESTClient() rest.Interface {
   103  	if c == nil {
   104  		return nil
   105  	}
   106  	return c.restClient
   107  }