@@ -25,16 +25,14 @@ import (
25
25
var _ Reader = & typedClient {}
26
26
var _ Writer = & typedClient {}
27
27
28
- // client is a client.Client that reads and writes directly from/to an API server. It lazily initializes
29
- // new clients at the time they are used, and caches the client.
30
28
type typedClient struct {
31
- cache * clientCache
29
+ resources * clientRestResources
32
30
paramCodec runtime.ParameterCodec
33
31
}
34
32
35
33
// Create implements client.Client.
36
34
func (c * typedClient ) Create (ctx context.Context , obj Object , opts ... CreateOption ) error {
37
- o , err := c .cache .getObjMeta (obj )
35
+ o , err := c .resources .getObjMeta (obj )
38
36
if err != nil {
39
37
return err
40
38
}
@@ -53,7 +51,7 @@ func (c *typedClient) Create(ctx context.Context, obj Object, opts ...CreateOpti
53
51
54
52
// Update implements client.Client.
55
53
func (c * typedClient ) Update (ctx context.Context , obj Object , opts ... UpdateOption ) error {
56
- o , err := c .cache .getObjMeta (obj )
54
+ o , err := c .resources .getObjMeta (obj )
57
55
if err != nil {
58
56
return err
59
57
}
@@ -73,7 +71,7 @@ func (c *typedClient) Update(ctx context.Context, obj Object, opts ...UpdateOpti
73
71
74
72
// Delete implements client.Client.
75
73
func (c * typedClient ) Delete (ctx context.Context , obj Object , opts ... DeleteOption ) error {
76
- o , err := c .cache .getObjMeta (obj )
74
+ o , err := c .resources .getObjMeta (obj )
77
75
if err != nil {
78
76
return err
79
77
}
@@ -92,7 +90,7 @@ func (c *typedClient) Delete(ctx context.Context, obj Object, opts ...DeleteOpti
92
90
93
91
// DeleteAllOf implements client.Client.
94
92
func (c * typedClient ) DeleteAllOf (ctx context.Context , obj Object , opts ... DeleteAllOfOption ) error {
95
- o , err := c .cache .getObjMeta (obj )
93
+ o , err := c .resources .getObjMeta (obj )
96
94
if err != nil {
97
95
return err
98
96
}
@@ -111,7 +109,7 @@ func (c *typedClient) DeleteAllOf(ctx context.Context, obj Object, opts ...Delet
111
109
112
110
// Patch implements client.Client.
113
111
func (c * typedClient ) Patch (ctx context.Context , obj Object , patch Patch , opts ... PatchOption ) error {
114
- o , err := c .cache .getObjMeta (obj )
112
+ o , err := c .resources .getObjMeta (obj )
115
113
if err != nil {
116
114
return err
117
115
}
@@ -136,7 +134,7 @@ func (c *typedClient) Patch(ctx context.Context, obj Object, patch Patch, opts .
136
134
137
135
// Get implements client.Client.
138
136
func (c * typedClient ) Get (ctx context.Context , key ObjectKey , obj Object , opts ... GetOption ) error {
139
- r , err := c .cache .getResource (obj )
137
+ r , err := c .resources .getResource (obj )
140
138
if err != nil {
141
139
return err
142
140
}
@@ -151,7 +149,7 @@ func (c *typedClient) Get(ctx context.Context, key ObjectKey, obj Object, opts .
151
149
152
150
// List implements client.Client.
153
151
func (c * typedClient ) List (ctx context.Context , obj ObjectList , opts ... ListOption ) error {
154
- r , err := c .cache .getResource (obj )
152
+ r , err := c .resources .getResource (obj )
155
153
if err != nil {
156
154
return err
157
155
}
@@ -168,7 +166,7 @@ func (c *typedClient) List(ctx context.Context, obj ObjectList, opts ...ListOpti
168
166
}
169
167
170
168
func (c * typedClient ) GetSubResource (ctx context.Context , obj , subResourceObj Object , subResource string , opts ... SubResourceGetOption ) error {
171
- o , err := c .cache .getObjMeta (obj )
169
+ o , err := c .resources .getObjMeta (obj )
172
170
if err != nil {
173
171
return err
174
172
}
@@ -191,7 +189,7 @@ func (c *typedClient) GetSubResource(ctx context.Context, obj, subResourceObj Ob
191
189
}
192
190
193
191
func (c * typedClient ) CreateSubResource (ctx context.Context , obj Object , subResourceObj Object , subResource string , opts ... SubResourceCreateOption ) error {
194
- o , err := c .cache .getObjMeta (obj )
192
+ o , err := c .resources .getObjMeta (obj )
195
193
if err != nil {
196
194
return err
197
195
}
@@ -216,7 +214,7 @@ func (c *typedClient) CreateSubResource(ctx context.Context, obj Object, subReso
216
214
217
215
// UpdateSubResource used by SubResourceWriter to write status.
218
216
func (c * typedClient ) UpdateSubResource (ctx context.Context , obj Object , subResource string , opts ... SubResourceUpdateOption ) error {
219
- o , err := c .cache .getObjMeta (obj )
217
+ o , err := c .resources .getObjMeta (obj )
220
218
if err != nil {
221
219
return err
222
220
}
@@ -251,7 +249,7 @@ func (c *typedClient) UpdateSubResource(ctx context.Context, obj Object, subReso
251
249
252
250
// PatchSubResource used by SubResourceWriter to write subresource.
253
251
func (c * typedClient ) PatchSubResource (ctx context.Context , obj Object , subResource string , patch Patch , opts ... SubResourcePatchOption ) error {
254
- o , err := c .cache .getObjMeta (obj )
252
+ o , err := c .resources .getObjMeta (obj )
255
253
if err != nil {
256
254
return err
257
255
}
0 commit comments