forked from kubevirt/kubevirt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kubevirt.go
75 lines (64 loc) · 2.4 KB
/
kubevirt.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
* This file is part of the KubeVirt project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Copyright 2017 Red Hat, Inc.
*
*/
package kubecli
//go:generate mockgen -source $GOFILE -package=$GOPACKAGE -destination=generated_mock_$GOFILE
/*
ATTENTION: Rerun code generators when interface signatures are modified.
*/
import (
k8smetav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"kubevirt.io/kubevirt/pkg/api/v1"
)
type KubevirtClient interface {
VM(namespace string) VMInterface
Migration(namespace string) MigrationInterface
ReplicaSet(namespace string) ReplicaSetInterface
RestClient() *rest.RESTClient
kubernetes.Interface
}
type kubevirt struct {
restClient *rest.RESTClient
*kubernetes.Clientset
}
func (k kubevirt) RestClient() *rest.RESTClient {
return k.restClient
}
type VMInterface interface {
Get(name string, options k8smetav1.GetOptions) (*v1.VirtualMachine, error)
List(opts k8smetav1.ListOptions) (*v1.VirtualMachineList, error)
Create(*v1.VirtualMachine) (*v1.VirtualMachine, error)
Update(*v1.VirtualMachine) (*v1.VirtualMachine, error)
Delete(name string, options *k8smetav1.DeleteOptions) error
}
type ReplicaSetInterface interface {
Get(name string, options k8smetav1.GetOptions) (*v1.VirtualMachineReplicaSet, error)
List(opts k8smetav1.ListOptions) (*v1.VirtualMachineReplicaSetList, error)
Create(*v1.VirtualMachineReplicaSet) (*v1.VirtualMachineReplicaSet, error)
Update(*v1.VirtualMachineReplicaSet) (*v1.VirtualMachineReplicaSet, error)
Delete(name string, options *k8smetav1.DeleteOptions) error
}
type MigrationInterface interface {
Get(name string, options k8smetav1.GetOptions) (*v1.Migration, error)
List(opts k8smetav1.ListOptions) (*v1.MigrationList, error)
Create(*v1.Migration) (*v1.Migration, error)
Update(*v1.Migration) (*v1.Migration, error)
Delete(name string, options *k8smetav1.DeleteOptions) error
}