blob: 92378cf7f49671b4546cd1b7f01992cb3015bbee [file] [log] [blame]
Zack Williamse940c7a2019-08-21 14:25:39 -07001/*
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 serializer "k8s.io/apimachinery/pkg/runtime/serializer"
24 "k8s.io/client-go/kubernetes/scheme"
25 rest "k8s.io/client-go/rest"
26)
27
28type StorageV1Interface interface {
29 RESTClient() rest.Interface
30 StorageClassesGetter
31 VolumeAttachmentsGetter
32}
33
34// StorageV1Client is used to interact with features provided by the storage.k8s.io group.
35type StorageV1Client struct {
36 restClient rest.Interface
37}
38
39func (c *StorageV1Client) StorageClasses() StorageClassInterface {
40 return newStorageClasses(c)
41}
42
43func (c *StorageV1Client) VolumeAttachments() VolumeAttachmentInterface {
44 return newVolumeAttachments(c)
45}
46
47// NewForConfig creates a new StorageV1Client for the given config.
48func NewForConfig(c *rest.Config) (*StorageV1Client, error) {
49 config := *c
50 if err := setConfigDefaults(&config); err != nil {
51 return nil, err
52 }
53 client, err := rest.RESTClientFor(&config)
54 if err != nil {
55 return nil, err
56 }
57 return &StorageV1Client{client}, nil
58}
59
60// NewForConfigOrDie creates a new StorageV1Client for the given config and
61// panics if there is an error in the config.
62func NewForConfigOrDie(c *rest.Config) *StorageV1Client {
63 client, err := NewForConfig(c)
64 if err != nil {
65 panic(err)
66 }
67 return client
68}
69
70// New creates a new StorageV1Client for the given RESTClient.
71func New(c rest.Interface) *StorageV1Client {
72 return &StorageV1Client{c}
73}
74
75func setConfigDefaults(config *rest.Config) error {
76 gv := v1.SchemeGroupVersion
77 config.GroupVersion = &gv
78 config.APIPath = "/apis"
79 config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs}
80
81 if config.UserAgent == "" {
82 config.UserAgent = rest.DefaultKubernetesUserAgent()
83 }
84
85 return nil
86}
87
88// RESTClient returns a RESTClient that is used to communicate
89// with API server by this client implementation.
90func (c *StorageV1Client) RESTClient() rest.Interface {
91 if c == nil {
92 return nil
93 }
94 return c.restClient
95}