| 
 | 1 | +/*  | 
 | 2 | +Copyright 2025 Flant JSC  | 
 | 3 | +Licensed under the Apache License, Version 2.0 (the "License");  | 
 | 4 | +you may not use this file except in compliance with the License.  | 
 | 5 | +You may obtain a copy of the License at  | 
 | 6 | +     http://www.apache.org/licenses/LICENSE-2.0  | 
 | 7 | +Unless required by applicable law or agreed to in writing, software  | 
 | 8 | +distributed under the License is distributed on an "AS IS" BASIS,  | 
 | 9 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  | 
 | 10 | +See the License for the specific language governing permissions and  | 
 | 11 | +limitations under the License.  | 
 | 12 | +*/  | 
 | 13 | + | 
 | 14 | +package vi  | 
 | 15 | + | 
 | 16 | +import (  | 
 | 17 | +	"github.com/deckhouse/virtualization-controller/pkg/builder/meta"  | 
 | 18 | +	"github.com/deckhouse/virtualization/api/core/v1alpha2"  | 
 | 19 | +)  | 
 | 20 | + | 
 | 21 | +type Option func(vi *v1alpha2.VirtualImage)  | 
 | 22 | + | 
 | 23 | +var (  | 
 | 24 | +	WithName        = meta.WithName[*v1alpha2.VirtualImage]  | 
 | 25 | +	WithNamespace   = meta.WithNamespace[*v1alpha2.VirtualImage]  | 
 | 26 | +	WithLabel       = meta.WithLabel[*v1alpha2.VirtualImage]  | 
 | 27 | +	WithLabels      = meta.WithLabels[*v1alpha2.VirtualImage]  | 
 | 28 | +	WithAnnotation  = meta.WithAnnotation[*v1alpha2.VirtualImage]  | 
 | 29 | +	WithAnnotations = meta.WithAnnotations[*v1alpha2.VirtualImage]  | 
 | 30 | +)  | 
 | 31 | + | 
 | 32 | +func WithPhase(phase v1alpha2.ImagePhase) func(vi *v1alpha2.VirtualImage) {  | 
 | 33 | +	return func(vi *v1alpha2.VirtualImage) {  | 
 | 34 | +		vi.Status.Phase = phase  | 
 | 35 | +	}  | 
 | 36 | +}  | 
 | 37 | + | 
 | 38 | +func WithCDROM(cdrom bool) func(vi *v1alpha2.VirtualImage) {  | 
 | 39 | +	return func(vi *v1alpha2.VirtualImage) {  | 
 | 40 | +		vi.Status.CDROM = cdrom  | 
 | 41 | +	}  | 
 | 42 | +}  | 
0 commit comments