@@ -53,6 +53,7 @@ type DeploymentStorage struct {
53
53
Rollback * RollbackREST
54
54
}
55
55
56
+ // NewStorage returns new instance of DeploymentStorage.
56
57
func NewStorage (optsGetter generic.RESTOptionsGetter ) (DeploymentStorage , error ) {
57
58
deploymentRest , deploymentStatusRest , deploymentRollbackRest , err := NewREST (optsGetter )
58
59
if err != nil {
@@ -67,6 +68,7 @@ func NewStorage(optsGetter generic.RESTOptionsGetter) (DeploymentStorage, error)
67
68
}, nil
68
69
}
69
70
71
+ // REST implements a RESTStorage for Deployments.
70
72
type REST struct {
71
73
* genericregistry.Store
72
74
categories []string
@@ -111,6 +113,7 @@ func (r *REST) Categories() []string {
111
113
return r .categories
112
114
}
113
115
116
+ // WithCategories sets categories for REST.
114
117
func (r * REST ) WithCategories (categories []string ) * REST {
115
118
r .categories = categories
116
119
return r
@@ -121,6 +124,7 @@ type StatusREST struct {
121
124
store * genericregistry.Store
122
125
}
123
126
127
+ // New returns empty Deployment object.
124
128
func (r * StatusREST ) New () runtime.Object {
125
129
return & apps.Deployment {}
126
130
}
@@ -163,6 +167,7 @@ func (r *RollbackREST) New() runtime.Object {
163
167
164
168
var _ = rest .NamedCreater (& RollbackREST {})
165
169
170
+ // Create runs rollback for deployment
166
171
func (r * RollbackREST ) Create (ctx context.Context , name string , obj runtime.Object , createValidation rest.ValidateObjectFunc , options * metav1.CreateOptions ) (runtime.Object , error ) {
167
172
rollback , ok := obj .(* apps.DeploymentRollback )
168
173
if ! ok {
@@ -230,6 +235,7 @@ func (r *RollbackREST) setDeploymentRollback(ctx context.Context, deploymentID s
230
235
return finalDeployment , err
231
236
}
232
237
238
+ // ScaleREST implements a Scale for Deployment.
233
239
type ScaleREST struct {
234
240
store * genericregistry.Store
235
241
}
@@ -238,6 +244,7 @@ type ScaleREST struct {
238
244
var _ = rest .Patcher (& ScaleREST {})
239
245
var _ = rest .GroupVersionKindProvider (& ScaleREST {})
240
246
247
+ // GroupVersionKind returns GroupVersionKind for Deployment Scale object
241
248
func (r * ScaleREST ) GroupVersionKind (containingGV schema.GroupVersion ) schema.GroupVersionKind {
242
249
switch containingGV {
243
250
case extensionsv1beta1 .SchemeGroupVersion :
@@ -256,6 +263,7 @@ func (r *ScaleREST) New() runtime.Object {
256
263
return & autoscaling.Scale {}
257
264
}
258
265
266
+ // Get retrieves object from Scale storage.
259
267
func (r * ScaleREST ) Get (ctx context.Context , name string , options * metav1.GetOptions ) (runtime.Object , error ) {
260
268
obj , err := r .store .Get (ctx , name , options )
261
269
if err != nil {
@@ -269,6 +277,7 @@ func (r *ScaleREST) Get(ctx context.Context, name string, options *metav1.GetOpt
269
277
return scale , nil
270
278
}
271
279
280
+ // Update alters scale subset of Deployment object.
272
281
func (r * ScaleREST ) Update (ctx context.Context , name string , objInfo rest.UpdatedObjectInfo , createValidation rest.ValidateObjectFunc , updateValidation rest.ValidateObjectUpdateFunc , forceAllowCreate bool , options * metav1.UpdateOptions ) (runtime.Object , bool , error ) {
273
282
obj , err := r .store .Get (ctx , name , & metav1.GetOptions {})
274
283
if err != nil {
0 commit comments