blob: f03beae8550740bf281927d0be0d7828f3e0f098 [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/storage/v1"
23 "k8s.io/client-go/kubernetes/scheme"
24 rest "k8s.io/client-go/rest"
25)
26
27type StorageV1Interface interface {
28 RESTClient() rest.Interface
29 CSIDriversGetter
30 CSINodesGetter
31 StorageClassesGetter
32 VolumeAttachmentsGetter
33}
34
35// StorageV1Client is used to interact with features provided by the storage.k8s.io group.
36type StorageV1Client struct {
37 restClient rest.Interface
38}
39
40func (c *StorageV1Client) CSIDrivers() CSIDriverInterface {
41 return newCSIDrivers(c)
42}
43
44func (c *StorageV1Client) CSINodes() CSINodeInterface {
45 return newCSINodes(c)
46}
47
48func (c *StorageV1Client) StorageClasses() StorageClassInterface {
49 return newStorageClasses(c)
50}
51
52func (c *StorageV1Client) VolumeAttachments() VolumeAttachmentInterface {
53 return newVolumeAttachments(c)
54}
55
56// NewForConfig creates a new StorageV1Client for the given config.
57func NewForConfig(c *rest.Config) (*StorageV1Client, 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 &StorageV1Client{client}, nil
67}
68
69// NewForConfigOrDie creates a new StorageV1Client for the given config and
70// panics if there is an error in the config.
71func NewForConfigOrDie(c *rest.Config) *StorageV1Client {
72 client, err := NewForConfig(c)
73 if err != nil {
74 panic(err)
75 }
76 return client
77}
78
79// New creates a new StorageV1Client for the given RESTClient.
80func New(c rest.Interface) *StorageV1Client {
81 return &StorageV1Client{c}
82}
83
84func setConfigDefaults(config *rest.Config) error {
85 gv := v1.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 *StorageV1Client) RESTClient() rest.Interface {
100 if c == nil {
101 return nil
102 }
103 return c.restClient
104}