|
| 1 | +/* |
| 2 | +Copyright 2022 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 | +package crontabs |
| 18 | + |
| 19 | +import ( |
| 20 | + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 21 | + "k8s.io/apimachinery/pkg/runtime" |
| 22 | +) |
| 23 | + |
| 24 | +type CronTabSpec struct { |
| 25 | + CronSpec string `json:"cronSpec"` |
| 26 | + Image string `json:"image"` |
| 27 | + Replicas int `json:"replicas,omitempty"` |
| 28 | +} |
| 29 | + |
| 30 | +type CronTab struct { |
| 31 | + metav1.TypeMeta `json:",inline"` |
| 32 | + metav1.ObjectMeta `json:"metadata,omitempty"` |
| 33 | + |
| 34 | + Spec CronTabSpec `json:"spec"` |
| 35 | +} |
| 36 | + |
| 37 | +type CronTabList struct { |
| 38 | + metav1.TypeMeta `json:",inline"` |
| 39 | + metav1.ListMeta `json:"metadata,omitempty"` |
| 40 | + |
| 41 | + Items []CronTab `json:"items"` |
| 42 | +} |
| 43 | + |
| 44 | +// DeepCopyInto copies all properties of this object into another object of the |
| 45 | +// same type that is provided as a pointer. |
| 46 | +func (in *CronTab) DeepCopyInto(out *CronTab) { |
| 47 | + out.TypeMeta = in.TypeMeta |
| 48 | + out.ObjectMeta = in.ObjectMeta |
| 49 | + out.Spec = CronTabSpec{ |
| 50 | + Replicas: in.Spec.Replicas, |
| 51 | + } |
| 52 | +} |
| 53 | + |
| 54 | +// DeepCopyObject returns a generically typed copy of an object |
| 55 | +func (in *CronTab) DeepCopyObject() runtime.Object { |
| 56 | + out := CronTab{} |
| 57 | + in.DeepCopyInto(&out) |
| 58 | + |
| 59 | + return &out |
| 60 | +} |
| 61 | + |
| 62 | +// DeepCopyObject returns a generically typed copy of an object |
| 63 | +func (in *CronTabList) DeepCopyObject() runtime.Object { |
| 64 | + out := CronTabList{} |
| 65 | + out.TypeMeta = in.TypeMeta |
| 66 | + out.ListMeta = in.ListMeta |
| 67 | + |
| 68 | + if in.Items != nil { |
| 69 | + out.Items = make([]CronTab, len(in.Items)) |
| 70 | + for i := range in.Items { |
| 71 | + in.Items[i].DeepCopyInto(&out.Items[i]) |
| 72 | + } |
| 73 | + } |
| 74 | + |
| 75 | + return &out |
| 76 | +} |
0 commit comments