├── .gitignore ├── LICENSE ├── README.md ├── SECURITY.md ├── api ├── deepcopy_test.go ├── defaults_test.go ├── openapi_generated.go ├── schema_test.go ├── types_test.go ├── utils.go └── v1_suite_test.go ├── containerizeddataimporter ├── clientset.go ├── doc.go ├── fake │ ├── clientset_generated.go │ ├── doc.go │ └── register.go ├── scheme │ ├── doc.go │ └── register.go └── typed │ ├── core │ └── v1beta1 │ │ ├── cdi.go │ │ ├── cdiconfig.go │ │ ├── core_client.go │ │ ├── dataimportcron.go │ │ ├── datasource.go │ │ ├── datavolume.go │ │ ├── doc.go │ │ ├── fake │ │ ├── doc.go │ │ ├── fake_cdi.go │ │ ├── fake_cdiconfig.go │ │ ├── fake_core_client.go │ │ ├── fake_dataimportcron.go │ │ ├── fake_datasource.go │ │ ├── fake_datavolume.go │ │ ├── fake_objecttransfer.go │ │ ├── fake_storageprofile.go │ │ ├── fake_volumeclonesource.go │ │ ├── fake_volumeimportsource.go │ │ └── fake_volumeuploadsource.go │ │ ├── generated_expansion.go │ │ ├── objecttransfer.go │ │ ├── storageprofile.go │ │ ├── volumeclonesource.go │ │ ├── volumeimportsource.go │ │ └── volumeuploadsource.go │ └── upload │ └── v1beta1 │ ├── doc.go │ ├── fake │ ├── doc.go │ ├── fake_upload_client.go │ └── fake_uploadtokenrequest.go │ ├── generated_expansion.go │ ├── upload_client.go │ └── uploadtokenrequest.go ├── doc.go ├── examples ├── README.md └── listvms │ ├── README.md │ ├── go.mod │ ├── go.sum │ └── list-vms.go ├── externalsnapshotter ├── clientset.go ├── doc.go ├── fake │ ├── clientset_generated.go │ ├── doc.go │ └── register.go ├── scheme │ ├── doc.go │ └── register.go └── typed │ └── volumesnapshot │ └── v1 │ ├── doc.go │ ├── fake │ ├── doc.go │ ├── fake_volumesnapshot.go │ ├── fake_volumesnapshot_client.go │ ├── fake_volumesnapshotclass.go │ └── fake_volumesnapshotcontent.go │ ├── generated_expansion.go │ ├── volumesnapshot.go │ ├── volumesnapshot_client.go │ ├── volumesnapshotclass.go │ └── volumesnapshotcontent.go ├── go.mod ├── go.sum ├── kubecli ├── generated_mock_kubevirt.go ├── guestfs.go ├── handler.go ├── instancetype.go ├── instancetype_test.go ├── kubecli.go ├── kubecli_suite_test.go ├── kubevirt.go ├── kubevirt_test_utils.go ├── kv.go ├── kv_test.go ├── migration.go ├── migration_test.go ├── migrationpolicy_test.go ├── profiler.go ├── replicaset.go ├── replicaset_test.go ├── version.go ├── version_test.go ├── vm.go ├── vm_test.go ├── vmi.go ├── vmi_test.go ├── vmipreset.go └── vmipreset_test.go ├── kubevirt ├── clientset.go ├── doc.go ├── fake │ ├── clientset_generated.go │ ├── doc.go │ └── register.go ├── scheme │ ├── doc.go │ └── register.go └── typed │ ├── clone │ ├── v1alpha1 │ │ ├── clone_client.go │ │ ├── doc.go │ │ ├── fake │ │ │ ├── doc.go │ │ │ ├── fake_clone_client.go │ │ │ └── fake_virtualmachineclone.go │ │ ├── generated_expansion.go │ │ └── virtualmachineclone.go │ └── v1beta1 │ │ ├── clone_client.go │ │ ├── doc.go │ │ ├── fake │ │ ├── doc.go │ │ ├── fake_clone_client.go │ │ └── fake_virtualmachineclone.go │ │ ├── generated_expansion.go │ │ └── virtualmachineclone.go │ ├── core │ └── v1 │ │ ├── async.go │ │ ├── core_client.go │ │ ├── doc.go │ │ ├── fake │ │ ├── doc.go │ │ ├── fake_core_client.go │ │ ├── fake_kubevirt.go │ │ ├── fake_kubevirt_expansion.go │ │ ├── fake_virtualmachine.go │ │ ├── fake_virtualmachine_expansion.go │ │ ├── fake_virtualmachineinstance.go │ │ ├── fake_virtualmachineinstance_expansion.go │ │ ├── fake_virtualmachineinstancemigration.go │ │ ├── fake_virtualmachineinstancemigration_expansion.go │ │ ├── fake_virtualmachineinstancepreset.go │ │ ├── fake_virtualmachineinstancereplicaset.go │ │ └── fake_virtualmachineinstancereplicaset_expansion.go │ │ ├── generated_expansion.go │ │ ├── kubevirt.go │ │ ├── kubevirt_expansion.go │ │ ├── streamer.go │ │ ├── v1_suite_test.go │ │ ├── virtualmachine.go │ │ ├── virtualmachine_expansion.go │ │ ├── virtualmachineinstance.go │ │ ├── virtualmachineinstance_expansion.go │ │ ├── virtualmachineinstancemigration.go │ │ ├── virtualmachineinstancemigration_expansion.go │ │ ├── virtualmachineinstancepreset.go │ │ ├── virtualmachineinstancereplicaset.go │ │ ├── virtualmachineinstancereplicaset_expansion.go │ │ ├── websocket.go │ │ └── websocket_test.go │ ├── export │ ├── v1alpha1 │ │ ├── doc.go │ │ ├── export_client.go │ │ ├── fake │ │ │ ├── doc.go │ │ │ ├── fake_export_client.go │ │ │ └── fake_virtualmachineexport.go │ │ ├── generated_expansion.go │ │ └── virtualmachineexport.go │ └── v1beta1 │ │ ├── doc.go │ │ ├── export_client.go │ │ ├── fake │ │ ├── doc.go │ │ ├── fake_export_client.go │ │ └── fake_virtualmachineexport.go │ │ ├── generated_expansion.go │ │ └── virtualmachineexport.go │ ├── instancetype │ ├── v1alpha1 │ │ ├── doc.go │ │ ├── fake │ │ │ ├── doc.go │ │ │ ├── fake_instancetype_client.go │ │ │ ├── fake_virtualmachineclusterinstancetype.go │ │ │ ├── fake_virtualmachineclusterpreference.go │ │ │ ├── fake_virtualmachineinstancetype.go │ │ │ └── fake_virtualmachinepreference.go │ │ ├── generated_expansion.go │ │ ├── instancetype_client.go │ │ ├── virtualmachineclusterinstancetype.go │ │ ├── virtualmachineclusterpreference.go │ │ ├── virtualmachineinstancetype.go │ │ └── virtualmachinepreference.go │ ├── v1alpha2 │ │ ├── doc.go │ │ ├── fake │ │ │ ├── doc.go │ │ │ ├── fake_instancetype_client.go │ │ │ ├── fake_virtualmachineclusterinstancetype.go │ │ │ ├── fake_virtualmachineclusterpreference.go │ │ │ ├── fake_virtualmachineinstancetype.go │ │ │ └── fake_virtualmachinepreference.go │ │ ├── generated_expansion.go │ │ ├── instancetype_client.go │ │ ├── virtualmachineclusterinstancetype.go │ │ ├── virtualmachineclusterpreference.go │ │ ├── virtualmachineinstancetype.go │ │ └── virtualmachinepreference.go │ └── v1beta1 │ │ ├── doc.go │ │ ├── fake │ │ ├── doc.go │ │ ├── fake_instancetype_client.go │ │ ├── fake_virtualmachineclusterinstancetype.go │ │ ├── fake_virtualmachineclusterpreference.go │ │ ├── fake_virtualmachineinstancetype.go │ │ └── fake_virtualmachinepreference.go │ │ ├── generated_expansion.go │ │ ├── instancetype_client.go │ │ ├── virtualmachineclusterinstancetype.go │ │ ├── virtualmachineclusterpreference.go │ │ ├── virtualmachineinstancetype.go │ │ └── virtualmachinepreference.go │ ├── migrations │ └── v1alpha1 │ │ ├── doc.go │ │ ├── fake │ │ ├── doc.go │ │ ├── fake_migrationpolicy.go │ │ └── fake_migrations_client.go │ │ ├── generated_expansion.go │ │ ├── migrationpolicy.go │ │ └── migrations_client.go │ ├── pool │ └── v1alpha1 │ │ ├── doc.go │ │ ├── fake │ │ ├── doc.go │ │ ├── fake_pool_client.go │ │ └── fake_virtualmachinepool.go │ │ ├── generated_expansion.go │ │ ├── pool_client.go │ │ └── virtualmachinepool.go │ └── snapshot │ ├── v1alpha1 │ ├── doc.go │ ├── fake │ │ ├── doc.go │ │ ├── fake_snapshot_client.go │ │ ├── fake_virtualmachinerestore.go │ │ ├── fake_virtualmachinesnapshot.go │ │ └── fake_virtualmachinesnapshotcontent.go │ ├── generated_expansion.go │ ├── snapshot_client.go │ ├── virtualmachinerestore.go │ ├── virtualmachinesnapshot.go │ └── virtualmachinesnapshotcontent.go │ └── v1beta1 │ ├── doc.go │ ├── fake │ ├── doc.go │ ├── fake_snapshot_client.go │ ├── fake_virtualmachinerestore.go │ ├── fake_virtualmachinesnapshot.go │ └── fake_virtualmachinesnapshotcontent.go │ ├── generated_expansion.go │ ├── snapshot_client.go │ ├── virtualmachinerestore.go │ ├── virtualmachinesnapshot.go │ └── virtualmachinesnapshotcontent.go ├── log ├── log.go ├── log_suite_test.go └── log_test.go ├── networkattachmentdefinitionclient ├── clientset.go ├── doc.go ├── fake │ ├── clientset_generated.go │ ├── doc.go │ └── register.go ├── scheme │ ├── doc.go │ └── register.go └── typed │ └── k8s.cni.cncf.io │ └── v1 │ ├── doc.go │ ├── fake │ ├── doc.go │ ├── fake_k8s.cni.cncf.io_client.go │ └── fake_networkattachmentdefinition.go │ ├── generated_expansion.go │ ├── k8s.cni.cncf.io_client.go │ └── networkattachmentdefinition.go ├── precond └── precond.go ├── prometheusoperator ├── clientset.go ├── doc.go ├── fake │ ├── clientset_generated.go │ ├── doc.go │ └── register.go ├── scheme │ ├── doc.go │ └── register.go └── typed │ └── monitoring │ └── v1 │ ├── alertmanager.go │ ├── doc.go │ ├── fake │ ├── doc.go │ ├── fake_alertmanager.go │ ├── fake_monitoring_client.go │ ├── fake_podmonitor.go │ ├── fake_probe.go │ ├── fake_prometheus.go │ ├── fake_prometheusrule.go │ ├── fake_servicemonitor.go │ └── fake_thanosruler.go │ ├── generated_expansion.go │ ├── monitoring_client.go │ ├── podmonitor.go │ ├── probe.go │ ├── prometheus.go │ ├── prometheusrule.go │ ├── servicemonitor.go │ └── thanosruler.go ├── reporter └── reporter.go ├── subresources └── constants.go ├── testing ├── actions.go └── fake.go ├── testutils └── setup.go ├── util └── util.go └── version ├── base.go ├── def.bzl ├── types.go └── version.go /.gitignore: -------------------------------------------------------------------------------- 1 | BUILD 2 | BUILD.bazel 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # KubeVirt client-go 2 | 3 | Go clients for talking to [KubeVirt](https://github.com/kubevirt/kubevirt). 4 | 5 | ## How to use it 6 | please refer to some of [examples here](examples/README.md) 7 | 8 | ----- 9 | KubeVirt client-go is maintained at https://github.com/kubevirt/kubevirt/tree/main/staging/src/kubevirt.io/client-go. 10 | The main branch of this repository is updated on every PR merge, release tags are pushed on every release of KubeVirt. 11 | 12 | ## License 13 | 14 | KubeVirt client-go is distributed under the 15 | [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt). 16 | 17 | Copyright 2019 18 | 19 | Licensed under the Apache License, Version 2.0 (the "License"); 20 | you may not use this file except in compliance with the License. 21 | You may obtain a copy of the License at 22 | 23 | http://www.apache.org/licenses/LICENSE-2.0 24 | 25 | Unless required by applicable law or agreed to in writing, software 26 | distributed under the License is distributed on an "AS IS" BASIS, 27 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 28 | See the License for the specific language governing permissions and 29 | limitations under the License. 30 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Reporting a Vulnerability 4 | 5 | The KubeVirt project treats security vulnerabilities seriously, so we 6 | strive to take action quickly when required. 7 | 8 | The project requests that security issues be disclosed in a responsible 9 | manner to allow adequate time to respond. If a security issue or 10 | vulnerability has been found, please disclose the details to our 11 | dedicated email address: 12 | 13 | cncf-kubevirt-security@lists.cncf.io 14 | 15 | Please include as much information as possible with the report. The 16 | following details assist with analysis efforts: 17 | - Description of the vulnerability 18 | - Affected component (version, commit, branch etc) 19 | - Affected code (file path, line numbers) 20 | - Exploit code 21 | 22 | Any confidential information disclosed to the security team will be 23 | handled appropriately to prevent misuse or accidental disclosure. 24 | 25 | ## Security Notices 26 | 27 | Security notices will be sent to the kubevirt-dev@googlegroups.com 28 | mailing list and published to the 29 | [Security Advisories](https://github.com/kubevirt/kubevirt/security/advisories) 30 | page. 31 | 32 | ## Security Team 33 | 34 | The security team currently consists of the Maintainers of KubeVirt and is 35 | supported by security teams of involved vendors. 36 | 37 | List of involved vendor security teams: 38 | - Red Hat 39 | - SUSE 40 | 41 | ## Alternate Reporting Mechanism 42 | 43 | If you are unable to report the vulnerability to the dedicated email address, you can use the [GitHub vulnerability report mechanism](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability). 44 | -------------------------------------------------------------------------------- /api/deepcopy_test.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | import ( 4 | "reflect" 5 | 6 | fuzz "github.com/google/gofuzz" 7 | . "github.com/onsi/ginkgo/v2" 8 | . "github.com/onsi/gomega" 9 | 10 | v1 "kubevirt.io/api/core/v1" 11 | ) 12 | 13 | var _ = Describe("Generated deepcopy functions", func() { 14 | 15 | var structs []interface{} 16 | BeforeEach(func() { 17 | 18 | structs = []interface{}{ 19 | &v1.CloudInitNoCloudSource{}, 20 | &v1.DomainSpec{}, 21 | &v1.ResourceRequirements{}, 22 | &v1.Firmware{}, 23 | &v1.Devices{}, 24 | &v1.Disk{}, 25 | &v1.DiskDevice{}, 26 | &v1.DiskTarget{}, 27 | &v1.LunTarget{}, 28 | &v1.CDRomTarget{}, 29 | &v1.Volume{}, 30 | &v1.VolumeSource{}, 31 | &v1.ContainerDiskSource{}, 32 | &v1.ClockOffset{}, 33 | &v1.ClockOffsetUTC{}, 34 | &v1.Clock{}, 35 | &v1.Timer{}, 36 | &v1.RTCTimer{}, 37 | &v1.HPETTimer{}, 38 | &v1.PITTimer{}, 39 | &v1.KVMTimer{}, 40 | &v1.HypervTimer{}, 41 | &v1.Features{}, 42 | &v1.FeatureState{}, 43 | &v1.FeatureAPIC{}, 44 | &v1.FeatureSpinlocks{}, 45 | &v1.FeatureVendorID{}, 46 | &v1.FeatureHyperv{}, 47 | &v1.CPU{}, 48 | &v1.Watchdog{}, 49 | &v1.WatchdogDevice{}, 50 | &v1.I6300ESBWatchdog{}, 51 | &v1.VirtualMachineInstance{}, 52 | &v1.VirtualMachineInstanceList{}, 53 | &v1.VirtualMachineInstanceSpec{}, 54 | &v1.VirtualMachineInstanceStatus{}, 55 | &v1.VirtualMachineInstanceCondition{}, 56 | &v1.VMISelector{}, 57 | &v1.VirtualMachineInstanceReplicaSet{}, 58 | &v1.VirtualMachineInstanceReplicaSetList{}, 59 | &v1.VirtualMachineInstanceReplicaSetSpec{}, 60 | &v1.VirtualMachineInstanceReplicaSetStatus{}, 61 | &v1.VirtualMachineInstanceReplicaSetCondition{}, 62 | &v1.VirtualMachineInstanceTemplateSpec{}, 63 | &v1.VirtualMachine{}, 64 | &v1.VirtualMachineList{}, 65 | &v1.VirtualMachineSpec{}, 66 | &v1.VirtualMachineCondition{}, 67 | &v1.VirtualMachineStatus{}, 68 | &v1.VirtualMachineInstancePreset{}, 69 | &v1.VirtualMachineInstancePresetList{}, 70 | &v1.VirtualMachineInstancePresetSpec{}, 71 | &v1.Probe{}, 72 | &v1.Handler{}, 73 | &v1.Hugepages{}, 74 | &v1.Interface{}, 75 | &v1.Memory{}, 76 | &v1.Machine{}, 77 | &v1.InterfaceBridge{}, 78 | &v1.DeprecatedInterfaceSlirp{}, 79 | } 80 | }) 81 | 82 | DescribeTable("should work for fuzzed structs with a probability for nils of", func(nilProbability float64) { 83 | for _, s := range structs { 84 | fuzz.New().NilChance(nilProbability).Fuzz(s) 85 | Expect(reflect.ValueOf(s).MethodByName("DeepCopy").Call(nil)[0].Interface()).To(Equal(s)) 86 | if reflect.ValueOf(s).MethodByName("DeepCopyObject").IsValid() { 87 | Expect(reflect.ValueOf(s).MethodByName("DeepCopyObject").Call(nil)[0].Interface()).To(Equal(s)) 88 | } 89 | new := reflect.New(reflect.TypeOf(s).Elem()) 90 | reflect.ValueOf(s).MethodByName("DeepCopyInto").Call([]reflect.Value{new}) 91 | Expect(new.Interface()).To(Equal(s)) 92 | } 93 | }, 94 | Entry("0%", float64(0)), 95 | Entry("10%", float64(0.1)), 96 | Entry("50%", float64(0.5)), 97 | Entry("70%", float64(0.7)), 98 | Entry("100%", float64(1)), 99 | ) 100 | }) 101 | -------------------------------------------------------------------------------- /api/utils.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the KubeVirt project 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 | * Copyright 2017 Red Hat, Inc. 17 | * 18 | */ 19 | 20 | package api 21 | 22 | import ( 23 | k8sv1 "k8s.io/api/core/v1" 24 | "k8s.io/apimachinery/pkg/api/resource" 25 | k8smetav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 26 | 27 | v1 "kubevirt.io/api/core/v1" 28 | ) 29 | 30 | // This is meant for testing 31 | func NewMinimalVMI(name string) *v1.VirtualMachineInstance { 32 | return NewMinimalVMIWithNS(k8sv1.NamespaceDefault, name) 33 | } 34 | 35 | // This is meant for testing 36 | func NewMinimalVMIWithNS(namespace, name string) *v1.VirtualMachineInstance { 37 | vmi := v1.NewVMIReferenceFromNameWithNS(namespace, name) 38 | vmi.Spec = v1.VirtualMachineInstanceSpec{Domain: v1.DomainSpec{}} 39 | vmi.Spec.Domain.Resources.Requests = k8sv1.ResourceList{ 40 | k8sv1.ResourceMemory: resource.MustParse("8192Ki"), 41 | } 42 | vmi.TypeMeta = k8smetav1.TypeMeta{ 43 | APIVersion: v1.GroupVersion.String(), 44 | Kind: "VirtualMachineInstance", 45 | } 46 | return vmi 47 | } 48 | -------------------------------------------------------------------------------- /api/v1_suite_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the KubeVirt project 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 | * Copyright 2017 Red Hat, Inc. 17 | * 18 | */ 19 | 20 | package api 21 | 22 | import ( 23 | "testing" 24 | 25 | "kubevirt.io/client-go/testutils" 26 | ) 27 | 28 | func TestV1(t *testing.T) { 29 | testutils.KubeVirtTestSuiteSetup(t) 30 | } 31 | -------------------------------------------------------------------------------- /containerizeddataimporter/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The KubeVirt 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 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package has the automatically generated clientset. 20 | package containerizeddataimporter 21 | -------------------------------------------------------------------------------- /containerizeddataimporter/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // This package has the automatically generated fake clientset. 22 | package fake 23 | -------------------------------------------------------------------------------- /containerizeddataimporter/fake/register.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package fake 22 | 23 | import ( 24 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 25 | runtime "k8s.io/apimachinery/pkg/runtime" 26 | schema "k8s.io/apimachinery/pkg/runtime/schema" 27 | serializer "k8s.io/apimachinery/pkg/runtime/serializer" 28 | utilruntime "k8s.io/apimachinery/pkg/util/runtime" 29 | cdiv1beta1 "kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1" 30 | uploadv1beta1 "kubevirt.io/containerized-data-importer-api/pkg/apis/upload/v1beta1" 31 | ) 32 | 33 | var scheme = runtime.NewScheme() 34 | var codecs = serializer.NewCodecFactory(scheme) 35 | 36 | var localSchemeBuilder = runtime.SchemeBuilder{ 37 | cdiv1beta1.AddToScheme, 38 | uploadv1beta1.AddToScheme, 39 | } 40 | 41 | // AddToScheme adds all types of this clientset into the given scheme. This allows composition 42 | // of clientsets, like in: 43 | // 44 | // import ( 45 | // "k8s.io/client-go/kubernetes" 46 | // clientsetscheme "k8s.io/client-go/kubernetes/scheme" 47 | // aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" 48 | // ) 49 | // 50 | // kclientset, _ := kubernetes.NewForConfig(c) 51 | // _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) 52 | // 53 | // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types 54 | // correctly. 55 | var AddToScheme = localSchemeBuilder.AddToScheme 56 | 57 | func init() { 58 | v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) 59 | utilruntime.Must(AddToScheme(scheme)) 60 | } 61 | -------------------------------------------------------------------------------- /containerizeddataimporter/scheme/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // This package contains the scheme of the automatically generated clientset. 22 | package scheme 23 | -------------------------------------------------------------------------------- /containerizeddataimporter/scheme/register.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package scheme 22 | 23 | import ( 24 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 25 | runtime "k8s.io/apimachinery/pkg/runtime" 26 | schema "k8s.io/apimachinery/pkg/runtime/schema" 27 | serializer "k8s.io/apimachinery/pkg/runtime/serializer" 28 | utilruntime "k8s.io/apimachinery/pkg/util/runtime" 29 | cdiv1beta1 "kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1" 30 | uploadv1beta1 "kubevirt.io/containerized-data-importer-api/pkg/apis/upload/v1beta1" 31 | ) 32 | 33 | var Scheme = runtime.NewScheme() 34 | var Codecs = serializer.NewCodecFactory(Scheme) 35 | var ParameterCodec = runtime.NewParameterCodec(Scheme) 36 | var localSchemeBuilder = runtime.SchemeBuilder{ 37 | cdiv1beta1.AddToScheme, 38 | uploadv1beta1.AddToScheme, 39 | } 40 | 41 | // AddToScheme adds all types of this clientset into the given scheme. This allows composition 42 | // of clientsets, like in: 43 | // 44 | // import ( 45 | // "k8s.io/client-go/kubernetes" 46 | // clientsetscheme "k8s.io/client-go/kubernetes/scheme" 47 | // aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" 48 | // ) 49 | // 50 | // kclientset, _ := kubernetes.NewForConfig(c) 51 | // _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) 52 | // 53 | // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types 54 | // correctly. 55 | var AddToScheme = localSchemeBuilder.AddToScheme 56 | 57 | func init() { 58 | v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) 59 | utilruntime.Must(AddToScheme(Scheme)) 60 | } 61 | -------------------------------------------------------------------------------- /containerizeddataimporter/typed/core/v1beta1/cdi.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package v1beta1 22 | 23 | import ( 24 | "context" 25 | 26 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 27 | types "k8s.io/apimachinery/pkg/types" 28 | watch "k8s.io/apimachinery/pkg/watch" 29 | gentype "k8s.io/client-go/gentype" 30 | scheme "kubevirt.io/client-go/containerizeddataimporter/scheme" 31 | v1beta1 "kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1" 32 | ) 33 | 34 | // CDIsGetter has a method to return a CDIInterface. 35 | // A group's client should implement this interface. 36 | type CDIsGetter interface { 37 | CDIs() CDIInterface 38 | } 39 | 40 | // CDIInterface has methods to work with CDI resources. 41 | type CDIInterface interface { 42 | Create(ctx context.Context, cDI *v1beta1.CDI, opts v1.CreateOptions) (*v1beta1.CDI, error) 43 | Update(ctx context.Context, cDI *v1beta1.CDI, opts v1.UpdateOptions) (*v1beta1.CDI, error) 44 | // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). 45 | UpdateStatus(ctx context.Context, cDI *v1beta1.CDI, opts v1.UpdateOptions) (*v1beta1.CDI, error) 46 | Delete(ctx context.Context, name string, opts v1.DeleteOptions) error 47 | DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error 48 | Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.CDI, error) 49 | List(ctx context.Context, opts v1.ListOptions) (*v1beta1.CDIList, error) 50 | Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) 51 | Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.CDI, err error) 52 | CDIExpansion 53 | } 54 | 55 | // cDIs implements CDIInterface 56 | type cDIs struct { 57 | *gentype.ClientWithList[*v1beta1.CDI, *v1beta1.CDIList] 58 | } 59 | 60 | // newCDIs returns a CDIs 61 | func newCDIs(c *CdiV1beta1Client) *cDIs { 62 | return &cDIs{ 63 | gentype.NewClientWithList[*v1beta1.CDI, *v1beta1.CDIList]( 64 | "cdis", 65 | c.RESTClient(), 66 | scheme.ParameterCodec, 67 | "", 68 | func() *v1beta1.CDI { return &v1beta1.CDI{} }, 69 | func() *v1beta1.CDIList { return &v1beta1.CDIList{} }), 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /containerizeddataimporter/typed/core/v1beta1/cdiconfig.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package v1beta1 22 | 23 | import ( 24 | "context" 25 | 26 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 27 | types "k8s.io/apimachinery/pkg/types" 28 | watch "k8s.io/apimachinery/pkg/watch" 29 | gentype "k8s.io/client-go/gentype" 30 | scheme "kubevirt.io/client-go/containerizeddataimporter/scheme" 31 | v1beta1 "kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1" 32 | ) 33 | 34 | // CDIConfigsGetter has a method to return a CDIConfigInterface. 35 | // A group's client should implement this interface. 36 | type CDIConfigsGetter interface { 37 | CDIConfigs() CDIConfigInterface 38 | } 39 | 40 | // CDIConfigInterface has methods to work with CDIConfig resources. 41 | type CDIConfigInterface interface { 42 | Create(ctx context.Context, cDIConfig *v1beta1.CDIConfig, opts v1.CreateOptions) (*v1beta1.CDIConfig, error) 43 | Update(ctx context.Context, cDIConfig *v1beta1.CDIConfig, opts v1.UpdateOptions) (*v1beta1.CDIConfig, error) 44 | // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). 45 | UpdateStatus(ctx context.Context, cDIConfig *v1beta1.CDIConfig, opts v1.UpdateOptions) (*v1beta1.CDIConfig, error) 46 | Delete(ctx context.Context, name string, opts v1.DeleteOptions) error 47 | DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error 48 | Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.CDIConfig, error) 49 | List(ctx context.Context, opts v1.ListOptions) (*v1beta1.CDIConfigList, error) 50 | Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) 51 | Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.CDIConfig, err error) 52 | CDIConfigExpansion 53 | } 54 | 55 | // cDIConfigs implements CDIConfigInterface 56 | type cDIConfigs struct { 57 | *gentype.ClientWithList[*v1beta1.CDIConfig, *v1beta1.CDIConfigList] 58 | } 59 | 60 | // newCDIConfigs returns a CDIConfigs 61 | func newCDIConfigs(c *CdiV1beta1Client) *cDIConfigs { 62 | return &cDIConfigs{ 63 | gentype.NewClientWithList[*v1beta1.CDIConfig, *v1beta1.CDIConfigList]( 64 | "cdiconfigs", 65 | c.RESTClient(), 66 | scheme.ParameterCodec, 67 | "", 68 | func() *v1beta1.CDIConfig { return &v1beta1.CDIConfig{} }, 69 | func() *v1beta1.CDIConfigList { return &v1beta1.CDIConfigList{} }), 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /containerizeddataimporter/typed/core/v1beta1/datasource.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package v1beta1 22 | 23 | import ( 24 | "context" 25 | 26 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 27 | types "k8s.io/apimachinery/pkg/types" 28 | watch "k8s.io/apimachinery/pkg/watch" 29 | gentype "k8s.io/client-go/gentype" 30 | scheme "kubevirt.io/client-go/containerizeddataimporter/scheme" 31 | v1beta1 "kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1" 32 | ) 33 | 34 | // DataSourcesGetter has a method to return a DataSourceInterface. 35 | // A group's client should implement this interface. 36 | type DataSourcesGetter interface { 37 | DataSources(namespace string) DataSourceInterface 38 | } 39 | 40 | // DataSourceInterface has methods to work with DataSource resources. 41 | type DataSourceInterface interface { 42 | Create(ctx context.Context, dataSource *v1beta1.DataSource, opts v1.CreateOptions) (*v1beta1.DataSource, error) 43 | Update(ctx context.Context, dataSource *v1beta1.DataSource, opts v1.UpdateOptions) (*v1beta1.DataSource, error) 44 | // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). 45 | UpdateStatus(ctx context.Context, dataSource *v1beta1.DataSource, opts v1.UpdateOptions) (*v1beta1.DataSource, error) 46 | Delete(ctx context.Context, name string, opts v1.DeleteOptions) error 47 | DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error 48 | Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.DataSource, error) 49 | List(ctx context.Context, opts v1.ListOptions) (*v1beta1.DataSourceList, error) 50 | Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) 51 | Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.DataSource, err error) 52 | DataSourceExpansion 53 | } 54 | 55 | // dataSources implements DataSourceInterface 56 | type dataSources struct { 57 | *gentype.ClientWithList[*v1beta1.DataSource, *v1beta1.DataSourceList] 58 | } 59 | 60 | // newDataSources returns a DataSources 61 | func newDataSources(c *CdiV1beta1Client, namespace string) *dataSources { 62 | return &dataSources{ 63 | gentype.NewClientWithList[*v1beta1.DataSource, *v1beta1.DataSourceList]( 64 | "datasources", 65 | c.RESTClient(), 66 | scheme.ParameterCodec, 67 | namespace, 68 | func() *v1beta1.DataSource { return &v1beta1.DataSource{} }, 69 | func() *v1beta1.DataSourceList { return &v1beta1.DataSourceList{} }), 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /containerizeddataimporter/typed/core/v1beta1/datavolume.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package v1beta1 22 | 23 | import ( 24 | "context" 25 | 26 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 27 | types "k8s.io/apimachinery/pkg/types" 28 | watch "k8s.io/apimachinery/pkg/watch" 29 | gentype "k8s.io/client-go/gentype" 30 | scheme "kubevirt.io/client-go/containerizeddataimporter/scheme" 31 | v1beta1 "kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1" 32 | ) 33 | 34 | // DataVolumesGetter has a method to return a DataVolumeInterface. 35 | // A group's client should implement this interface. 36 | type DataVolumesGetter interface { 37 | DataVolumes(namespace string) DataVolumeInterface 38 | } 39 | 40 | // DataVolumeInterface has methods to work with DataVolume resources. 41 | type DataVolumeInterface interface { 42 | Create(ctx context.Context, dataVolume *v1beta1.DataVolume, opts v1.CreateOptions) (*v1beta1.DataVolume, error) 43 | Update(ctx context.Context, dataVolume *v1beta1.DataVolume, opts v1.UpdateOptions) (*v1beta1.DataVolume, error) 44 | // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). 45 | UpdateStatus(ctx context.Context, dataVolume *v1beta1.DataVolume, opts v1.UpdateOptions) (*v1beta1.DataVolume, error) 46 | Delete(ctx context.Context, name string, opts v1.DeleteOptions) error 47 | DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error 48 | Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.DataVolume, error) 49 | List(ctx context.Context, opts v1.ListOptions) (*v1beta1.DataVolumeList, error) 50 | Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) 51 | Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.DataVolume, err error) 52 | DataVolumeExpansion 53 | } 54 | 55 | // dataVolumes implements DataVolumeInterface 56 | type dataVolumes struct { 57 | *gentype.ClientWithList[*v1beta1.DataVolume, *v1beta1.DataVolumeList] 58 | } 59 | 60 | // newDataVolumes returns a DataVolumes 61 | func newDataVolumes(c *CdiV1beta1Client, namespace string) *dataVolumes { 62 | return &dataVolumes{ 63 | gentype.NewClientWithList[*v1beta1.DataVolume, *v1beta1.DataVolumeList]( 64 | "datavolumes", 65 | c.RESTClient(), 66 | scheme.ParameterCodec, 67 | namespace, 68 | func() *v1beta1.DataVolume { return &v1beta1.DataVolume{} }, 69 | func() *v1beta1.DataVolumeList { return &v1beta1.DataVolumeList{} }), 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /containerizeddataimporter/typed/core/v1beta1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // This package has the automatically generated typed clients. 22 | package v1beta1 23 | -------------------------------------------------------------------------------- /containerizeddataimporter/typed/core/v1beta1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // Package fake has the automatically generated clients. 22 | package fake 23 | -------------------------------------------------------------------------------- /containerizeddataimporter/typed/core/v1beta1/fake/fake_core_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package fake 22 | 23 | import ( 24 | rest "k8s.io/client-go/rest" 25 | testing "k8s.io/client-go/testing" 26 | v1beta1 "kubevirt.io/client-go/containerizeddataimporter/typed/core/v1beta1" 27 | ) 28 | 29 | type FakeCdiV1beta1 struct { 30 | *testing.Fake 31 | } 32 | 33 | func (c *FakeCdiV1beta1) CDIs() v1beta1.CDIInterface { 34 | return &FakeCDIs{c} 35 | } 36 | 37 | func (c *FakeCdiV1beta1) CDIConfigs() v1beta1.CDIConfigInterface { 38 | return &FakeCDIConfigs{c} 39 | } 40 | 41 | func (c *FakeCdiV1beta1) DataImportCrons(namespace string) v1beta1.DataImportCronInterface { 42 | return &FakeDataImportCrons{c, namespace} 43 | } 44 | 45 | func (c *FakeCdiV1beta1) DataSources(namespace string) v1beta1.DataSourceInterface { 46 | return &FakeDataSources{c, namespace} 47 | } 48 | 49 | func (c *FakeCdiV1beta1) DataVolumes(namespace string) v1beta1.DataVolumeInterface { 50 | return &FakeDataVolumes{c, namespace} 51 | } 52 | 53 | func (c *FakeCdiV1beta1) ObjectTransfers() v1beta1.ObjectTransferInterface { 54 | return &FakeObjectTransfers{c} 55 | } 56 | 57 | func (c *FakeCdiV1beta1) StorageProfiles() v1beta1.StorageProfileInterface { 58 | return &FakeStorageProfiles{c} 59 | } 60 | 61 | func (c *FakeCdiV1beta1) VolumeCloneSources(namespace string) v1beta1.VolumeCloneSourceInterface { 62 | return &FakeVolumeCloneSources{c, namespace} 63 | } 64 | 65 | func (c *FakeCdiV1beta1) VolumeImportSources(namespace string) v1beta1.VolumeImportSourceInterface { 66 | return &FakeVolumeImportSources{c, namespace} 67 | } 68 | 69 | func (c *FakeCdiV1beta1) VolumeUploadSources(namespace string) v1beta1.VolumeUploadSourceInterface { 70 | return &FakeVolumeUploadSources{c, namespace} 71 | } 72 | 73 | // RESTClient returns a RESTClient that is used to communicate 74 | // with API server by this client implementation. 75 | func (c *FakeCdiV1beta1) RESTClient() rest.Interface { 76 | var ret *rest.RESTClient 77 | return ret 78 | } 79 | -------------------------------------------------------------------------------- /containerizeddataimporter/typed/core/v1beta1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package v1beta1 22 | 23 | type CDIExpansion interface{} 24 | 25 | type CDIConfigExpansion interface{} 26 | 27 | type DataImportCronExpansion interface{} 28 | 29 | type DataSourceExpansion interface{} 30 | 31 | type DataVolumeExpansion interface{} 32 | 33 | type ObjectTransferExpansion interface{} 34 | 35 | type StorageProfileExpansion interface{} 36 | 37 | type VolumeCloneSourceExpansion interface{} 38 | 39 | type VolumeImportSourceExpansion interface{} 40 | 41 | type VolumeUploadSourceExpansion interface{} 42 | -------------------------------------------------------------------------------- /containerizeddataimporter/typed/core/v1beta1/volumeclonesource.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package v1beta1 22 | 23 | import ( 24 | "context" 25 | 26 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 27 | types "k8s.io/apimachinery/pkg/types" 28 | watch "k8s.io/apimachinery/pkg/watch" 29 | gentype "k8s.io/client-go/gentype" 30 | scheme "kubevirt.io/client-go/containerizeddataimporter/scheme" 31 | v1beta1 "kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1" 32 | ) 33 | 34 | // VolumeCloneSourcesGetter has a method to return a VolumeCloneSourceInterface. 35 | // A group's client should implement this interface. 36 | type VolumeCloneSourcesGetter interface { 37 | VolumeCloneSources(namespace string) VolumeCloneSourceInterface 38 | } 39 | 40 | // VolumeCloneSourceInterface has methods to work with VolumeCloneSource resources. 41 | type VolumeCloneSourceInterface interface { 42 | Create(ctx context.Context, volumeCloneSource *v1beta1.VolumeCloneSource, opts v1.CreateOptions) (*v1beta1.VolumeCloneSource, error) 43 | Update(ctx context.Context, volumeCloneSource *v1beta1.VolumeCloneSource, opts v1.UpdateOptions) (*v1beta1.VolumeCloneSource, error) 44 | Delete(ctx context.Context, name string, opts v1.DeleteOptions) error 45 | DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error 46 | Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.VolumeCloneSource, error) 47 | List(ctx context.Context, opts v1.ListOptions) (*v1beta1.VolumeCloneSourceList, error) 48 | Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) 49 | Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.VolumeCloneSource, err error) 50 | VolumeCloneSourceExpansion 51 | } 52 | 53 | // volumeCloneSources implements VolumeCloneSourceInterface 54 | type volumeCloneSources struct { 55 | *gentype.ClientWithList[*v1beta1.VolumeCloneSource, *v1beta1.VolumeCloneSourceList] 56 | } 57 | 58 | // newVolumeCloneSources returns a VolumeCloneSources 59 | func newVolumeCloneSources(c *CdiV1beta1Client, namespace string) *volumeCloneSources { 60 | return &volumeCloneSources{ 61 | gentype.NewClientWithList[*v1beta1.VolumeCloneSource, *v1beta1.VolumeCloneSourceList]( 62 | "volumeclonesources", 63 | c.RESTClient(), 64 | scheme.ParameterCodec, 65 | namespace, 66 | func() *v1beta1.VolumeCloneSource { return &v1beta1.VolumeCloneSource{} }, 67 | func() *v1beta1.VolumeCloneSourceList { return &v1beta1.VolumeCloneSourceList{} }), 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /containerizeddataimporter/typed/upload/v1beta1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // This package has the automatically generated typed clients. 22 | package v1beta1 23 | -------------------------------------------------------------------------------- /containerizeddataimporter/typed/upload/v1beta1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // Package fake has the automatically generated clients. 22 | package fake 23 | -------------------------------------------------------------------------------- /containerizeddataimporter/typed/upload/v1beta1/fake/fake_upload_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package fake 22 | 23 | import ( 24 | rest "k8s.io/client-go/rest" 25 | testing "k8s.io/client-go/testing" 26 | v1beta1 "kubevirt.io/client-go/containerizeddataimporter/typed/upload/v1beta1" 27 | ) 28 | 29 | type FakeUploadV1beta1 struct { 30 | *testing.Fake 31 | } 32 | 33 | func (c *FakeUploadV1beta1) UploadTokenRequests(namespace string) v1beta1.UploadTokenRequestInterface { 34 | return &FakeUploadTokenRequests{c, namespace} 35 | } 36 | 37 | // RESTClient returns a RESTClient that is used to communicate 38 | // with API server by this client implementation. 39 | func (c *FakeUploadV1beta1) RESTClient() rest.Interface { 40 | var ret *rest.RESTClient 41 | return ret 42 | } 43 | -------------------------------------------------------------------------------- /containerizeddataimporter/typed/upload/v1beta1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package v1beta1 22 | 23 | type UploadTokenRequestExpansion interface{} 24 | -------------------------------------------------------------------------------- /doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the KubeVirt project 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 | * Copyright 2019 Red Hat, Inc. 17 | * 18 | */ 19 | package root 20 | 21 | // This file only exists for the "dep" dependency manager, which needs a go file on the project root 22 | -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | ## Kubevirt client-go usage examples. 2 | 3 | - [listvms](listvms) 4 | List all VMs and VMIs objects in KubeVirt 5 | ``` 6 | $ ./listvms 7 | Type Name Namespace Status 8 | VirtualMachine vm-cirros default true 9 | VirtualMachineInstance vm-cirros default Running 10 | 11 | ``` -------------------------------------------------------------------------------- /examples/listvms/README.md: -------------------------------------------------------------------------------- 1 | # listvms 2 | 3 | List all VMs and VMIs objects in KubeVirt 4 | 5 | ## How to build 6 | ``` 7 | $ export GO111MODULE=on 8 | $ go build 9 | ``` 10 | ## How to test this example 11 | first you need to export an environment variable `KUBECONFIG` pointing to your kubernetes config, where KubeVirt is installed. 12 | 13 | ``` 14 | $ export KUBECONFIG=/home//.kubeconfig 15 | $ ./listvms 16 | Type Name Namespace Status 17 | VirtualMachine vm-cirros default true 18 | VirtualMachineInstance vm-cirros default Running 19 | 20 | ``` -------------------------------------------------------------------------------- /examples/listvms/go.mod: -------------------------------------------------------------------------------- 1 | module kubevirt.io/kubevirt/staging/src/kubevirt.io/client-go/examples/listvms 2 | 3 | go 1.12 4 | 5 | replace k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20190221213512-86fb29eff628 6 | 7 | require ( 8 | github.com/emicklei/go-restful v2.16.0+incompatible // indirect 9 | github.com/go-logr/logr v0.2.1 // indirect 10 | github.com/go-openapi/jsonreference v0.20.2 // indirect 11 | github.com/golang/protobuf v1.5.3 // indirect 12 | github.com/google/gnostic v0.5.7 // indirect 13 | github.com/google/go-cmp v0.5.9 // indirect 14 | github.com/google/uuid v1.1.5 // indirect 15 | github.com/googleapis/gnostic v0.2.2 // indirect 16 | github.com/gorilla/websocket v1.5.0 // indirect 17 | github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect 18 | github.com/imdario/mergo v0.3.15 // indirect 19 | github.com/pborman/uuid v1.2.1 // indirect 20 | github.com/spf13/pflag v1.0.5 21 | golang.org/x/crypto v0.17.0 // indirect 22 | k8s.io/apimachinery v0.20.15 23 | k8s.io/klog v0.3.3 // indirect 24 | k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect 25 | kubevirt.io/client-go v0.19.0 26 | ) 27 | -------------------------------------------------------------------------------- /examples/listvms/list-vms.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | "log" 7 | "os" 8 | "text/tabwriter" 9 | 10 | "github.com/spf13/pflag" 11 | k8smetav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 12 | 13 | "kubevirt.io/client-go/kubecli" 14 | ) 15 | 16 | func main() { 17 | 18 | // kubecli.DefaultClientConfig() prepares config using kubeconfig. 19 | // typically, you need to set env variable, KUBECONFIG=/.kubeconfig 20 | clientConfig := kubecli.DefaultClientConfig(&pflag.FlagSet{}) 21 | 22 | // retrive default namespace. 23 | namespace, _, err := clientConfig.Namespace() 24 | if err != nil { 25 | log.Fatalf("error in namespace : %v\n", err) 26 | } 27 | 28 | // get the kubevirt client, using which kubevirt resources can be managed. 29 | virtClient, err := kubecli.GetKubevirtClientFromClientConfig(clientConfig) 30 | if err != nil { 31 | log.Fatalf("cannot obtain KubeVirt client: %v\n", err) 32 | } 33 | 34 | // Fetch list of VMs & VMIs 35 | vmList, err := virtClient.VirtualMachine(namespace).List(context.Background(), k8smetav1.ListOptions{}) 36 | if err != nil { 37 | log.Fatalf("cannot obtain KubeVirt vm list: %v\n", err) 38 | } 39 | vmiList, err := virtClient.VirtualMachineInstance(namespace).List(context.Background(), k8smetav1.ListOptions{}) 40 | if err != nil { 41 | log.Fatalf("cannot obtain KubeVirt vmi list: %v\n", err) 42 | } 43 | 44 | w := tabwriter.NewWriter(os.Stdout, 0, 0, 5, ' ', 0) 45 | fmt.Fprintln(w, "Type\tName\tNamespace\tStatus") 46 | 47 | for _, vm := range vmList.Items { 48 | fmt.Fprintf(w, "%s\t%s\t%s\t%v\n", vm.Kind, vm.Name, vm.Namespace, vm.Status.Ready) 49 | } 50 | for _, vmi := range vmiList.Items { 51 | fmt.Fprintf(w, "%s\t%s\t%s\t%v\n", vmi.Kind, vmi.Name, vmi.Namespace, vmi.Status.Phase) 52 | } 53 | w.Flush() 54 | } 55 | -------------------------------------------------------------------------------- /externalsnapshotter/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The KubeVirt 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 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package has the automatically generated clientset. 20 | package externalsnapshotter 21 | -------------------------------------------------------------------------------- /externalsnapshotter/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // This package has the automatically generated fake clientset. 22 | package fake 23 | -------------------------------------------------------------------------------- /externalsnapshotter/fake/register.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package fake 22 | 23 | import ( 24 | snapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1" 25 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 26 | runtime "k8s.io/apimachinery/pkg/runtime" 27 | schema "k8s.io/apimachinery/pkg/runtime/schema" 28 | serializer "k8s.io/apimachinery/pkg/runtime/serializer" 29 | utilruntime "k8s.io/apimachinery/pkg/util/runtime" 30 | ) 31 | 32 | var scheme = runtime.NewScheme() 33 | var codecs = serializer.NewCodecFactory(scheme) 34 | 35 | var localSchemeBuilder = runtime.SchemeBuilder{ 36 | snapshotv1.AddToScheme, 37 | } 38 | 39 | // AddToScheme adds all types of this clientset into the given scheme. This allows composition 40 | // of clientsets, like in: 41 | // 42 | // import ( 43 | // "k8s.io/client-go/kubernetes" 44 | // clientsetscheme "k8s.io/client-go/kubernetes/scheme" 45 | // aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" 46 | // ) 47 | // 48 | // kclientset, _ := kubernetes.NewForConfig(c) 49 | // _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) 50 | // 51 | // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types 52 | // correctly. 53 | var AddToScheme = localSchemeBuilder.AddToScheme 54 | 55 | func init() { 56 | v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) 57 | utilruntime.Must(AddToScheme(scheme)) 58 | } 59 | -------------------------------------------------------------------------------- /externalsnapshotter/scheme/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // This package contains the scheme of the automatically generated clientset. 22 | package scheme 23 | -------------------------------------------------------------------------------- /externalsnapshotter/scheme/register.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package scheme 22 | 23 | import ( 24 | snapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1" 25 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 26 | runtime "k8s.io/apimachinery/pkg/runtime" 27 | schema "k8s.io/apimachinery/pkg/runtime/schema" 28 | serializer "k8s.io/apimachinery/pkg/runtime/serializer" 29 | utilruntime "k8s.io/apimachinery/pkg/util/runtime" 30 | ) 31 | 32 | var Scheme = runtime.NewScheme() 33 | var Codecs = serializer.NewCodecFactory(Scheme) 34 | var ParameterCodec = runtime.NewParameterCodec(Scheme) 35 | var localSchemeBuilder = runtime.SchemeBuilder{ 36 | snapshotv1.AddToScheme, 37 | } 38 | 39 | // AddToScheme adds all types of this clientset into the given scheme. This allows composition 40 | // of clientsets, like in: 41 | // 42 | // import ( 43 | // "k8s.io/client-go/kubernetes" 44 | // clientsetscheme "k8s.io/client-go/kubernetes/scheme" 45 | // aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" 46 | // ) 47 | // 48 | // kclientset, _ := kubernetes.NewForConfig(c) 49 | // _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) 50 | // 51 | // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types 52 | // correctly. 53 | var AddToScheme = localSchemeBuilder.AddToScheme 54 | 55 | func init() { 56 | v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) 57 | utilruntime.Must(AddToScheme(Scheme)) 58 | } 59 | -------------------------------------------------------------------------------- /externalsnapshotter/typed/volumesnapshot/v1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // This package has the automatically generated typed clients. 22 | package v1 23 | -------------------------------------------------------------------------------- /externalsnapshotter/typed/volumesnapshot/v1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // Package fake has the automatically generated clients. 22 | package fake 23 | -------------------------------------------------------------------------------- /externalsnapshotter/typed/volumesnapshot/v1/fake/fake_volumesnapshot_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package fake 22 | 23 | import ( 24 | rest "k8s.io/client-go/rest" 25 | testing "k8s.io/client-go/testing" 26 | v1 "kubevirt.io/client-go/externalsnapshotter/typed/volumesnapshot/v1" 27 | ) 28 | 29 | type FakeSnapshotV1 struct { 30 | *testing.Fake 31 | } 32 | 33 | func (c *FakeSnapshotV1) VolumeSnapshots(namespace string) v1.VolumeSnapshotInterface { 34 | return &FakeVolumeSnapshots{c, namespace} 35 | } 36 | 37 | func (c *FakeSnapshotV1) VolumeSnapshotClasses() v1.VolumeSnapshotClassInterface { 38 | return &FakeVolumeSnapshotClasses{c} 39 | } 40 | 41 | func (c *FakeSnapshotV1) VolumeSnapshotContents() v1.VolumeSnapshotContentInterface { 42 | return &FakeVolumeSnapshotContents{c} 43 | } 44 | 45 | // RESTClient returns a RESTClient that is used to communicate 46 | // with API server by this client implementation. 47 | func (c *FakeSnapshotV1) RESTClient() rest.Interface { 48 | var ret *rest.RESTClient 49 | return ret 50 | } 51 | -------------------------------------------------------------------------------- /externalsnapshotter/typed/volumesnapshot/v1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package v1 22 | 23 | type VolumeSnapshotExpansion interface{} 24 | 25 | type VolumeSnapshotClassExpansion interface{} 26 | 27 | type VolumeSnapshotContentExpansion interface{} 28 | -------------------------------------------------------------------------------- /externalsnapshotter/typed/volumesnapshot/v1/volumesnapshotclass.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package v1 22 | 23 | import ( 24 | "context" 25 | 26 | v1 "github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1" 27 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 28 | types "k8s.io/apimachinery/pkg/types" 29 | watch "k8s.io/apimachinery/pkg/watch" 30 | gentype "k8s.io/client-go/gentype" 31 | scheme "kubevirt.io/client-go/externalsnapshotter/scheme" 32 | ) 33 | 34 | // VolumeSnapshotClassesGetter has a method to return a VolumeSnapshotClassInterface. 35 | // A group's client should implement this interface. 36 | type VolumeSnapshotClassesGetter interface { 37 | VolumeSnapshotClasses() VolumeSnapshotClassInterface 38 | } 39 | 40 | // VolumeSnapshotClassInterface has methods to work with VolumeSnapshotClass resources. 41 | type VolumeSnapshotClassInterface interface { 42 | Create(ctx context.Context, volumeSnapshotClass *v1.VolumeSnapshotClass, opts metav1.CreateOptions) (*v1.VolumeSnapshotClass, error) 43 | Update(ctx context.Context, volumeSnapshotClass *v1.VolumeSnapshotClass, opts metav1.UpdateOptions) (*v1.VolumeSnapshotClass, error) 44 | Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error 45 | DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error 46 | Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.VolumeSnapshotClass, error) 47 | List(ctx context.Context, opts metav1.ListOptions) (*v1.VolumeSnapshotClassList, error) 48 | Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) 49 | Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.VolumeSnapshotClass, err error) 50 | VolumeSnapshotClassExpansion 51 | } 52 | 53 | // volumeSnapshotClasses implements VolumeSnapshotClassInterface 54 | type volumeSnapshotClasses struct { 55 | *gentype.ClientWithList[*v1.VolumeSnapshotClass, *v1.VolumeSnapshotClassList] 56 | } 57 | 58 | // newVolumeSnapshotClasses returns a VolumeSnapshotClasses 59 | func newVolumeSnapshotClasses(c *SnapshotV1Client) *volumeSnapshotClasses { 60 | return &volumeSnapshotClasses{ 61 | gentype.NewClientWithList[*v1.VolumeSnapshotClass, *v1.VolumeSnapshotClassList]( 62 | "volumesnapshotclasses", 63 | c.RESTClient(), 64 | scheme.ParameterCodec, 65 | "", 66 | func() *v1.VolumeSnapshotClass { return &v1.VolumeSnapshotClass{} }, 67 | func() *v1.VolumeSnapshotClassList { return &v1.VolumeSnapshotClassList{} }), 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /kubecli/guestfs.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the KubeVirt project 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 | * Copyright 2021 Red Hat, Inc. 17 | * 18 | */ 19 | 20 | package kubecli 21 | 22 | import ( 23 | "context" 24 | 25 | "encoding/json" 26 | "fmt" 27 | "net/url" 28 | 29 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 30 | "k8s.io/client-go/rest" 31 | ) 32 | 33 | type GuestfsInfo struct { 34 | Registry string `json:"registry"` 35 | Tag string `json:"tag"` 36 | Digest string `json:"digest"` 37 | ImagePrefix string `json:"imagePrefix"` 38 | GsImage string `json:"gsImage"` 39 | } 40 | 41 | func (k *kubevirtClient) GuestfsVersion() *GuestfsVersion { 42 | return &GuestfsVersion{ 43 | restClient: k.restClient, 44 | resource: "guestfs", 45 | } 46 | } 47 | 48 | type GuestfsVersion struct { 49 | restClient *rest.RESTClient 50 | resource string 51 | } 52 | 53 | func (v *GuestfsVersion) Get() (*GuestfsInfo, error) { 54 | var group metav1.APIGroup 55 | // First, find out which version to query 56 | uri := ApiGroupName 57 | result := v.restClient.Get().AbsPath(uri).Do(context.Background()) 58 | if data, err := result.Raw(); err != nil { 59 | connErr, isConnectionErr := err.(*url.Error) 60 | 61 | if isConnectionErr { 62 | return nil, connErr.Err 63 | } 64 | 65 | return nil, err 66 | } else if err = json.Unmarshal(data, &group); err != nil { 67 | return nil, err 68 | } 69 | 70 | // Now, query the preferred version 71 | uri = fmt.Sprintf("/apis/%s/guestfs", group.PreferredVersion.GroupVersion) 72 | var info GuestfsInfo 73 | 74 | result = v.restClient.Get().AbsPath(uri).Do(context.Background()) 75 | if data, err := result.Raw(); err != nil { 76 | connErr, isConnectionErr := err.(*url.Error) 77 | 78 | if isConnectionErr { 79 | return nil, connErr.Err 80 | } 81 | 82 | return nil, err 83 | } else if err = json.Unmarshal(data, &info); err != nil { 84 | return nil, err 85 | } 86 | return &info, nil 87 | } 88 | -------------------------------------------------------------------------------- /kubecli/instancetype.go: -------------------------------------------------------------------------------- 1 | package kubecli 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "k8s.io/client-go/rest" 8 | 9 | v1 "kubevirt.io/api/core/v1" 10 | ) 11 | 12 | func (k *kubevirtClient) ExpandSpec(namespace string) ExpandSpecInterface { 13 | return &expandSpec{ 14 | restClient: k.restClient, 15 | namespace: namespace, 16 | resource: "expand-vm-spec", 17 | } 18 | } 19 | 20 | type expandSpec struct { 21 | restClient *rest.RESTClient 22 | namespace string 23 | resource string 24 | } 25 | 26 | func (e *expandSpec) ForVirtualMachine(vm *v1.VirtualMachine) (*v1.VirtualMachine, error) { 27 | uri := fmt.Sprintf("/apis/"+v1.SubresourceGroupName+"/%s/namespaces/%s/%s", v1.ApiStorageVersion, e.namespace, e.resource) 28 | expandedVm := &v1.VirtualMachine{} 29 | err := e.restClient.Put(). 30 | AbsPath(uri). 31 | Body(vm). 32 | Do(context.Background()). 33 | Into(expandedVm) 34 | 35 | expandedVm.SetGroupVersionKind(v1.VirtualMachineGroupVersionKind) 36 | 37 | return expandedVm, err 38 | } 39 | -------------------------------------------------------------------------------- /kubecli/instancetype_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the KubeVirt project 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 | * Copyright 2022 Red Hat, Inc. 17 | * 18 | */ 19 | 20 | package kubecli 21 | 22 | import ( 23 | "fmt" 24 | "net/http" 25 | "path" 26 | 27 | . "github.com/onsi/ginkgo/v2" 28 | . "github.com/onsi/gomega" 29 | "github.com/onsi/gomega/ghttp" 30 | k8sv1 "k8s.io/api/core/v1" 31 | v1 "kubevirt.io/api/core/v1" 32 | ) 33 | 34 | var _ = Describe("Kubevirt ExpandSpec Client", func() { 35 | 36 | var server *ghttp.Server 37 | expandSpecPath := fmt.Sprintf("/apis/subresources.kubevirt.io/%s/namespaces/%s/expand-vm-spec", v1.SubresourceStorageGroupVersion.Version, k8sv1.NamespaceDefault) 38 | proxyPath := "/proxy/path" 39 | 40 | BeforeEach(func() { 41 | server = ghttp.NewServer() 42 | }) 43 | 44 | DescribeTable("should expand a VirtualMachine", func(proxyPath string) { 45 | client, err := GetKubevirtClientFromFlags(server.URL()+proxyPath, "") 46 | Expect(err).ToNot(HaveOccurred()) 47 | 48 | vm := NewMinimalVM("testvm") 49 | server.AppendHandlers(ghttp.CombineHandlers( 50 | ghttp.VerifyRequest("PUT", path.Join(proxyPath, expandSpecPath)), 51 | ghttp.RespondWithJSONEncoded(http.StatusOK, vm), 52 | )) 53 | expandedVM, err := client.ExpandSpec(k8sv1.NamespaceDefault).ForVirtualMachine(vm) 54 | 55 | Expect(server.ReceivedRequests()).To(HaveLen(1)) 56 | Expect(err).ToNot(HaveOccurred()) 57 | Expect(expandedVM).To(Equal(vm)) 58 | }, 59 | Entry("with regular server URL", ""), 60 | Entry("with proxied server URL", proxyPath), 61 | ) 62 | 63 | AfterEach(func() { 64 | server.Close() 65 | }) 66 | }) 67 | -------------------------------------------------------------------------------- /kubecli/kubecli_suite_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the KubeVirt project 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 | * Copyright 2017 Red Hat, Inc. 17 | * 18 | */ 19 | 20 | package kubecli_test 21 | 22 | import ( 23 | "testing" 24 | 25 | "kubevirt.io/client-go/testutils" 26 | ) 27 | 28 | func TestKubecli(t *testing.T) { 29 | testutils.KubeVirtTestSuiteSetup(t) 30 | } 31 | -------------------------------------------------------------------------------- /kubecli/version.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the KubeVirt project 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 | * Copyright 2018 Red Hat, Inc. 17 | * 18 | */ 19 | 20 | package kubecli 21 | 22 | import ( 23 | "context" 24 | 25 | "encoding/json" 26 | "fmt" 27 | "net/url" 28 | 29 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 30 | "k8s.io/client-go/rest" 31 | 32 | v1 "kubevirt.io/api/core/v1" 33 | 34 | "kubevirt.io/client-go/version" 35 | ) 36 | 37 | const ( 38 | ApiGroupName = "/apis/" + v1.SubresourceGroupName 39 | ) 40 | 41 | func (k *kubevirtClient) ServerVersion() ServerVersionInterface { 42 | return &ServerVersion{ 43 | restClient: k.restClient, 44 | resource: "version", 45 | } 46 | } 47 | 48 | type ServerVersion struct { 49 | restClient *rest.RESTClient 50 | resource string 51 | } 52 | 53 | func (v *ServerVersion) Get() (*version.Info, error) { 54 | 55 | var group metav1.APIGroup 56 | // First, find out which version to query 57 | uri := ApiGroupName 58 | result := v.restClient.Get().AbsPath(uri).Do(context.Background()) 59 | if data, err := result.Raw(); err != nil { 60 | connErr, isConnectionErr := err.(*url.Error) 61 | 62 | if isConnectionErr { 63 | return nil, connErr.Err 64 | } 65 | 66 | return nil, err 67 | } else if err = json.Unmarshal(data, &group); err != nil { 68 | return nil, err 69 | } 70 | 71 | // Now, query the preferred version 72 | uri = fmt.Sprintf("/apis/%s/version", group.PreferredVersion.GroupVersion) 73 | var serverInfo version.Info 74 | 75 | result = v.restClient.Get().AbsPath(uri).Do(context.Background()) 76 | if data, err := result.Raw(); err != nil { 77 | connErr, isConnectionErr := err.(*url.Error) 78 | 79 | if isConnectionErr { 80 | return nil, connErr.Err 81 | } 82 | 83 | return nil, err 84 | } else if err = json.Unmarshal(data, &serverInfo); err != nil { 85 | return nil, err 86 | } 87 | return &serverInfo, nil 88 | } 89 | -------------------------------------------------------------------------------- /kubecli/version_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the KubeVirt project 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 | * Copyright 2018 Red Hat, Inc. 17 | * 18 | */ 19 | 20 | package kubecli 21 | 22 | import ( 23 | "fmt" 24 | "net/http" 25 | "path" 26 | "runtime" 27 | "time" 28 | 29 | . "github.com/onsi/ginkgo/v2" 30 | . "github.com/onsi/gomega" 31 | "github.com/onsi/gomega/ghttp" 32 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 33 | 34 | "kubevirt.io/client-go/version" 35 | ) 36 | 37 | var _ = Describe("Kubevirt Version Client", func() { 38 | var server *ghttp.Server 39 | proxyPath := "/proxy/path" 40 | 41 | BeforeEach(func() { 42 | server = ghttp.NewServer() 43 | }) 44 | 45 | AfterEach(func() { 46 | server.Close() 47 | }) 48 | 49 | DescribeTable("should fetch version", func(proxyPath string) { 50 | client, err := GetKubevirtClientFromFlags(server.URL()+proxyPath, "") 51 | Expect(err).ToNot(HaveOccurred()) 52 | 53 | groupInfo := metav1.APIGroup{ 54 | Name: ApiGroupName, 55 | PreferredVersion: metav1.GroupVersionForDiscovery{GroupVersion: ApiGroupName + "/v1alpha3", Version: "v1alpha3"}, 56 | } 57 | 58 | info := version.Info{GitVersion: "v0.5.1-alpha.1.43+fda30004223b51-clean", 59 | GitCommit: "fda30004223b51f9e604276419a2b376652cb5ad", 60 | GitTreeState: "clear", 61 | BuildDate: time.Now().Format("%Y-%m-%dT%H:%M:%SZ"), 62 | GoVersion: runtime.Version(), 63 | Compiler: runtime.Compiler, 64 | Platform: fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH)} 65 | 66 | server.AppendHandlers( 67 | ghttp.CombineHandlers( 68 | ghttp.VerifyRequest("GET", path.Join(proxyPath, ApiGroupName)), 69 | ghttp.RespondWithJSONEncoded(http.StatusOK, groupInfo), 70 | ), 71 | ghttp.CombineHandlers( 72 | ghttp.VerifyRequest("GET", path.Join(proxyPath, "/apis"+groupInfo.PreferredVersion.GroupVersion+"/version")), 73 | ghttp.RespondWithJSONEncoded(http.StatusOK, info), 74 | ), 75 | ) 76 | 77 | fetchedVersion, err := client.ServerVersion().Get() 78 | Expect(err).ToNot(HaveOccurred()) 79 | Expect(fetchedVersion.Compiler).To(Equal(runtime.Compiler)) 80 | Expect(fetchedVersion.GitTreeState).To(Equal(info.GitTreeState)) 81 | Expect(fetchedVersion.BuildDate).To(Equal(info.BuildDate)) 82 | Expect(fetchedVersion.GoVersion).To(Equal(info.GoVersion)) 83 | Expect(fetchedVersion.Platform).To(Equal(info.Platform)) 84 | }, 85 | Entry("with regular server URL", ""), 86 | Entry("with proxied server URL", proxyPath), 87 | ) 88 | }) 89 | -------------------------------------------------------------------------------- /kubevirt/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The KubeVirt 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 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package has the automatically generated clientset. 20 | package kubevirt 21 | -------------------------------------------------------------------------------- /kubevirt/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // This package has the automatically generated fake clientset. 22 | package fake 23 | -------------------------------------------------------------------------------- /kubevirt/fake/register.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package fake 22 | 23 | import ( 24 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 25 | runtime "k8s.io/apimachinery/pkg/runtime" 26 | schema "k8s.io/apimachinery/pkg/runtime/schema" 27 | serializer "k8s.io/apimachinery/pkg/runtime/serializer" 28 | utilruntime "k8s.io/apimachinery/pkg/util/runtime" 29 | clonev1alpha1 "kubevirt.io/api/clone/v1alpha1" 30 | clonev1beta1 "kubevirt.io/api/clone/v1beta1" 31 | kubevirtv1 "kubevirt.io/api/core/v1" 32 | exportv1alpha1 "kubevirt.io/api/export/v1alpha1" 33 | exportv1beta1 "kubevirt.io/api/export/v1beta1" 34 | instancetypev1alpha1 "kubevirt.io/api/instancetype/v1alpha1" 35 | instancetypev1alpha2 "kubevirt.io/api/instancetype/v1alpha2" 36 | instancetypev1beta1 "kubevirt.io/api/instancetype/v1beta1" 37 | migrationsv1alpha1 "kubevirt.io/api/migrations/v1alpha1" 38 | poolv1alpha1 "kubevirt.io/api/pool/v1alpha1" 39 | snapshotv1alpha1 "kubevirt.io/api/snapshot/v1alpha1" 40 | snapshotv1beta1 "kubevirt.io/api/snapshot/v1beta1" 41 | ) 42 | 43 | var scheme = runtime.NewScheme() 44 | var codecs = serializer.NewCodecFactory(scheme) 45 | 46 | var localSchemeBuilder = runtime.SchemeBuilder{ 47 | clonev1alpha1.AddToScheme, 48 | clonev1beta1.AddToScheme, 49 | kubevirtv1.AddToScheme, 50 | exportv1alpha1.AddToScheme, 51 | exportv1beta1.AddToScheme, 52 | instancetypev1alpha1.AddToScheme, 53 | instancetypev1alpha2.AddToScheme, 54 | instancetypev1beta1.AddToScheme, 55 | migrationsv1alpha1.AddToScheme, 56 | poolv1alpha1.AddToScheme, 57 | snapshotv1alpha1.AddToScheme, 58 | snapshotv1beta1.AddToScheme, 59 | } 60 | 61 | // AddToScheme adds all types of this clientset into the given scheme. This allows composition 62 | // of clientsets, like in: 63 | // 64 | // import ( 65 | // "k8s.io/client-go/kubernetes" 66 | // clientsetscheme "k8s.io/client-go/kubernetes/scheme" 67 | // aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" 68 | // ) 69 | // 70 | // kclientset, _ := kubernetes.NewForConfig(c) 71 | // _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) 72 | // 73 | // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types 74 | // correctly. 75 | var AddToScheme = localSchemeBuilder.AddToScheme 76 | 77 | func init() { 78 | v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) 79 | utilruntime.Must(AddToScheme(scheme)) 80 | } 81 | -------------------------------------------------------------------------------- /kubevirt/scheme/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // This package contains the scheme of the automatically generated clientset. 22 | package scheme 23 | -------------------------------------------------------------------------------- /kubevirt/scheme/register.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package scheme 22 | 23 | import ( 24 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 25 | runtime "k8s.io/apimachinery/pkg/runtime" 26 | schema "k8s.io/apimachinery/pkg/runtime/schema" 27 | serializer "k8s.io/apimachinery/pkg/runtime/serializer" 28 | utilruntime "k8s.io/apimachinery/pkg/util/runtime" 29 | clonev1alpha1 "kubevirt.io/api/clone/v1alpha1" 30 | clonev1beta1 "kubevirt.io/api/clone/v1beta1" 31 | kubevirtv1 "kubevirt.io/api/core/v1" 32 | exportv1alpha1 "kubevirt.io/api/export/v1alpha1" 33 | exportv1beta1 "kubevirt.io/api/export/v1beta1" 34 | instancetypev1alpha1 "kubevirt.io/api/instancetype/v1alpha1" 35 | instancetypev1alpha2 "kubevirt.io/api/instancetype/v1alpha2" 36 | instancetypev1beta1 "kubevirt.io/api/instancetype/v1beta1" 37 | migrationsv1alpha1 "kubevirt.io/api/migrations/v1alpha1" 38 | poolv1alpha1 "kubevirt.io/api/pool/v1alpha1" 39 | snapshotv1alpha1 "kubevirt.io/api/snapshot/v1alpha1" 40 | snapshotv1beta1 "kubevirt.io/api/snapshot/v1beta1" 41 | ) 42 | 43 | var Scheme = runtime.NewScheme() 44 | var Codecs = serializer.NewCodecFactory(Scheme) 45 | var ParameterCodec = runtime.NewParameterCodec(Scheme) 46 | var localSchemeBuilder = runtime.SchemeBuilder{ 47 | clonev1alpha1.AddToScheme, 48 | clonev1beta1.AddToScheme, 49 | kubevirtv1.AddToScheme, 50 | exportv1alpha1.AddToScheme, 51 | exportv1beta1.AddToScheme, 52 | instancetypev1alpha1.AddToScheme, 53 | instancetypev1alpha2.AddToScheme, 54 | instancetypev1beta1.AddToScheme, 55 | migrationsv1alpha1.AddToScheme, 56 | poolv1alpha1.AddToScheme, 57 | snapshotv1alpha1.AddToScheme, 58 | snapshotv1beta1.AddToScheme, 59 | } 60 | 61 | // AddToScheme adds all types of this clientset into the given scheme. This allows composition 62 | // of clientsets, like in: 63 | // 64 | // import ( 65 | // "k8s.io/client-go/kubernetes" 66 | // clientsetscheme "k8s.io/client-go/kubernetes/scheme" 67 | // aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" 68 | // ) 69 | // 70 | // kclientset, _ := kubernetes.NewForConfig(c) 71 | // _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) 72 | // 73 | // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types 74 | // correctly. 75 | var AddToScheme = localSchemeBuilder.AddToScheme 76 | 77 | func init() { 78 | v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) 79 | utilruntime.Must(AddToScheme(Scheme)) 80 | } 81 | -------------------------------------------------------------------------------- /kubevirt/typed/clone/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // This package has the automatically generated typed clients. 22 | package v1alpha1 23 | -------------------------------------------------------------------------------- /kubevirt/typed/clone/v1alpha1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // Package fake has the automatically generated clients. 22 | package fake 23 | -------------------------------------------------------------------------------- /kubevirt/typed/clone/v1alpha1/fake/fake_clone_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package fake 22 | 23 | import ( 24 | rest "k8s.io/client-go/rest" 25 | testing "k8s.io/client-go/testing" 26 | v1alpha1 "kubevirt.io/client-go/kubevirt/typed/clone/v1alpha1" 27 | ) 28 | 29 | type FakeCloneV1alpha1 struct { 30 | *testing.Fake 31 | } 32 | 33 | func (c *FakeCloneV1alpha1) VirtualMachineClones(namespace string) v1alpha1.VirtualMachineCloneInterface { 34 | return &FakeVirtualMachineClones{c, namespace} 35 | } 36 | 37 | // RESTClient returns a RESTClient that is used to communicate 38 | // with API server by this client implementation. 39 | func (c *FakeCloneV1alpha1) RESTClient() rest.Interface { 40 | var ret *rest.RESTClient 41 | return ret 42 | } 43 | -------------------------------------------------------------------------------- /kubevirt/typed/clone/v1alpha1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package v1alpha1 22 | 23 | type VirtualMachineCloneExpansion interface{} 24 | -------------------------------------------------------------------------------- /kubevirt/typed/clone/v1beta1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // This package has the automatically generated typed clients. 22 | package v1beta1 23 | -------------------------------------------------------------------------------- /kubevirt/typed/clone/v1beta1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // Package fake has the automatically generated clients. 22 | package fake 23 | -------------------------------------------------------------------------------- /kubevirt/typed/clone/v1beta1/fake/fake_clone_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package fake 22 | 23 | import ( 24 | rest "k8s.io/client-go/rest" 25 | testing "k8s.io/client-go/testing" 26 | v1beta1 "kubevirt.io/client-go/kubevirt/typed/clone/v1beta1" 27 | ) 28 | 29 | type FakeCloneV1beta1 struct { 30 | *testing.Fake 31 | } 32 | 33 | func (c *FakeCloneV1beta1) VirtualMachineClones(namespace string) v1beta1.VirtualMachineCloneInterface { 34 | return &FakeVirtualMachineClones{c, namespace} 35 | } 36 | 37 | // RESTClient returns a RESTClient that is used to communicate 38 | // with API server by this client implementation. 39 | func (c *FakeCloneV1beta1) RESTClient() rest.Interface { 40 | var ret *rest.RESTClient 41 | return ret 42 | } 43 | -------------------------------------------------------------------------------- /kubevirt/typed/clone/v1beta1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package v1beta1 22 | 23 | type VirtualMachineCloneExpansion interface{} 24 | -------------------------------------------------------------------------------- /kubevirt/typed/core/v1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // This package has the automatically generated typed clients. 22 | package v1 23 | -------------------------------------------------------------------------------- /kubevirt/typed/core/v1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // Package fake has the automatically generated clients. 22 | package fake 23 | -------------------------------------------------------------------------------- /kubevirt/typed/core/v1/fake/fake_core_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package fake 22 | 23 | import ( 24 | rest "k8s.io/client-go/rest" 25 | testing "k8s.io/client-go/testing" 26 | v1 "kubevirt.io/client-go/kubevirt/typed/core/v1" 27 | ) 28 | 29 | type FakeKubevirtV1 struct { 30 | *testing.Fake 31 | } 32 | 33 | func (c *FakeKubevirtV1) KubeVirts(namespace string) v1.KubeVirtInterface { 34 | return &FakeKubeVirts{c, namespace} 35 | } 36 | 37 | func (c *FakeKubevirtV1) VirtualMachines(namespace string) v1.VirtualMachineInterface { 38 | return &FakeVirtualMachines{c, namespace} 39 | } 40 | 41 | func (c *FakeKubevirtV1) VirtualMachineInstances(namespace string) v1.VirtualMachineInstanceInterface { 42 | return &FakeVirtualMachineInstances{c, namespace} 43 | } 44 | 45 | func (c *FakeKubevirtV1) VirtualMachineInstanceMigrations(namespace string) v1.VirtualMachineInstanceMigrationInterface { 46 | return &FakeVirtualMachineInstanceMigrations{c, namespace} 47 | } 48 | 49 | func (c *FakeKubevirtV1) VirtualMachineInstancePresets(namespace string) v1.VirtualMachineInstancePresetInterface { 50 | return &FakeVirtualMachineInstancePresets{c, namespace} 51 | } 52 | 53 | func (c *FakeKubevirtV1) VirtualMachineInstanceReplicaSets(namespace string) v1.VirtualMachineInstanceReplicaSetInterface { 54 | return &FakeVirtualMachineInstanceReplicaSets{c, namespace} 55 | } 56 | 57 | // RESTClient returns a RESTClient that is used to communicate 58 | // with API server by this client implementation. 59 | func (c *FakeKubevirtV1) RESTClient() rest.Interface { 60 | var ret *rest.RESTClient 61 | return ret 62 | } 63 | -------------------------------------------------------------------------------- /kubevirt/typed/core/v1/fake/fake_kubevirt_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the KubeVirt project 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 | * Copyright The KubeVirt Authors 17 | * 18 | */ 19 | 20 | package fake 21 | 22 | import ( 23 | "context" 24 | 25 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 26 | "k8s.io/apimachinery/pkg/types" 27 | 28 | v1 "kubevirt.io/api/core/v1" 29 | ) 30 | 31 | func (c *FakeKubeVirts) PatchStatus(ctx context.Context, name string, pt types.PatchType, data []byte, patchOptions metav1.PatchOptions) (*v1.KubeVirt, error) { 32 | return c.Patch(ctx, name, pt, data, patchOptions, "status") 33 | } 34 | -------------------------------------------------------------------------------- /kubevirt/typed/core/v1/fake/fake_virtualmachineinstancemigration_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the KubeVirt project 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 | * Copyright The KubeVirt Authors 17 | * 18 | */ 19 | 20 | package fake 21 | 22 | import ( 23 | "context" 24 | 25 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 26 | "k8s.io/apimachinery/pkg/types" 27 | 28 | v1 "kubevirt.io/api/core/v1" 29 | ) 30 | 31 | func (c *FakeVirtualMachineInstanceMigrations) PatchStatus(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions) (*v1.VirtualMachineInstanceMigration, error) { 32 | return c.Patch(ctx, name, pt, data, opts, "status") 33 | } 34 | -------------------------------------------------------------------------------- /kubevirt/typed/core/v1/fake/fake_virtualmachineinstancereplicaset_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the KubeVirt project 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 | * Copyright The KubeVirt Authors 17 | * 18 | */ 19 | 20 | package fake 21 | 22 | import ( 23 | "context" 24 | 25 | autov1 "k8s.io/api/autoscaling/v1" 26 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 27 | "k8s.io/apimachinery/pkg/types" 28 | "k8s.io/client-go/testing" 29 | 30 | v1 "kubevirt.io/api/core/v1" 31 | fake2 "kubevirt.io/client-go/testing" 32 | ) 33 | 34 | func (c *FakeVirtualMachineInstanceReplicaSets) GetScale(ctx context.Context, replicaSetName string, options metav1.GetOptions) (*autov1.Scale, error) { 35 | obj, err := c.Fake. 36 | Invokes(testing.NewGetSubresourceAction(virtualmachineinstancereplicasetsResource, c.ns, "scale", replicaSetName), &autov1.Scale{}) 37 | 38 | if obj == nil { 39 | return nil, err 40 | } 41 | return obj.(*autov1.Scale), err 42 | } 43 | 44 | func (c *FakeVirtualMachineInstanceReplicaSets) UpdateScale(ctx context.Context, replicaSetName string, scale *autov1.Scale) (*autov1.Scale, error) { 45 | obj, err := c.Fake. 46 | Invokes(fake2.NewPutSubresourceAction(virtualmachineinstancereplicasetsResource, c.ns, "scale", replicaSetName, struct{}{}), &autov1.Scale{}) 47 | 48 | if obj == nil { 49 | return nil, err 50 | } 51 | return obj.(*autov1.Scale), err 52 | } 53 | 54 | func (c *FakeVirtualMachineInstanceReplicaSets) PatchStatus(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions) (*v1.VirtualMachineInstanceReplicaSet, error) { 55 | return c.Patch(ctx, name, pt, data, opts, "status") 56 | } 57 | -------------------------------------------------------------------------------- /kubevirt/typed/core/v1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package v1 22 | 23 | type VirtualMachineInstancePresetExpansion interface{} 24 | -------------------------------------------------------------------------------- /kubevirt/typed/core/v1/kubevirt.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package v1 22 | 23 | import ( 24 | "context" 25 | 26 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 27 | types "k8s.io/apimachinery/pkg/types" 28 | watch "k8s.io/apimachinery/pkg/watch" 29 | gentype "k8s.io/client-go/gentype" 30 | v1 "kubevirt.io/api/core/v1" 31 | scheme "kubevirt.io/client-go/kubevirt/scheme" 32 | ) 33 | 34 | // KubeVirtsGetter has a method to return a KubeVirtInterface. 35 | // A group's client should implement this interface. 36 | type KubeVirtsGetter interface { 37 | KubeVirts(namespace string) KubeVirtInterface 38 | } 39 | 40 | // KubeVirtInterface has methods to work with KubeVirt resources. 41 | type KubeVirtInterface interface { 42 | Create(ctx context.Context, kubeVirt *v1.KubeVirt, opts metav1.CreateOptions) (*v1.KubeVirt, error) 43 | Update(ctx context.Context, kubeVirt *v1.KubeVirt, opts metav1.UpdateOptions) (*v1.KubeVirt, error) 44 | // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). 45 | UpdateStatus(ctx context.Context, kubeVirt *v1.KubeVirt, opts metav1.UpdateOptions) (*v1.KubeVirt, error) 46 | Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error 47 | DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error 48 | Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.KubeVirt, error) 49 | List(ctx context.Context, opts metav1.ListOptions) (*v1.KubeVirtList, error) 50 | Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) 51 | Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.KubeVirt, err error) 52 | KubeVirtExpansion 53 | } 54 | 55 | // kubeVirts implements KubeVirtInterface 56 | type kubeVirts struct { 57 | *gentype.ClientWithList[*v1.KubeVirt, *v1.KubeVirtList] 58 | } 59 | 60 | // newKubeVirts returns a KubeVirts 61 | func newKubeVirts(c *KubevirtV1Client, namespace string) *kubeVirts { 62 | return &kubeVirts{ 63 | gentype.NewClientWithList[*v1.KubeVirt, *v1.KubeVirtList]( 64 | "kubevirts", 65 | c.RESTClient(), 66 | scheme.ParameterCodec, 67 | namespace, 68 | func() *v1.KubeVirt { return &v1.KubeVirt{} }, 69 | func() *v1.KubeVirtList { return &v1.KubeVirtList{} }), 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /kubevirt/typed/core/v1/kubevirt_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the KubeVirt project 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 | * Copyright The KubeVirt Authors 17 | * 18 | */ 19 | 20 | package v1 21 | 22 | import ( 23 | "context" 24 | 25 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 26 | "k8s.io/apimachinery/pkg/types" 27 | 28 | v1 "kubevirt.io/api/core/v1" 29 | ) 30 | 31 | type KubeVirtExpansion interface { 32 | PatchStatus(ctx context.Context, name string, pt types.PatchType, data []byte, patchOptions metav1.PatchOptions) (*v1.KubeVirt, error) 33 | } 34 | 35 | func (c *kubeVirts) PatchStatus(ctx context.Context, name string, pt types.PatchType, data []byte, patchOptions metav1.PatchOptions) (*v1.KubeVirt, error) { 36 | return c.Patch(ctx, name, pt, data, patchOptions, "status") 37 | } 38 | -------------------------------------------------------------------------------- /kubevirt/typed/core/v1/streamer.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the KubeVirt project 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 | * Copyright The KubeVirt Authors 17 | * 18 | */ 19 | 20 | package v1 21 | 22 | import ( 23 | "net" 24 | "time" 25 | 26 | "github.com/gorilla/websocket" 27 | ) 28 | 29 | type wsStreamer struct { 30 | conn *websocket.Conn 31 | done chan struct{} 32 | } 33 | 34 | func (ws *wsStreamer) streamDone() { 35 | close(ws.done) 36 | } 37 | 38 | func (ws *wsStreamer) Stream(options StreamOptions) error { 39 | copyErr := make(chan error, 1) 40 | 41 | go func() { 42 | _, err := CopyTo(ws.conn, options.In) 43 | copyErr <- err 44 | }() 45 | 46 | go func() { 47 | _, err := CopyFrom(options.Out, ws.conn) 48 | copyErr <- err 49 | }() 50 | 51 | defer ws.streamDone() 52 | return <-copyErr 53 | } 54 | 55 | func (ws *wsStreamer) AsConn() net.Conn { 56 | return &wsConn{ 57 | Conn: ws.conn, 58 | binaryReader: &binaryReader{conn: ws.conn}, 59 | binaryWriter: &binaryWriter{conn: ws.conn}, 60 | } 61 | } 62 | 63 | type wsConn struct { 64 | *websocket.Conn 65 | *binaryReader 66 | *binaryWriter 67 | } 68 | 69 | func (c *wsConn) SetDeadline(t time.Time) error { 70 | if err := c.Conn.SetWriteDeadline(t); err != nil { 71 | return err 72 | } 73 | return c.Conn.SetReadDeadline(t) 74 | } 75 | 76 | func NewWebsocketStreamer(conn *websocket.Conn, done chan struct{}) *wsStreamer { 77 | return &wsStreamer{ 78 | conn: conn, 79 | done: done, 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /kubevirt/typed/core/v1/v1_suite_test.go: -------------------------------------------------------------------------------- 1 | package v1_test 2 | 3 | import ( 4 | "testing" 5 | 6 | ginkgo "github.com/onsi/ginkgo/v2" 7 | gomega "github.com/onsi/gomega" 8 | ) 9 | 10 | func TestV1(t *testing.T) { 11 | gomega.RegisterFailHandler(ginkgo.Fail) 12 | ginkgo.RunSpecs(t, "V1 Suite") 13 | } 14 | -------------------------------------------------------------------------------- /kubevirt/typed/core/v1/virtualmachine.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package v1 22 | 23 | import ( 24 | "context" 25 | 26 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 27 | types "k8s.io/apimachinery/pkg/types" 28 | watch "k8s.io/apimachinery/pkg/watch" 29 | gentype "k8s.io/client-go/gentype" 30 | v1 "kubevirt.io/api/core/v1" 31 | scheme "kubevirt.io/client-go/kubevirt/scheme" 32 | ) 33 | 34 | // VirtualMachinesGetter has a method to return a VirtualMachineInterface. 35 | // A group's client should implement this interface. 36 | type VirtualMachinesGetter interface { 37 | VirtualMachines(namespace string) VirtualMachineInterface 38 | } 39 | 40 | // VirtualMachineInterface has methods to work with VirtualMachine resources. 41 | type VirtualMachineInterface interface { 42 | Create(ctx context.Context, virtualMachine *v1.VirtualMachine, opts metav1.CreateOptions) (*v1.VirtualMachine, error) 43 | Update(ctx context.Context, virtualMachine *v1.VirtualMachine, opts metav1.UpdateOptions) (*v1.VirtualMachine, error) 44 | // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). 45 | UpdateStatus(ctx context.Context, virtualMachine *v1.VirtualMachine, opts metav1.UpdateOptions) (*v1.VirtualMachine, error) 46 | Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error 47 | DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error 48 | Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.VirtualMachine, error) 49 | List(ctx context.Context, opts metav1.ListOptions) (*v1.VirtualMachineList, error) 50 | Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) 51 | Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.VirtualMachine, err error) 52 | VirtualMachineExpansion 53 | } 54 | 55 | // virtualMachines implements VirtualMachineInterface 56 | type virtualMachines struct { 57 | *gentype.ClientWithList[*v1.VirtualMachine, *v1.VirtualMachineList] 58 | } 59 | 60 | // newVirtualMachines returns a VirtualMachines 61 | func newVirtualMachines(c *KubevirtV1Client, namespace string) *virtualMachines { 62 | return &virtualMachines{ 63 | gentype.NewClientWithList[*v1.VirtualMachine, *v1.VirtualMachineList]( 64 | "virtualmachines", 65 | c.RESTClient(), 66 | scheme.ParameterCodec, 67 | namespace, 68 | func() *v1.VirtualMachine { return &v1.VirtualMachine{} }, 69 | func() *v1.VirtualMachineList { return &v1.VirtualMachineList{} }), 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /kubevirt/typed/core/v1/virtualmachineinstancemigration_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the KubeVirt project 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 | * Copyright The KubeVirt Authors 17 | * 18 | */ 19 | 20 | package v1 21 | 22 | import ( 23 | "context" 24 | 25 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 26 | "k8s.io/apimachinery/pkg/types" 27 | 28 | v1 "kubevirt.io/api/core/v1" 29 | ) 30 | 31 | type VirtualMachineInstanceMigrationExpansion interface { 32 | PatchStatus(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions) (*v1.VirtualMachineInstanceMigration, error) 33 | } 34 | 35 | func (c *virtualMachineInstanceMigrations) PatchStatus(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions) (*v1.VirtualMachineInstanceMigration, error) { 36 | // TODO not implemented yet 37 | return nil, nil 38 | } 39 | -------------------------------------------------------------------------------- /kubevirt/typed/core/v1/virtualmachineinstancereplicaset_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the KubeVirt project 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 | * Copyright The KubeVirt Authors 17 | * 18 | */ 19 | 20 | package v1 21 | 22 | import ( 23 | "context" 24 | 25 | autov1 "k8s.io/api/autoscaling/v1" 26 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 27 | "k8s.io/apimachinery/pkg/types" 28 | v1 "kubevirt.io/api/core/v1" 29 | ) 30 | 31 | type VirtualMachineInstanceReplicaSetExpansion interface { 32 | GetScale(ctx context.Context, replicaSetName string, options metav1.GetOptions) (*autov1.Scale, error) 33 | UpdateScale(ctx context.Context, replicaSetName string, scale *autov1.Scale) (*autov1.Scale, error) 34 | PatchStatus(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions) (*v1.VirtualMachineInstanceReplicaSet, error) 35 | } 36 | 37 | func (c *virtualMachineInstanceReplicaSets) GetScale(ctx context.Context, replicaSetName string, options metav1.GetOptions) (*autov1.Scale, error) { 38 | result := &autov1.Scale{} 39 | err := c.GetClient().Get(). 40 | Namespace(c.GetNamespace()). 41 | Resource("virtualmachineinstancereplicasets"). 42 | Name(replicaSetName). 43 | SubResource("scale"). 44 | Do(ctx). 45 | Into(result) 46 | return result, err 47 | } 48 | 49 | func (c *virtualMachineInstanceReplicaSets) UpdateScale(ctx context.Context, replicaSetName string, scale *autov1.Scale) (*autov1.Scale, error) { 50 | result := &autov1.Scale{} 51 | err := c.GetClient().Put(). 52 | Namespace(c.GetNamespace()). 53 | Resource("virtualmachineinstancereplicasets"). 54 | Name(replicaSetName). 55 | SubResource("scale"). 56 | Body(scale). 57 | Do(ctx). 58 | Into(result) 59 | return result, err 60 | } 61 | 62 | func (c *virtualMachineInstanceReplicaSets) PatchStatus(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions) (*v1.VirtualMachineInstanceReplicaSet, error) { 63 | return c.Patch(ctx, name, pt, data, opts, "status") 64 | } 65 | -------------------------------------------------------------------------------- /kubevirt/typed/export/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // This package has the automatically generated typed clients. 22 | package v1alpha1 23 | -------------------------------------------------------------------------------- /kubevirt/typed/export/v1alpha1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // Package fake has the automatically generated clients. 22 | package fake 23 | -------------------------------------------------------------------------------- /kubevirt/typed/export/v1alpha1/fake/fake_export_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package fake 22 | 23 | import ( 24 | rest "k8s.io/client-go/rest" 25 | testing "k8s.io/client-go/testing" 26 | v1alpha1 "kubevirt.io/client-go/kubevirt/typed/export/v1alpha1" 27 | ) 28 | 29 | type FakeExportV1alpha1 struct { 30 | *testing.Fake 31 | } 32 | 33 | func (c *FakeExportV1alpha1) VirtualMachineExports(namespace string) v1alpha1.VirtualMachineExportInterface { 34 | return &FakeVirtualMachineExports{c, namespace} 35 | } 36 | 37 | // RESTClient returns a RESTClient that is used to communicate 38 | // with API server by this client implementation. 39 | func (c *FakeExportV1alpha1) RESTClient() rest.Interface { 40 | var ret *rest.RESTClient 41 | return ret 42 | } 43 | -------------------------------------------------------------------------------- /kubevirt/typed/export/v1alpha1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package v1alpha1 22 | 23 | type VirtualMachineExportExpansion interface{} 24 | -------------------------------------------------------------------------------- /kubevirt/typed/export/v1beta1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // This package has the automatically generated typed clients. 22 | package v1beta1 23 | -------------------------------------------------------------------------------- /kubevirt/typed/export/v1beta1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // Package fake has the automatically generated clients. 22 | package fake 23 | -------------------------------------------------------------------------------- /kubevirt/typed/export/v1beta1/fake/fake_export_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package fake 22 | 23 | import ( 24 | rest "k8s.io/client-go/rest" 25 | testing "k8s.io/client-go/testing" 26 | v1beta1 "kubevirt.io/client-go/kubevirt/typed/export/v1beta1" 27 | ) 28 | 29 | type FakeExportV1beta1 struct { 30 | *testing.Fake 31 | } 32 | 33 | func (c *FakeExportV1beta1) VirtualMachineExports(namespace string) v1beta1.VirtualMachineExportInterface { 34 | return &FakeVirtualMachineExports{c, namespace} 35 | } 36 | 37 | // RESTClient returns a RESTClient that is used to communicate 38 | // with API server by this client implementation. 39 | func (c *FakeExportV1beta1) RESTClient() rest.Interface { 40 | var ret *rest.RESTClient 41 | return ret 42 | } 43 | -------------------------------------------------------------------------------- /kubevirt/typed/export/v1beta1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package v1beta1 22 | 23 | type VirtualMachineExportExpansion interface{} 24 | -------------------------------------------------------------------------------- /kubevirt/typed/instancetype/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // This package has the automatically generated typed clients. 22 | package v1alpha1 23 | -------------------------------------------------------------------------------- /kubevirt/typed/instancetype/v1alpha1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // Package fake has the automatically generated clients. 22 | package fake 23 | -------------------------------------------------------------------------------- /kubevirt/typed/instancetype/v1alpha1/fake/fake_instancetype_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package fake 22 | 23 | import ( 24 | rest "k8s.io/client-go/rest" 25 | testing "k8s.io/client-go/testing" 26 | v1alpha1 "kubevirt.io/client-go/kubevirt/typed/instancetype/v1alpha1" 27 | ) 28 | 29 | type FakeInstancetypeV1alpha1 struct { 30 | *testing.Fake 31 | } 32 | 33 | func (c *FakeInstancetypeV1alpha1) VirtualMachineClusterInstancetypes() v1alpha1.VirtualMachineClusterInstancetypeInterface { 34 | return &FakeVirtualMachineClusterInstancetypes{c} 35 | } 36 | 37 | func (c *FakeInstancetypeV1alpha1) VirtualMachineClusterPreferences() v1alpha1.VirtualMachineClusterPreferenceInterface { 38 | return &FakeVirtualMachineClusterPreferences{c} 39 | } 40 | 41 | func (c *FakeInstancetypeV1alpha1) VirtualMachineInstancetypes(namespace string) v1alpha1.VirtualMachineInstancetypeInterface { 42 | return &FakeVirtualMachineInstancetypes{c, namespace} 43 | } 44 | 45 | func (c *FakeInstancetypeV1alpha1) VirtualMachinePreferences(namespace string) v1alpha1.VirtualMachinePreferenceInterface { 46 | return &FakeVirtualMachinePreferences{c, namespace} 47 | } 48 | 49 | // RESTClient returns a RESTClient that is used to communicate 50 | // with API server by this client implementation. 51 | func (c *FakeInstancetypeV1alpha1) RESTClient() rest.Interface { 52 | var ret *rest.RESTClient 53 | return ret 54 | } 55 | -------------------------------------------------------------------------------- /kubevirt/typed/instancetype/v1alpha1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package v1alpha1 22 | 23 | type VirtualMachineClusterInstancetypeExpansion interface{} 24 | 25 | type VirtualMachineClusterPreferenceExpansion interface{} 26 | 27 | type VirtualMachineInstancetypeExpansion interface{} 28 | 29 | type VirtualMachinePreferenceExpansion interface{} 30 | -------------------------------------------------------------------------------- /kubevirt/typed/instancetype/v1alpha2/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // This package has the automatically generated typed clients. 22 | package v1alpha2 23 | -------------------------------------------------------------------------------- /kubevirt/typed/instancetype/v1alpha2/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // Package fake has the automatically generated clients. 22 | package fake 23 | -------------------------------------------------------------------------------- /kubevirt/typed/instancetype/v1alpha2/fake/fake_instancetype_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package fake 22 | 23 | import ( 24 | rest "k8s.io/client-go/rest" 25 | testing "k8s.io/client-go/testing" 26 | v1alpha2 "kubevirt.io/client-go/kubevirt/typed/instancetype/v1alpha2" 27 | ) 28 | 29 | type FakeInstancetypeV1alpha2 struct { 30 | *testing.Fake 31 | } 32 | 33 | func (c *FakeInstancetypeV1alpha2) VirtualMachineClusterInstancetypes() v1alpha2.VirtualMachineClusterInstancetypeInterface { 34 | return &FakeVirtualMachineClusterInstancetypes{c} 35 | } 36 | 37 | func (c *FakeInstancetypeV1alpha2) VirtualMachineClusterPreferences() v1alpha2.VirtualMachineClusterPreferenceInterface { 38 | return &FakeVirtualMachineClusterPreferences{c} 39 | } 40 | 41 | func (c *FakeInstancetypeV1alpha2) VirtualMachineInstancetypes(namespace string) v1alpha2.VirtualMachineInstancetypeInterface { 42 | return &FakeVirtualMachineInstancetypes{c, namespace} 43 | } 44 | 45 | func (c *FakeInstancetypeV1alpha2) VirtualMachinePreferences(namespace string) v1alpha2.VirtualMachinePreferenceInterface { 46 | return &FakeVirtualMachinePreferences{c, namespace} 47 | } 48 | 49 | // RESTClient returns a RESTClient that is used to communicate 50 | // with API server by this client implementation. 51 | func (c *FakeInstancetypeV1alpha2) RESTClient() rest.Interface { 52 | var ret *rest.RESTClient 53 | return ret 54 | } 55 | -------------------------------------------------------------------------------- /kubevirt/typed/instancetype/v1alpha2/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package v1alpha2 22 | 23 | type VirtualMachineClusterInstancetypeExpansion interface{} 24 | 25 | type VirtualMachineClusterPreferenceExpansion interface{} 26 | 27 | type VirtualMachineInstancetypeExpansion interface{} 28 | 29 | type VirtualMachinePreferenceExpansion interface{} 30 | -------------------------------------------------------------------------------- /kubevirt/typed/instancetype/v1beta1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // This package has the automatically generated typed clients. 22 | package v1beta1 23 | -------------------------------------------------------------------------------- /kubevirt/typed/instancetype/v1beta1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // Package fake has the automatically generated clients. 22 | package fake 23 | -------------------------------------------------------------------------------- /kubevirt/typed/instancetype/v1beta1/fake/fake_instancetype_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package fake 22 | 23 | import ( 24 | rest "k8s.io/client-go/rest" 25 | testing "k8s.io/client-go/testing" 26 | v1beta1 "kubevirt.io/client-go/kubevirt/typed/instancetype/v1beta1" 27 | ) 28 | 29 | type FakeInstancetypeV1beta1 struct { 30 | *testing.Fake 31 | } 32 | 33 | func (c *FakeInstancetypeV1beta1) VirtualMachineClusterInstancetypes() v1beta1.VirtualMachineClusterInstancetypeInterface { 34 | return &FakeVirtualMachineClusterInstancetypes{c} 35 | } 36 | 37 | func (c *FakeInstancetypeV1beta1) VirtualMachineClusterPreferences() v1beta1.VirtualMachineClusterPreferenceInterface { 38 | return &FakeVirtualMachineClusterPreferences{c} 39 | } 40 | 41 | func (c *FakeInstancetypeV1beta1) VirtualMachineInstancetypes(namespace string) v1beta1.VirtualMachineInstancetypeInterface { 42 | return &FakeVirtualMachineInstancetypes{c, namespace} 43 | } 44 | 45 | func (c *FakeInstancetypeV1beta1) VirtualMachinePreferences(namespace string) v1beta1.VirtualMachinePreferenceInterface { 46 | return &FakeVirtualMachinePreferences{c, namespace} 47 | } 48 | 49 | // RESTClient returns a RESTClient that is used to communicate 50 | // with API server by this client implementation. 51 | func (c *FakeInstancetypeV1beta1) RESTClient() rest.Interface { 52 | var ret *rest.RESTClient 53 | return ret 54 | } 55 | -------------------------------------------------------------------------------- /kubevirt/typed/instancetype/v1beta1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package v1beta1 22 | 23 | type VirtualMachineClusterInstancetypeExpansion interface{} 24 | 25 | type VirtualMachineClusterPreferenceExpansion interface{} 26 | 27 | type VirtualMachineInstancetypeExpansion interface{} 28 | 29 | type VirtualMachinePreferenceExpansion interface{} 30 | -------------------------------------------------------------------------------- /kubevirt/typed/migrations/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // This package has the automatically generated typed clients. 22 | package v1alpha1 23 | -------------------------------------------------------------------------------- /kubevirt/typed/migrations/v1alpha1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // Package fake has the automatically generated clients. 22 | package fake 23 | -------------------------------------------------------------------------------- /kubevirt/typed/migrations/v1alpha1/fake/fake_migrations_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package fake 22 | 23 | import ( 24 | rest "k8s.io/client-go/rest" 25 | testing "k8s.io/client-go/testing" 26 | v1alpha1 "kubevirt.io/client-go/kubevirt/typed/migrations/v1alpha1" 27 | ) 28 | 29 | type FakeMigrationsV1alpha1 struct { 30 | *testing.Fake 31 | } 32 | 33 | func (c *FakeMigrationsV1alpha1) MigrationPolicies() v1alpha1.MigrationPolicyInterface { 34 | return &FakeMigrationPolicies{c} 35 | } 36 | 37 | // RESTClient returns a RESTClient that is used to communicate 38 | // with API server by this client implementation. 39 | func (c *FakeMigrationsV1alpha1) RESTClient() rest.Interface { 40 | var ret *rest.RESTClient 41 | return ret 42 | } 43 | -------------------------------------------------------------------------------- /kubevirt/typed/migrations/v1alpha1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package v1alpha1 22 | 23 | type MigrationPolicyExpansion interface{} 24 | -------------------------------------------------------------------------------- /kubevirt/typed/pool/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // This package has the automatically generated typed clients. 22 | package v1alpha1 23 | -------------------------------------------------------------------------------- /kubevirt/typed/pool/v1alpha1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // Package fake has the automatically generated clients. 22 | package fake 23 | -------------------------------------------------------------------------------- /kubevirt/typed/pool/v1alpha1/fake/fake_pool_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package fake 22 | 23 | import ( 24 | rest "k8s.io/client-go/rest" 25 | testing "k8s.io/client-go/testing" 26 | v1alpha1 "kubevirt.io/client-go/kubevirt/typed/pool/v1alpha1" 27 | ) 28 | 29 | type FakePoolV1alpha1 struct { 30 | *testing.Fake 31 | } 32 | 33 | func (c *FakePoolV1alpha1) VirtualMachinePools(namespace string) v1alpha1.VirtualMachinePoolInterface { 34 | return &FakeVirtualMachinePools{c, namespace} 35 | } 36 | 37 | // RESTClient returns a RESTClient that is used to communicate 38 | // with API server by this client implementation. 39 | func (c *FakePoolV1alpha1) RESTClient() rest.Interface { 40 | var ret *rest.RESTClient 41 | return ret 42 | } 43 | -------------------------------------------------------------------------------- /kubevirt/typed/pool/v1alpha1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package v1alpha1 22 | 23 | type VirtualMachinePoolExpansion interface{} 24 | -------------------------------------------------------------------------------- /kubevirt/typed/snapshot/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // This package has the automatically generated typed clients. 22 | package v1alpha1 23 | -------------------------------------------------------------------------------- /kubevirt/typed/snapshot/v1alpha1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // Package fake has the automatically generated clients. 22 | package fake 23 | -------------------------------------------------------------------------------- /kubevirt/typed/snapshot/v1alpha1/fake/fake_snapshot_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package fake 22 | 23 | import ( 24 | rest "k8s.io/client-go/rest" 25 | testing "k8s.io/client-go/testing" 26 | v1alpha1 "kubevirt.io/client-go/kubevirt/typed/snapshot/v1alpha1" 27 | ) 28 | 29 | type FakeSnapshotV1alpha1 struct { 30 | *testing.Fake 31 | } 32 | 33 | func (c *FakeSnapshotV1alpha1) VirtualMachineRestores(namespace string) v1alpha1.VirtualMachineRestoreInterface { 34 | return &FakeVirtualMachineRestores{c, namespace} 35 | } 36 | 37 | func (c *FakeSnapshotV1alpha1) VirtualMachineSnapshots(namespace string) v1alpha1.VirtualMachineSnapshotInterface { 38 | return &FakeVirtualMachineSnapshots{c, namespace} 39 | } 40 | 41 | func (c *FakeSnapshotV1alpha1) VirtualMachineSnapshotContents(namespace string) v1alpha1.VirtualMachineSnapshotContentInterface { 42 | return &FakeVirtualMachineSnapshotContents{c, namespace} 43 | } 44 | 45 | // RESTClient returns a RESTClient that is used to communicate 46 | // with API server by this client implementation. 47 | func (c *FakeSnapshotV1alpha1) RESTClient() rest.Interface { 48 | var ret *rest.RESTClient 49 | return ret 50 | } 51 | -------------------------------------------------------------------------------- /kubevirt/typed/snapshot/v1alpha1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package v1alpha1 22 | 23 | type VirtualMachineRestoreExpansion interface{} 24 | 25 | type VirtualMachineSnapshotExpansion interface{} 26 | 27 | type VirtualMachineSnapshotContentExpansion interface{} 28 | -------------------------------------------------------------------------------- /kubevirt/typed/snapshot/v1beta1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // This package has the automatically generated typed clients. 22 | package v1beta1 23 | -------------------------------------------------------------------------------- /kubevirt/typed/snapshot/v1beta1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // Package fake has the automatically generated clients. 22 | package fake 23 | -------------------------------------------------------------------------------- /kubevirt/typed/snapshot/v1beta1/fake/fake_snapshot_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package fake 22 | 23 | import ( 24 | rest "k8s.io/client-go/rest" 25 | testing "k8s.io/client-go/testing" 26 | v1beta1 "kubevirt.io/client-go/kubevirt/typed/snapshot/v1beta1" 27 | ) 28 | 29 | type FakeSnapshotV1beta1 struct { 30 | *testing.Fake 31 | } 32 | 33 | func (c *FakeSnapshotV1beta1) VirtualMachineRestores(namespace string) v1beta1.VirtualMachineRestoreInterface { 34 | return &FakeVirtualMachineRestores{c, namespace} 35 | } 36 | 37 | func (c *FakeSnapshotV1beta1) VirtualMachineSnapshots(namespace string) v1beta1.VirtualMachineSnapshotInterface { 38 | return &FakeVirtualMachineSnapshots{c, namespace} 39 | } 40 | 41 | func (c *FakeSnapshotV1beta1) VirtualMachineSnapshotContents(namespace string) v1beta1.VirtualMachineSnapshotContentInterface { 42 | return &FakeVirtualMachineSnapshotContents{c, namespace} 43 | } 44 | 45 | // RESTClient returns a RESTClient that is used to communicate 46 | // with API server by this client implementation. 47 | func (c *FakeSnapshotV1beta1) RESTClient() rest.Interface { 48 | var ret *rest.RESTClient 49 | return ret 50 | } 51 | -------------------------------------------------------------------------------- /kubevirt/typed/snapshot/v1beta1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package v1beta1 22 | 23 | type VirtualMachineRestoreExpansion interface{} 24 | 25 | type VirtualMachineSnapshotExpansion interface{} 26 | 27 | type VirtualMachineSnapshotContentExpansion interface{} 28 | -------------------------------------------------------------------------------- /log/log_suite_test.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | import ( 4 | "errors" 5 | "fmt" 6 | "os" 7 | "path/filepath" 8 | "runtime" 9 | "strings" 10 | "testing" 11 | 12 | . "github.com/onsi/ginkgo/v2" 13 | "github.com/onsi/ginkgo/v2/reporters" 14 | "github.com/onsi/gomega" 15 | 16 | v1reporter "kubevirt.io/client-go/reporter" 17 | ) 18 | 19 | var afterSuiteReporters = []reporters.DeprecatedReporter{} 20 | 21 | func TestLogging(t *testing.T) { 22 | Log.SetIOWriter(GinkgoWriter) 23 | gomega.RegisterFailHandler(Fail) 24 | testsWrapped := os.Getenv("GO_TEST_WRAP") 25 | outputFile := os.Getenv("XML_OUTPUT_FILE") 26 | _, description, _, _ := runtime.Caller(1) 27 | projectRoot := findRoot() 28 | description = strings.TrimPrefix(description, projectRoot) 29 | 30 | suiteConfig, _ := GinkgoConfiguration() 31 | 32 | // if run on bazel (XML_OUTPUT_FILE is not empty) 33 | // and rules_go is configured to not produce the junit xml 34 | // produce it here. Otherwise just run the default RunSpec 35 | if testsWrapped == "0" && outputFile != "" { 36 | testTarget := os.Getenv("TEST_TARGET") 37 | if testTarget != "" { 38 | description = testTarget 39 | } 40 | if suiteConfig.ParallelTotal > 1 { 41 | outputFile = fmt.Sprintf("%s-%d", outputFile, GinkgoParallelProcess()) 42 | } 43 | 44 | afterSuiteReporters = append(afterSuiteReporters, v1reporter.NewV1JUnitReporter(outputFile)) 45 | } 46 | 47 | RunSpecs(t, description) 48 | } 49 | 50 | func findRoot() string { 51 | _, current, _, _ := runtime.Caller(0) 52 | for { 53 | current = filepath.Dir(current) 54 | if current == "/" || current == "." { 55 | return current 56 | } 57 | if _, err := os.Stat(filepath.Join(current, "WORKSPACE")); err == nil { 58 | return strings.TrimSuffix(current, "/") + "/" 59 | } else if errors.Is(err, os.ErrNotExist) { 60 | continue 61 | } else if err != nil { 62 | panic(err) 63 | } 64 | } 65 | } 66 | 67 | var _ = ReportAfterSuite("TestLogging", func(report Report) { 68 | for _, reporter := range afterSuiteReporters { 69 | reporters.ReportViaDeprecatedReporter(reporter, report) 70 | } 71 | }) 72 | -------------------------------------------------------------------------------- /networkattachmentdefinitionclient/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The KubeVirt 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 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package has the automatically generated clientset. 20 | package networkattachmentdefinitionclient 21 | -------------------------------------------------------------------------------- /networkattachmentdefinitionclient/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // This package has the automatically generated fake clientset. 22 | package fake 23 | -------------------------------------------------------------------------------- /networkattachmentdefinitionclient/fake/register.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package fake 22 | 23 | import ( 24 | k8scnicncfiov1 "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1" 25 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 26 | runtime "k8s.io/apimachinery/pkg/runtime" 27 | schema "k8s.io/apimachinery/pkg/runtime/schema" 28 | serializer "k8s.io/apimachinery/pkg/runtime/serializer" 29 | utilruntime "k8s.io/apimachinery/pkg/util/runtime" 30 | ) 31 | 32 | var scheme = runtime.NewScheme() 33 | var codecs = serializer.NewCodecFactory(scheme) 34 | 35 | var localSchemeBuilder = runtime.SchemeBuilder{ 36 | k8scnicncfiov1.AddToScheme, 37 | } 38 | 39 | // AddToScheme adds all types of this clientset into the given scheme. This allows composition 40 | // of clientsets, like in: 41 | // 42 | // import ( 43 | // "k8s.io/client-go/kubernetes" 44 | // clientsetscheme "k8s.io/client-go/kubernetes/scheme" 45 | // aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" 46 | // ) 47 | // 48 | // kclientset, _ := kubernetes.NewForConfig(c) 49 | // _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) 50 | // 51 | // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types 52 | // correctly. 53 | var AddToScheme = localSchemeBuilder.AddToScheme 54 | 55 | func init() { 56 | v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) 57 | utilruntime.Must(AddToScheme(scheme)) 58 | } 59 | -------------------------------------------------------------------------------- /networkattachmentdefinitionclient/scheme/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // This package contains the scheme of the automatically generated clientset. 22 | package scheme 23 | -------------------------------------------------------------------------------- /networkattachmentdefinitionclient/scheme/register.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package scheme 22 | 23 | import ( 24 | k8scnicncfiov1 "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1" 25 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 26 | runtime "k8s.io/apimachinery/pkg/runtime" 27 | schema "k8s.io/apimachinery/pkg/runtime/schema" 28 | serializer "k8s.io/apimachinery/pkg/runtime/serializer" 29 | utilruntime "k8s.io/apimachinery/pkg/util/runtime" 30 | ) 31 | 32 | var Scheme = runtime.NewScheme() 33 | var Codecs = serializer.NewCodecFactory(Scheme) 34 | var ParameterCodec = runtime.NewParameterCodec(Scheme) 35 | var localSchemeBuilder = runtime.SchemeBuilder{ 36 | k8scnicncfiov1.AddToScheme, 37 | } 38 | 39 | // AddToScheme adds all types of this clientset into the given scheme. This allows composition 40 | // of clientsets, like in: 41 | // 42 | // import ( 43 | // "k8s.io/client-go/kubernetes" 44 | // clientsetscheme "k8s.io/client-go/kubernetes/scheme" 45 | // aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" 46 | // ) 47 | // 48 | // kclientset, _ := kubernetes.NewForConfig(c) 49 | // _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) 50 | // 51 | // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types 52 | // correctly. 53 | var AddToScheme = localSchemeBuilder.AddToScheme 54 | 55 | func init() { 56 | v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) 57 | utilruntime.Must(AddToScheme(Scheme)) 58 | } 59 | -------------------------------------------------------------------------------- /networkattachmentdefinitionclient/typed/k8s.cni.cncf.io/v1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // This package has the automatically generated typed clients. 22 | package v1 23 | -------------------------------------------------------------------------------- /networkattachmentdefinitionclient/typed/k8s.cni.cncf.io/v1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // Package fake has the automatically generated clients. 22 | package fake 23 | -------------------------------------------------------------------------------- /networkattachmentdefinitionclient/typed/k8s.cni.cncf.io/v1/fake/fake_k8s.cni.cncf.io_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package fake 22 | 23 | import ( 24 | rest "k8s.io/client-go/rest" 25 | testing "k8s.io/client-go/testing" 26 | v1 "kubevirt.io/client-go/networkattachmentdefinitionclient/typed/k8s.cni.cncf.io/v1" 27 | ) 28 | 29 | type FakeK8sCniCncfIoV1 struct { 30 | *testing.Fake 31 | } 32 | 33 | func (c *FakeK8sCniCncfIoV1) NetworkAttachmentDefinitions(namespace string) v1.NetworkAttachmentDefinitionInterface { 34 | return &FakeNetworkAttachmentDefinitions{c, namespace} 35 | } 36 | 37 | // RESTClient returns a RESTClient that is used to communicate 38 | // with API server by this client implementation. 39 | func (c *FakeK8sCniCncfIoV1) RESTClient() rest.Interface { 40 | var ret *rest.RESTClient 41 | return ret 42 | } 43 | -------------------------------------------------------------------------------- /networkattachmentdefinitionclient/typed/k8s.cni.cncf.io/v1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package v1 22 | 23 | type NetworkAttachmentDefinitionExpansion interface{} 24 | -------------------------------------------------------------------------------- /precond/precond.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the KubeVirt project 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 | * Copyright 2017 Red Hat, Inc. 17 | * 18 | */ 19 | 20 | package precond 21 | 22 | import ( 23 | "fmt" 24 | ) 25 | 26 | type PreconditionError struct { 27 | msg string 28 | } 29 | 30 | func (e *PreconditionError) Error() string { 31 | return e.msg 32 | } 33 | 34 | func MustNotBeEmpty(str string, msg ...interface{}) string { 35 | panicOnError(CheckNotEmpty(str, msg...)) 36 | return str 37 | } 38 | 39 | func MustNotBeNil(obj interface{}, msg ...interface{}) interface{} { 40 | panicOnError(CheckNotNil(obj, msg...)) 41 | return obj 42 | } 43 | 44 | func MustBeTrue(b bool, msg ...interface{}) { 45 | panicOnError(CheckTrue(b, msg...)) 46 | } 47 | 48 | func CheckNotEmpty(str string, msg ...interface{}) error { 49 | if str == "" { 50 | return newError("String must not be empty", msg...) 51 | } 52 | return nil 53 | } 54 | 55 | func CheckNotNil(obj interface{}, msg ...interface{}) error { 56 | if obj == nil { 57 | return newError("Object must not be nil", msg...) 58 | } 59 | return nil 60 | } 61 | 62 | func CheckTrue(b bool, msg ...interface{}) error { 63 | if b == false { 64 | return newError("Expression must be true", msg...) 65 | } 66 | return nil 67 | } 68 | 69 | func panicOnError(e error) { 70 | if e != nil { 71 | panic(e) 72 | } 73 | } 74 | 75 | func newError(defaultMsg string, msg ...interface{}) *PreconditionError { 76 | return &PreconditionError{msg: newErrMsg(defaultMsg, msg...)} 77 | } 78 | 79 | func newErrMsg(defaultMsg string, msg ...interface{}) string { 80 | if msg != nil { 81 | switch t := msg[0].(type) { 82 | case string: 83 | return fmt.Sprintf(t, msg[1:]...) 84 | default: 85 | return fmt.Sprint(msg...) 86 | } 87 | } 88 | return defaultMsg 89 | } 90 | -------------------------------------------------------------------------------- /prometheusoperator/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The KubeVirt 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 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package has the automatically generated clientset. 20 | package prometheusoperator 21 | -------------------------------------------------------------------------------- /prometheusoperator/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // This package has the automatically generated fake clientset. 22 | package fake 23 | -------------------------------------------------------------------------------- /prometheusoperator/fake/register.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package fake 22 | 23 | import ( 24 | monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" 25 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 26 | runtime "k8s.io/apimachinery/pkg/runtime" 27 | schema "k8s.io/apimachinery/pkg/runtime/schema" 28 | serializer "k8s.io/apimachinery/pkg/runtime/serializer" 29 | utilruntime "k8s.io/apimachinery/pkg/util/runtime" 30 | ) 31 | 32 | var scheme = runtime.NewScheme() 33 | var codecs = serializer.NewCodecFactory(scheme) 34 | 35 | var localSchemeBuilder = runtime.SchemeBuilder{ 36 | monitoringv1.AddToScheme, 37 | } 38 | 39 | // AddToScheme adds all types of this clientset into the given scheme. This allows composition 40 | // of clientsets, like in: 41 | // 42 | // import ( 43 | // "k8s.io/client-go/kubernetes" 44 | // clientsetscheme "k8s.io/client-go/kubernetes/scheme" 45 | // aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" 46 | // ) 47 | // 48 | // kclientset, _ := kubernetes.NewForConfig(c) 49 | // _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) 50 | // 51 | // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types 52 | // correctly. 53 | var AddToScheme = localSchemeBuilder.AddToScheme 54 | 55 | func init() { 56 | v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) 57 | utilruntime.Must(AddToScheme(scheme)) 58 | } 59 | -------------------------------------------------------------------------------- /prometheusoperator/scheme/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // This package contains the scheme of the automatically generated clientset. 22 | package scheme 23 | -------------------------------------------------------------------------------- /prometheusoperator/scheme/register.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package scheme 22 | 23 | import ( 24 | monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" 25 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 26 | runtime "k8s.io/apimachinery/pkg/runtime" 27 | schema "k8s.io/apimachinery/pkg/runtime/schema" 28 | serializer "k8s.io/apimachinery/pkg/runtime/serializer" 29 | utilruntime "k8s.io/apimachinery/pkg/util/runtime" 30 | ) 31 | 32 | var Scheme = runtime.NewScheme() 33 | var Codecs = serializer.NewCodecFactory(Scheme) 34 | var ParameterCodec = runtime.NewParameterCodec(Scheme) 35 | var localSchemeBuilder = runtime.SchemeBuilder{ 36 | monitoringv1.AddToScheme, 37 | } 38 | 39 | // AddToScheme adds all types of this clientset into the given scheme. This allows composition 40 | // of clientsets, like in: 41 | // 42 | // import ( 43 | // "k8s.io/client-go/kubernetes" 44 | // clientsetscheme "k8s.io/client-go/kubernetes/scheme" 45 | // aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" 46 | // ) 47 | // 48 | // kclientset, _ := kubernetes.NewForConfig(c) 49 | // _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) 50 | // 51 | // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types 52 | // correctly. 53 | var AddToScheme = localSchemeBuilder.AddToScheme 54 | 55 | func init() { 56 | v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) 57 | utilruntime.Must(AddToScheme(Scheme)) 58 | } 59 | -------------------------------------------------------------------------------- /prometheusoperator/typed/monitoring/v1/alertmanager.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package v1 22 | 23 | import ( 24 | "context" 25 | 26 | v1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" 27 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 28 | types "k8s.io/apimachinery/pkg/types" 29 | watch "k8s.io/apimachinery/pkg/watch" 30 | gentype "k8s.io/client-go/gentype" 31 | scheme "kubevirt.io/client-go/prometheusoperator/scheme" 32 | ) 33 | 34 | // AlertmanagersGetter has a method to return a AlertmanagerInterface. 35 | // A group's client should implement this interface. 36 | type AlertmanagersGetter interface { 37 | Alertmanagers(namespace string) AlertmanagerInterface 38 | } 39 | 40 | // AlertmanagerInterface has methods to work with Alertmanager resources. 41 | type AlertmanagerInterface interface { 42 | Create(ctx context.Context, alertmanager *v1.Alertmanager, opts metav1.CreateOptions) (*v1.Alertmanager, error) 43 | Update(ctx context.Context, alertmanager *v1.Alertmanager, opts metav1.UpdateOptions) (*v1.Alertmanager, error) 44 | // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). 45 | UpdateStatus(ctx context.Context, alertmanager *v1.Alertmanager, opts metav1.UpdateOptions) (*v1.Alertmanager, error) 46 | Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error 47 | DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error 48 | Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Alertmanager, error) 49 | List(ctx context.Context, opts metav1.ListOptions) (*v1.AlertmanagerList, error) 50 | Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) 51 | Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Alertmanager, err error) 52 | AlertmanagerExpansion 53 | } 54 | 55 | // alertmanagers implements AlertmanagerInterface 56 | type alertmanagers struct { 57 | *gentype.ClientWithList[*v1.Alertmanager, *v1.AlertmanagerList] 58 | } 59 | 60 | // newAlertmanagers returns a Alertmanagers 61 | func newAlertmanagers(c *MonitoringV1Client, namespace string) *alertmanagers { 62 | return &alertmanagers{ 63 | gentype.NewClientWithList[*v1.Alertmanager, *v1.AlertmanagerList]( 64 | "alertmanagers", 65 | c.RESTClient(), 66 | scheme.ParameterCodec, 67 | namespace, 68 | func() *v1.Alertmanager { return &v1.Alertmanager{} }, 69 | func() *v1.AlertmanagerList { return &v1.AlertmanagerList{} }), 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /prometheusoperator/typed/monitoring/v1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // This package has the automatically generated typed clients. 22 | package v1 23 | -------------------------------------------------------------------------------- /prometheusoperator/typed/monitoring/v1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // Package fake has the automatically generated clients. 22 | package fake 23 | -------------------------------------------------------------------------------- /prometheusoperator/typed/monitoring/v1/fake/fake_monitoring_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package fake 22 | 23 | import ( 24 | rest "k8s.io/client-go/rest" 25 | testing "k8s.io/client-go/testing" 26 | v1 "kubevirt.io/client-go/prometheusoperator/typed/monitoring/v1" 27 | ) 28 | 29 | type FakeMonitoringV1 struct { 30 | *testing.Fake 31 | } 32 | 33 | func (c *FakeMonitoringV1) Alertmanagers(namespace string) v1.AlertmanagerInterface { 34 | return &FakeAlertmanagers{c, namespace} 35 | } 36 | 37 | func (c *FakeMonitoringV1) PodMonitors(namespace string) v1.PodMonitorInterface { 38 | return &FakePodMonitors{c, namespace} 39 | } 40 | 41 | func (c *FakeMonitoringV1) Probes(namespace string) v1.ProbeInterface { 42 | return &FakeProbes{c, namespace} 43 | } 44 | 45 | func (c *FakeMonitoringV1) Prometheuses(namespace string) v1.PrometheusInterface { 46 | return &FakePrometheuses{c, namespace} 47 | } 48 | 49 | func (c *FakeMonitoringV1) PrometheusRules(namespace string) v1.PrometheusRuleInterface { 50 | return &FakePrometheusRules{c, namespace} 51 | } 52 | 53 | func (c *FakeMonitoringV1) ServiceMonitors(namespace string) v1.ServiceMonitorInterface { 54 | return &FakeServiceMonitors{c, namespace} 55 | } 56 | 57 | func (c *FakeMonitoringV1) ThanosRulers(namespace string) v1.ThanosRulerInterface { 58 | return &FakeThanosRulers{c, namespace} 59 | } 60 | 61 | // RESTClient returns a RESTClient that is used to communicate 62 | // with API server by this client implementation. 63 | func (c *FakeMonitoringV1) RESTClient() rest.Interface { 64 | var ret *rest.RESTClient 65 | return ret 66 | } 67 | -------------------------------------------------------------------------------- /prometheusoperator/typed/monitoring/v1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package v1 22 | 23 | type AlertmanagerExpansion interface{} 24 | 25 | type PodMonitorExpansion interface{} 26 | 27 | type ProbeExpansion interface{} 28 | 29 | type PrometheusExpansion interface{} 30 | 31 | type PrometheusRuleExpansion interface{} 32 | 33 | type ServiceMonitorExpansion interface{} 34 | 35 | type ThanosRulerExpansion interface{} 36 | -------------------------------------------------------------------------------- /prometheusoperator/typed/monitoring/v1/podmonitor.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package v1 22 | 23 | import ( 24 | "context" 25 | 26 | v1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" 27 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 28 | types "k8s.io/apimachinery/pkg/types" 29 | watch "k8s.io/apimachinery/pkg/watch" 30 | gentype "k8s.io/client-go/gentype" 31 | scheme "kubevirt.io/client-go/prometheusoperator/scheme" 32 | ) 33 | 34 | // PodMonitorsGetter has a method to return a PodMonitorInterface. 35 | // A group's client should implement this interface. 36 | type PodMonitorsGetter interface { 37 | PodMonitors(namespace string) PodMonitorInterface 38 | } 39 | 40 | // PodMonitorInterface has methods to work with PodMonitor resources. 41 | type PodMonitorInterface interface { 42 | Create(ctx context.Context, podMonitor *v1.PodMonitor, opts metav1.CreateOptions) (*v1.PodMonitor, error) 43 | Update(ctx context.Context, podMonitor *v1.PodMonitor, opts metav1.UpdateOptions) (*v1.PodMonitor, error) 44 | Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error 45 | DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error 46 | Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.PodMonitor, error) 47 | List(ctx context.Context, opts metav1.ListOptions) (*v1.PodMonitorList, error) 48 | Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) 49 | Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.PodMonitor, err error) 50 | PodMonitorExpansion 51 | } 52 | 53 | // podMonitors implements PodMonitorInterface 54 | type podMonitors struct { 55 | *gentype.ClientWithList[*v1.PodMonitor, *v1.PodMonitorList] 56 | } 57 | 58 | // newPodMonitors returns a PodMonitors 59 | func newPodMonitors(c *MonitoringV1Client, namespace string) *podMonitors { 60 | return &podMonitors{ 61 | gentype.NewClientWithList[*v1.PodMonitor, *v1.PodMonitorList]( 62 | "podmonitors", 63 | c.RESTClient(), 64 | scheme.ParameterCodec, 65 | namespace, 66 | func() *v1.PodMonitor { return &v1.PodMonitor{} }, 67 | func() *v1.PodMonitorList { return &v1.PodMonitorList{} }), 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /prometheusoperator/typed/monitoring/v1/probe.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package v1 22 | 23 | import ( 24 | "context" 25 | 26 | v1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" 27 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 28 | types "k8s.io/apimachinery/pkg/types" 29 | watch "k8s.io/apimachinery/pkg/watch" 30 | gentype "k8s.io/client-go/gentype" 31 | scheme "kubevirt.io/client-go/prometheusoperator/scheme" 32 | ) 33 | 34 | // ProbesGetter has a method to return a ProbeInterface. 35 | // A group's client should implement this interface. 36 | type ProbesGetter interface { 37 | Probes(namespace string) ProbeInterface 38 | } 39 | 40 | // ProbeInterface has methods to work with Probe resources. 41 | type ProbeInterface interface { 42 | Create(ctx context.Context, probe *v1.Probe, opts metav1.CreateOptions) (*v1.Probe, error) 43 | Update(ctx context.Context, probe *v1.Probe, opts metav1.UpdateOptions) (*v1.Probe, error) 44 | Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error 45 | DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error 46 | Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Probe, error) 47 | List(ctx context.Context, opts metav1.ListOptions) (*v1.ProbeList, error) 48 | Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) 49 | Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Probe, err error) 50 | ProbeExpansion 51 | } 52 | 53 | // probes implements ProbeInterface 54 | type probes struct { 55 | *gentype.ClientWithList[*v1.Probe, *v1.ProbeList] 56 | } 57 | 58 | // newProbes returns a Probes 59 | func newProbes(c *MonitoringV1Client, namespace string) *probes { 60 | return &probes{ 61 | gentype.NewClientWithList[*v1.Probe, *v1.ProbeList]( 62 | "probes", 63 | c.RESTClient(), 64 | scheme.ParameterCodec, 65 | namespace, 66 | func() *v1.Probe { return &v1.Probe{} }, 67 | func() *v1.ProbeList { return &v1.ProbeList{} }), 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /prometheusoperator/typed/monitoring/v1/prometheus.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package v1 22 | 23 | import ( 24 | "context" 25 | 26 | v1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" 27 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 28 | types "k8s.io/apimachinery/pkg/types" 29 | watch "k8s.io/apimachinery/pkg/watch" 30 | gentype "k8s.io/client-go/gentype" 31 | scheme "kubevirt.io/client-go/prometheusoperator/scheme" 32 | ) 33 | 34 | // PrometheusesGetter has a method to return a PrometheusInterface. 35 | // A group's client should implement this interface. 36 | type PrometheusesGetter interface { 37 | Prometheuses(namespace string) PrometheusInterface 38 | } 39 | 40 | // PrometheusInterface has methods to work with Prometheus resources. 41 | type PrometheusInterface interface { 42 | Create(ctx context.Context, prometheus *v1.Prometheus, opts metav1.CreateOptions) (*v1.Prometheus, error) 43 | Update(ctx context.Context, prometheus *v1.Prometheus, opts metav1.UpdateOptions) (*v1.Prometheus, error) 44 | // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). 45 | UpdateStatus(ctx context.Context, prometheus *v1.Prometheus, opts metav1.UpdateOptions) (*v1.Prometheus, error) 46 | Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error 47 | DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error 48 | Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Prometheus, error) 49 | List(ctx context.Context, opts metav1.ListOptions) (*v1.PrometheusList, error) 50 | Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) 51 | Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Prometheus, err error) 52 | PrometheusExpansion 53 | } 54 | 55 | // prometheuses implements PrometheusInterface 56 | type prometheuses struct { 57 | *gentype.ClientWithList[*v1.Prometheus, *v1.PrometheusList] 58 | } 59 | 60 | // newPrometheuses returns a Prometheuses 61 | func newPrometheuses(c *MonitoringV1Client, namespace string) *prometheuses { 62 | return &prometheuses{ 63 | gentype.NewClientWithList[*v1.Prometheus, *v1.PrometheusList]( 64 | "prometheuses", 65 | c.RESTClient(), 66 | scheme.ParameterCodec, 67 | namespace, 68 | func() *v1.Prometheus { return &v1.Prometheus{} }, 69 | func() *v1.PrometheusList { return &v1.PrometheusList{} }), 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /prometheusoperator/typed/monitoring/v1/prometheusrule.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package v1 22 | 23 | import ( 24 | "context" 25 | 26 | v1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" 27 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 28 | types "k8s.io/apimachinery/pkg/types" 29 | watch "k8s.io/apimachinery/pkg/watch" 30 | gentype "k8s.io/client-go/gentype" 31 | scheme "kubevirt.io/client-go/prometheusoperator/scheme" 32 | ) 33 | 34 | // PrometheusRulesGetter has a method to return a PrometheusRuleInterface. 35 | // A group's client should implement this interface. 36 | type PrometheusRulesGetter interface { 37 | PrometheusRules(namespace string) PrometheusRuleInterface 38 | } 39 | 40 | // PrometheusRuleInterface has methods to work with PrometheusRule resources. 41 | type PrometheusRuleInterface interface { 42 | Create(ctx context.Context, prometheusRule *v1.PrometheusRule, opts metav1.CreateOptions) (*v1.PrometheusRule, error) 43 | Update(ctx context.Context, prometheusRule *v1.PrometheusRule, opts metav1.UpdateOptions) (*v1.PrometheusRule, error) 44 | Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error 45 | DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error 46 | Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.PrometheusRule, error) 47 | List(ctx context.Context, opts metav1.ListOptions) (*v1.PrometheusRuleList, error) 48 | Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) 49 | Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.PrometheusRule, err error) 50 | PrometheusRuleExpansion 51 | } 52 | 53 | // prometheusRules implements PrometheusRuleInterface 54 | type prometheusRules struct { 55 | *gentype.ClientWithList[*v1.PrometheusRule, *v1.PrometheusRuleList] 56 | } 57 | 58 | // newPrometheusRules returns a PrometheusRules 59 | func newPrometheusRules(c *MonitoringV1Client, namespace string) *prometheusRules { 60 | return &prometheusRules{ 61 | gentype.NewClientWithList[*v1.PrometheusRule, *v1.PrometheusRuleList]( 62 | "prometheusrules", 63 | c.RESTClient(), 64 | scheme.ParameterCodec, 65 | namespace, 66 | func() *v1.PrometheusRule { return &v1.PrometheusRule{} }, 67 | func() *v1.PrometheusRuleList { return &v1.PrometheusRuleList{} }), 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /prometheusoperator/typed/monitoring/v1/servicemonitor.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package v1 22 | 23 | import ( 24 | "context" 25 | 26 | v1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" 27 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 28 | types "k8s.io/apimachinery/pkg/types" 29 | watch "k8s.io/apimachinery/pkg/watch" 30 | gentype "k8s.io/client-go/gentype" 31 | scheme "kubevirt.io/client-go/prometheusoperator/scheme" 32 | ) 33 | 34 | // ServiceMonitorsGetter has a method to return a ServiceMonitorInterface. 35 | // A group's client should implement this interface. 36 | type ServiceMonitorsGetter interface { 37 | ServiceMonitors(namespace string) ServiceMonitorInterface 38 | } 39 | 40 | // ServiceMonitorInterface has methods to work with ServiceMonitor resources. 41 | type ServiceMonitorInterface interface { 42 | Create(ctx context.Context, serviceMonitor *v1.ServiceMonitor, opts metav1.CreateOptions) (*v1.ServiceMonitor, error) 43 | Update(ctx context.Context, serviceMonitor *v1.ServiceMonitor, opts metav1.UpdateOptions) (*v1.ServiceMonitor, error) 44 | Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error 45 | DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error 46 | Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ServiceMonitor, error) 47 | List(ctx context.Context, opts metav1.ListOptions) (*v1.ServiceMonitorList, error) 48 | Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) 49 | Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ServiceMonitor, err error) 50 | ServiceMonitorExpansion 51 | } 52 | 53 | // serviceMonitors implements ServiceMonitorInterface 54 | type serviceMonitors struct { 55 | *gentype.ClientWithList[*v1.ServiceMonitor, *v1.ServiceMonitorList] 56 | } 57 | 58 | // newServiceMonitors returns a ServiceMonitors 59 | func newServiceMonitors(c *MonitoringV1Client, namespace string) *serviceMonitors { 60 | return &serviceMonitors{ 61 | gentype.NewClientWithList[*v1.ServiceMonitor, *v1.ServiceMonitorList]( 62 | "servicemonitors", 63 | c.RESTClient(), 64 | scheme.ParameterCodec, 65 | namespace, 66 | func() *v1.ServiceMonitor { return &v1.ServiceMonitor{} }, 67 | func() *v1.ServiceMonitorList { return &v1.ServiceMonitorList{} }), 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /prometheusoperator/typed/monitoring/v1/thanosruler.go: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KubeVirt project 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 | Copyright The KubeVirt Authors. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package v1 22 | 23 | import ( 24 | "context" 25 | 26 | v1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" 27 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 28 | types "k8s.io/apimachinery/pkg/types" 29 | watch "k8s.io/apimachinery/pkg/watch" 30 | gentype "k8s.io/client-go/gentype" 31 | scheme "kubevirt.io/client-go/prometheusoperator/scheme" 32 | ) 33 | 34 | // ThanosRulersGetter has a method to return a ThanosRulerInterface. 35 | // A group's client should implement this interface. 36 | type ThanosRulersGetter interface { 37 | ThanosRulers(namespace string) ThanosRulerInterface 38 | } 39 | 40 | // ThanosRulerInterface has methods to work with ThanosRuler resources. 41 | type ThanosRulerInterface interface { 42 | Create(ctx context.Context, thanosRuler *v1.ThanosRuler, opts metav1.CreateOptions) (*v1.ThanosRuler, error) 43 | Update(ctx context.Context, thanosRuler *v1.ThanosRuler, opts metav1.UpdateOptions) (*v1.ThanosRuler, error) 44 | // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). 45 | UpdateStatus(ctx context.Context, thanosRuler *v1.ThanosRuler, opts metav1.UpdateOptions) (*v1.ThanosRuler, error) 46 | Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error 47 | DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error 48 | Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ThanosRuler, error) 49 | List(ctx context.Context, opts metav1.ListOptions) (*v1.ThanosRulerList, error) 50 | Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) 51 | Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ThanosRuler, err error) 52 | ThanosRulerExpansion 53 | } 54 | 55 | // thanosRulers implements ThanosRulerInterface 56 | type thanosRulers struct { 57 | *gentype.ClientWithList[*v1.ThanosRuler, *v1.ThanosRulerList] 58 | } 59 | 60 | // newThanosRulers returns a ThanosRulers 61 | func newThanosRulers(c *MonitoringV1Client, namespace string) *thanosRulers { 62 | return &thanosRulers{ 63 | gentype.NewClientWithList[*v1.ThanosRuler, *v1.ThanosRulerList]( 64 | "thanosrulers", 65 | c.RESTClient(), 66 | scheme.ParameterCodec, 67 | namespace, 68 | func() *v1.ThanosRuler { return &v1.ThanosRuler{} }, 69 | func() *v1.ThanosRulerList { return &v1.ThanosRulerList{} }), 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /subresources/constants.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the KubeVirt project 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 | * Copyright 2018 The KubeVirt Authors 17 | * 18 | */ 19 | 20 | package subresources 21 | 22 | // PlainStreamProtocolName is a subprotocol which indicates a plain websocket stream. 23 | // Mostly useful for browser connections which need to use the websocket subprotocol 24 | // field to pass credentials. As a consequence they need to get a subprotocol back. 25 | const PlainStreamProtocolName = "plain.kubevirt.io" 26 | -------------------------------------------------------------------------------- /testing/actions.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the KubeVirt project 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 | * Copyright The KubeVirt Authors 17 | * 18 | */ 19 | 20 | package testing 21 | 22 | import ( 23 | "k8s.io/apimachinery/pkg/runtime/schema" 24 | "k8s.io/client-go/testing" 25 | ) 26 | 27 | type PutAction[T any] interface { 28 | testing.Action 29 | GetName() string 30 | GetOptions() T 31 | } 32 | 33 | type PutActionImpl[T any] struct { 34 | testing.ActionImpl 35 | Name string 36 | Options T 37 | } 38 | 39 | func (a PutActionImpl[T]) GetName() string { 40 | return a.Name 41 | } 42 | 43 | func (a PutActionImpl[T]) GetOptions() T { 44 | return a.Options 45 | } 46 | 47 | func (a PutActionImpl[T]) DeepCopy() testing.Action { 48 | return PutActionImpl[T]{ 49 | ActionImpl: a.ActionImpl.DeepCopy().(testing.ActionImpl), 50 | Name: a.Name, 51 | Options: a.Options, 52 | } 53 | } 54 | 55 | func NewRootPutAction[T any](resource schema.GroupVersionResource, name string, options T) PutActionImpl[T] { 56 | action := PutActionImpl[T]{} 57 | action.Verb = "put" 58 | action.Resource = resource 59 | action.Name = name 60 | action.Options = options 61 | 62 | return action 63 | } 64 | 65 | func NewPutAction[T any](resource schema.GroupVersionResource, namespace, name string, options T) PutActionImpl[T] { 66 | action := PutActionImpl[T]{} 67 | action.Verb = "put" 68 | action.Resource = resource 69 | action.Namespace = namespace 70 | action.Name = name 71 | action.Options = options 72 | 73 | return action 74 | } 75 | 76 | func NewRootPutSubresourceAction[T any](resource schema.GroupVersionResource, subresource, name string, options T) PutActionImpl[T] { 77 | action := PutActionImpl[T]{} 78 | action.Verb = "put" 79 | action.Resource = resource 80 | action.Subresource = subresource 81 | action.Name = name 82 | action.Options = options 83 | 84 | return action 85 | } 86 | 87 | func NewPutSubresourceAction[T any](resource schema.GroupVersionResource, namespace, subresource, name string, options T) PutActionImpl[T] { 88 | action := PutActionImpl[T]{} 89 | action.Verb = "put" 90 | action.Resource = resource 91 | action.Subresource = subresource 92 | action.Namespace = namespace 93 | action.Name = name 94 | action.Options = options 95 | 96 | return action 97 | } 98 | -------------------------------------------------------------------------------- /testing/fake.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the KubeVirt project 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 | * Copyright The KubeVirt Authors 17 | * 18 | */ 19 | 20 | package testing 21 | 22 | import ( 23 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 24 | "k8s.io/apimachinery/pkg/runtime" 25 | "k8s.io/apiserver/pkg/storage/names" 26 | "k8s.io/client-go/testing" 27 | ) 28 | 29 | // FilterActions returns the actions which satisfy the passed verb and optionally the resource and subresource name. 30 | func FilterActions(fake *testing.Fake, verb string, resources ...string) []testing.Action { 31 | var filtered []testing.Action 32 | for _, action := range fake.Actions() { 33 | if action.GetVerb() == verb { 34 | if len(resources) > 0 && action.GetResource().Resource != resources[0] { 35 | continue 36 | } 37 | if len(resources) > 1 && action.GetSubresource() != resources[1] { 38 | continue 39 | } 40 | filtered = append(filtered, action) 41 | } 42 | } 43 | return filtered 44 | } 45 | 46 | // PrependGenerateNameCreateReactor prepends a reactor to the specified resource 47 | // that generates a name starting from the meta.generateName field. 48 | func PrependGenerateNameCreateReactor(fake *testing.Fake, resourceName string) { 49 | fake.PrependReactor("create", resourceName, func(action testing.Action) (handled bool, ret runtime.Object, err error) { 50 | ret = action.(testing.CreateAction).GetObject() 51 | meta, ok := ret.(metav1.Object) 52 | if !ok { 53 | return 54 | } 55 | 56 | if meta.GetName() == "" && meta.GetGenerateName() != "" { 57 | meta.SetName(names.SimpleNameGenerator.GenerateName(meta.GetGenerateName())) 58 | } 59 | 60 | return 61 | }) 62 | } 63 | -------------------------------------------------------------------------------- /testutils/setup.go: -------------------------------------------------------------------------------- 1 | package testutils 2 | 3 | import ( 4 | "errors" 5 | "fmt" 6 | "os" 7 | "path/filepath" 8 | "runtime" 9 | "strings" 10 | "testing" 11 | 12 | "github.com/onsi/gomega/format" 13 | 14 | . "github.com/onsi/ginkgo/v2" 15 | "github.com/onsi/ginkgo/v2/reporters" 16 | "github.com/onsi/gomega" 17 | 18 | "kubevirt.io/client-go/log" 19 | v1reporter "kubevirt.io/client-go/reporter" 20 | ) 21 | 22 | var afterSuiteReporters = []reporters.DeprecatedReporter{} 23 | 24 | // KubeVirtTestSuiteSetup is the default setup function for kubevirts unittests. 25 | // If tests are executed through bazel, the provided description is ignored. Instead 26 | // the TEST_TARGET environment variable will be used to synchronize the output 27 | // with bazels test output and make test navigation and detection consistent. 28 | func KubeVirtTestSuiteSetup(t *testing.T) { 29 | _, description, _, _ := runtime.Caller(1) 30 | projectRoot := findRoot() 31 | description = strings.TrimPrefix(description, projectRoot) 32 | // Redirect writes to ginkgo writer to keep tests quiet when 33 | // they succeed 34 | log.Log.SetIOWriter(GinkgoWriter) 35 | // setup the connection between ginkgo and gomega 36 | gomega.RegisterFailHandler(Fail) 37 | 38 | // See https://github.com/bazelbuild/rules_go/blob/197699822e081dad064835a09825448a3e4cc2a2/go/core.rst#go_test 39 | // for context. 40 | testsWrapped := os.Getenv("GO_TEST_WRAP") 41 | outputFile := os.Getenv("XML_OUTPUT_FILE") 42 | 43 | suiteConfig, _ := GinkgoConfiguration() 44 | format.TruncatedDiff = false 45 | format.MaxLength = 8192 46 | 47 | // if run on bazel (XML_OUTPUT_FILE is not empty) 48 | // and rules_go is configured to not produce the junit xml 49 | // produce it here. Otherwise just run the default RunSpec 50 | if testsWrapped == "0" && outputFile != "" { 51 | testTarget := os.Getenv("TEST_TARGET") 52 | if suiteConfig.ParallelTotal > 1 { 53 | outputFile = fmt.Sprintf("%s-%d", outputFile, GinkgoParallelProcess()) 54 | } 55 | 56 | afterSuiteReporters = append(afterSuiteReporters, v1reporter.NewV1JUnitReporter(outputFile)) 57 | 58 | RunSpecs(t, testTarget) 59 | } else { 60 | RunSpecs(t, description) 61 | } 62 | } 63 | 64 | func findRoot() string { 65 | _, current, _, _ := runtime.Caller(0) 66 | for { 67 | current = filepath.Dir(current) 68 | if current == "/" || current == "." { 69 | return current 70 | } 71 | if _, err := os.Stat(filepath.Join(current, "WORKSPACE")); err == nil { 72 | return strings.TrimSuffix(current, "/") + "/" 73 | } else if errors.Is(err, os.ErrNotExist) { 74 | continue 75 | } else if err != nil { 76 | panic(err) 77 | } 78 | } 79 | } 80 | 81 | var _ = ReportAfterSuite("KubeVirtTest", func(report Report) { 82 | for _, reporter := range afterSuiteReporters { 83 | reporters.ReportViaDeprecatedReporter(reporter, report) 84 | } 85 | }) 86 | -------------------------------------------------------------------------------- /util/util.go: -------------------------------------------------------------------------------- 1 | package util 2 | 3 | import ( 4 | "errors" 5 | "fmt" 6 | "os" 7 | "strings" 8 | ) 9 | 10 | const ServiceAccountNamespaceFile = "/var/run/secrets/kubernetes.io/serviceaccount/namespace" 11 | const namespaceKubevirt = "kubevirt" 12 | 13 | func GetNamespace() (string, error) { 14 | if data, err := os.ReadFile(ServiceAccountNamespaceFile); err == nil { 15 | if ns := strings.TrimSpace(string(data)); len(ns) > 0 { 16 | return ns, nil 17 | } 18 | } else if !errors.Is(err, os.ErrNotExist) { 19 | return "", fmt.Errorf("failed to determine namespace from %s: %v", ServiceAccountNamespaceFile, err) 20 | } 21 | return namespaceKubevirt, nil 22 | } 23 | -------------------------------------------------------------------------------- /version/base.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the KubeVirt project 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 | * Copyright 2018 Red Hat, Inc. 17 | * 18 | */ 19 | 20 | package version 21 | 22 | var ( 23 | gitVersion = "v0.0.0-master+$Format:%h$" 24 | gitCommit = "$Format:%H$" // sha1 from git, output of $(git rev-parse HEAD) 25 | gitTreeState = "" // state of git tree, either "clean" or "dirty" 26 | 27 | buildDate = "1970-01-01T00:00:00Z" // build date in ISO8601 format, output of $(date -u +'%Y-%m-%dT%H:%M:%SZ') 28 | ) 29 | -------------------------------------------------------------------------------- /version/def.bzl: -------------------------------------------------------------------------------- 1 | # Copyright 2017 The Kubernetes Authors. 2 | # 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 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Implements hack/version.sh's kube::version::ldflags() for Bazel. 16 | def version_x_defs(): 17 | # This should match the list of packages in kube::version::ldflag 18 | stamp_pkgs = [ 19 | "kubevirt.io/client-go/version", 20 | ] 21 | 22 | # This should match the list of vars in kube::version::ldflags 23 | # It should also match the list of vars set in hack/print-workspace-status.sh. 24 | stamp_vars = [ 25 | "buildDate", 26 | "gitCommit", 27 | "gitTreeState", 28 | "gitVersion", 29 | ] 30 | 31 | # Generate the cross-product. 32 | x_defs = {} 33 | for pkg in stamp_pkgs: 34 | for var in stamp_vars: 35 | x_defs["%s.%s" % (pkg, var)] = "{%s}" % var 36 | return x_defs 37 | -------------------------------------------------------------------------------- /version/types.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the KubeVirt project 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 | * Copyright 2018 Red Hat, Inc. 17 | * 18 | */ 19 | package version 20 | 21 | type Info struct { 22 | GitVersion string `json:"gitVersion"` 23 | GitCommit string `json:"gitCommit"` 24 | GitTreeState string `json:"gitTreeState"` 25 | BuildDate string `json:"buildDate"` 26 | GoVersion string `json:"goVersion"` 27 | Compiler string `json:"compiler"` 28 | Platform string `json:"platform"` 29 | } 30 | 31 | // String returns info as a human-friendly version string. 32 | func (info Info) String() string { 33 | return info.GitVersion 34 | } 35 | -------------------------------------------------------------------------------- /version/version.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the KubeVirt project 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 | * Copyright 2018 Red Hat, Inc. 17 | * 18 | */ 19 | 20 | package version 21 | 22 | import ( 23 | "fmt" 24 | "runtime" 25 | 26 | "bytes" 27 | "encoding/json" 28 | ) 29 | 30 | func Get() Info { 31 | return Info{ 32 | GitVersion: gitVersion, 33 | GitCommit: gitCommit, 34 | GitTreeState: gitTreeState, 35 | BuildDate: buildDate, 36 | GoVersion: runtime.Version(), 37 | Compiler: runtime.Compiler, 38 | Platform: fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH), 39 | } 40 | } 41 | 42 | func GetCompactJSON() (string, error) { 43 | v, err := json.Marshal(Get()) 44 | if err != nil { 45 | return "", err 46 | } 47 | compactedBuffer := new(bytes.Buffer) 48 | err = json.Compact(compactedBuffer, []byte(v)) 49 | if err != nil { 50 | return "", err 51 | } 52 | return compactedBuffer.String(), nil 53 | } 54 | --------------------------------------------------------------------------------