diff --git a/pkg/cstor/api_service.go b/pkg/cstor/api_service.go new file mode 100644 index 00000000..94cddfb2 --- /dev/null +++ b/pkg/cstor/api_service.go @@ -0,0 +1,118 @@ +/* +Copyright 2019 The OpenEBS Authors. + +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. +*/ + +package cstor + +import ( + "bytes" + "io/ioutil" + "net/http" + "strconv" + "time" + + "github.com/pkg/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// httpRestCall execute REST API over HTTP +func (p *Plugin) httpRestCall(url, reqtype string, data []byte) ([]byte, error) { + req, err := http.NewRequest(reqtype, url, bytes.NewBuffer(data)) + if err != nil { + return nil, err + } + req.Header.Add("Content-Type", "application/json") + + c := &http.Client{ + Timeout: 60 * time.Second, + } + + resp, err := c.Do(req) + if err != nil { + return nil, errors.Errorf("Error when connecting to maya-apiserver : %s", err.Error()) + } + + defer func() { + if err := resp.Body.Close(); err != nil { + p.Log.Warnf("Failed to close response : %s", err.Error()) + } + }() + + respdata, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, errors.Errorf("Unable to read response from maya-apiserver : %s", err.Error()) + } + + code := resp.StatusCode + if code != http.StatusOK { + return nil, errors.Errorf("Status error{%v}", http.StatusText(code)) + } + return respdata, nil +} + +// getMapiAddr return maya API server's ip address +func (p *Plugin) getMapiAddr() string { + var openebsNs string + + // check if user has provided openebs namespace + if p.namespace != "" { + openebsNs = p.namespace + } else { + openebsNs = metav1.NamespaceAll + } + + svclist, err := p.K8sClient. + CoreV1(). + Services(openebsNs). + List( + metav1.ListOptions{ + LabelSelector: mayaAPIServiceLabel, + }, + ) + + if err != nil { + p.Log.Errorf("Error getting maya-apiservice : %v", err.Error()) + return "" + } + + if len(svclist.Items) != 0 { + goto fetchip + } + + // There are no any services having MayaApiService Label + // Let's try to find by name only.. + svclist, err = p.K8sClient. + CoreV1(). + Services(openebsNs). + List( + metav1.ListOptions{ + FieldSelector: "metadata.name=" + mayaAPIServiceName, + }) + if err != nil { + p.Log.Errorf("Error getting IP Address for service{%s} : %v", mayaAPIServiceName, err.Error()) + return "" + } + +fetchip: + for _, s := range svclist.Items { + if len(s.Spec.ClusterIP) != 0 { + // update the namespace + p.namespace = s.Namespace + return "http://" + s.Spec.ClusterIP + ":" + strconv.FormatInt(int64(s.Spec.Ports[0].Port), 10) + } + } + + return "" +} diff --git a/pkg/cstor/cstor.go b/pkg/cstor/cstor.go index ed034201..8dc1dda4 100644 --- a/pkg/cstor/cstor.go +++ b/pkg/cstor/cstor.go @@ -17,7 +17,6 @@ limitations under the License. package cstor import ( - "bytes" "encoding/json" "io/ioutil" "net" @@ -33,13 +32,14 @@ import ( * dependency manually instead of using dep */ v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + openebs "github.com/openebs/maya/pkg/client/generated/clientset/versioned" "github.com/sirupsen/logrus" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/kubernetes" - corev1 "k8s.io/client-go/kubernetes/typed/core/v1" + k8client "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" ) @@ -65,7 +65,10 @@ type Plugin struct { Log logrus.FieldLogger // K8sClient is used for kubernetes CR operation - K8sClient corev1.CoreV1Interface + K8sClient *k8client.Clientset + + // OpenEBSClient is used for openEBS CR operation + OpenEBSClient *openebs.Clientset // config to store parameters from velero server config map[string]string @@ -142,55 +145,6 @@ func (p *Plugin) getServerAddress() string { return "" } -// getMapiAddr return maya API server's ip address -func (p *Plugin) getMapiAddr() string { - var openebsNs string - - // check if user has provided openebs namespace - if p.namespace != "" { - openebsNs = p.namespace - } else { - openebsNs = metav1.NamespaceAll - } - - sclist, err := p.K8sClient.Services(openebsNs).List( - metav1.ListOptions{ - LabelSelector: mayaAPIServiceLabel, - }, - ) - - if err != nil { - p.Log.Errorf("Error getting maya-apiservice : %v", err.Error()) - return "" - } - - if len(sclist.Items) != 0 { - goto fetchip - } - - // There are no any services having MayaApiService Label - // Let's try to find by name only.. - sclist, err = p.K8sClient.Services(openebsNs).List( - metav1.ListOptions{ - FieldSelector: "metadata.name=" + mayaAPIServiceName, - }) - if err != nil { - p.Log.Errorf("Error getting IP Address for service{%s} : %v", mayaAPIServiceName, err.Error()) - return "" - } - -fetchip: - for _, s := range sclist.Items { - if len(s.Spec.ClusterIP) != 0 { - // update the namespace - p.namespace = s.Namespace - return "http://" + s.Spec.ClusterIP + ":" + strconv.FormatInt(int64(s.Spec.Ports[0].Port), 10) - } - } - - return "" -} - // Init CStor snapshot plugin func (p *Plugin) Init(config map[string]string) error { if ns, ok := config[NAMESPACE]; ok { @@ -209,7 +163,15 @@ func (p *Plugin) Init(config map[string]string) error { return errors.New("Error creating k8s client") } - p.K8sClient = clientset.CoreV1() + p.K8sClient = clientset + + openEBSClient, err := openebs.NewForConfig(conf) + if err != nil { + p.Log.Errorf("Failed to create openEBS client. %s", err) + return err + } + p.OpenEBSClient = openEBSClient + p.mayaAddr = p.getMapiAddr() if p.mayaAddr == "" { return errors.New("Error fetching OpenEBS rest client address") @@ -217,7 +179,7 @@ func (p *Plugin) Init(config map[string]string) error { p.cstorServerAddr = p.getServerAddress() if p.cstorServerAddr == "" { - return errors.New("Error fetch cstorVeleroServer address") + return errors.New("Error fetching cstorVeleroServer address") } p.config = config if p.volumes == nil { @@ -257,6 +219,11 @@ func (p *Plugin) GetVolumeID(unstructuredPV runtime.Unstructured) (string, error return "", nil } + if pv.Status.Phase == v1.VolumeReleased || + pv.Status.Phase == v1.VolumeFailed { + return "", errors.New("PV is in released state") + } + if _, exists := p.volumes[pv.Name]; !exists { p.volumes[pv.Name] = &Volume{ volname: pv.Name, @@ -361,7 +328,7 @@ func (p *Plugin) CreateSnapshot(volumeID, volumeAZ string, tags map[string]strin vol.backupName = bkpname err := p.backupPVC(volumeID) if err != nil { - return "", errors.New("failed to create backup for PVC") + return "", errors.Errorf("failed to create backup for PVC.. %s", err) } p.Log.Infof("creating snapshot{%s}", bkpname) @@ -375,7 +342,7 @@ func (p *Plugin) CreateSnapshot(volumeID, volumeAZ string, tags map[string]strin } if len(strings.TrimSpace(bkpname)) == 0 { - return "", errors.New("No bkpname") + return "", errors.New("Missing bkpname") } bkpSpec := &v1alpha1.CStorBackupSpec{ @@ -429,7 +396,10 @@ func (p *Plugin) getSnapInfo(snapshotID string) (*Snapshot, error) { volumeID := s[0] bkpName := s[1] - pv, err := p.K8sClient.PersistentVolumes().Get(snapshotID, metav1.GetOptions{}) + pv, err := p.K8sClient. + CoreV1(). + PersistentVolumes(). + Get(snapshotID, metav1.GetOptions{}) if err != nil { return nil, errors.Errorf("Error fetching namespaces for volume{%s} : %s", volumeID, err.Error()) } @@ -461,7 +431,7 @@ func (p *Plugin) CreateVolumeFromSnapshot(snapshotID, volumeType, volumeAZ strin newVol, e := p.createPVC(volumeID, snapName) if e != nil { - return "", errors.Errorf("Failed to restore PVC") + return "", errors.Errorf("Failed to restore PVC.. %s", e) } p.Log.Infof("New volume(%v) created", newVol) @@ -519,104 +489,6 @@ func (p *Plugin) GetVolumeInfo(volumeID, volumeAZ string) (string, *int64, error return "cstor-snapshot", nil, nil } -// createPVC create PVC for given volume name -func (p *Plugin) createPVC(volumeID, snapName string) (*Volume, error) { - var pvc v1.PersistentVolumeClaim - var data []byte - var ok bool - - filename := p.cl.GenerateRemoteFilename(volumeID, snapName) - if filename == "" { - return nil, errors.New("Error creating remote file name for pvc backup") - } - - if data, ok = p.cl.Read(filename + ".pvc"); !ok { - return nil, errors.New("Failed to download PVC") - } - - if err := json.Unmarshal(data, &pvc); err != nil { - return nil, errors.New("Failed to decode pvc") - } - - newVol, err := p.getVolumeFromPVC(pvc) - if err == nil { - newVol.backupName = snapName - return newVol, nil - } - - pvc.Annotations = make(map[string]string) - pvc.Annotations["openebs.io/created-through"] = "restore" - rpvc, er := p.K8sClient.PersistentVolumeClaims(pvc.Namespace).Create(&pvc) - if er != nil { - return nil, errors.Errorf("Failed to create PVC : %s", er.Error()) - } - - for { - pvc, er := p.K8sClient.PersistentVolumeClaims(rpvc.Namespace).Get(rpvc.Name, metav1.GetOptions{}) - if er != nil || pvc.Status.Phase == v1.ClaimLost { - if err := p.K8sClient.PersistentVolumeClaims(pvc.Namespace).Delete(rpvc.Name, nil); err != nil { - p.Log.Warnf("Failed to delete pvc {%s} : %s", rpvc.Name, err.Error()) - } - return nil, errors.Errorf("Failed to create PVC : %s", er.Error()) - } - if pvc.Status.Phase == v1.ClaimBound { - p.Log.Infof("PVC(%v) created..", pvc.Name) - return &Volume{ - volname: pvc.Spec.VolumeName, - namespace: pvc.Namespace, - backupName: snapName, - casType: *pvc.Spec.StorageClassName, - }, nil - } - } -} - -// backupPVC perform backup for given volume's PVC -func (p *Plugin) backupPVC(volumeID string) error { - vol := p.volumes[volumeID] - var bkpPvc *v1.PersistentVolumeClaim - - pvcs, err := p.K8sClient.PersistentVolumeClaims(vol.namespace).List(metav1.ListOptions{}) - if err != nil { - p.Log.Errorf("Error fetching PVC list : %s", err.Error()) - return errors.New("Failed to fetch PVC list") - } - - for _, pvc := range pvcs.Items { - if pvc.Spec.VolumeName == vol.volname { - bkpPvc = &pvc - break - } - } - - if bkpPvc == nil { - p.Log.Errorf("Failed to find PVC for PV{%s}", vol.volname) - return errors.Errorf("Failed to find PVC for volume{%s}", vol.volname) - } - - bkpPvc.ResourceVersion = "" - bkpPvc.SelfLink = "" - bkpPvc.Annotations = nil - bkpPvc.UID = "" - bkpPvc.Spec.VolumeName = "" - - data, err := json.MarshalIndent(bkpPvc, "", "\t") - if err != nil { - return errors.New("Error doing json parsing") - } - - filename := p.cl.GenerateRemoteFilename(vol.volname, vol.backupName) - if filename == "" { - return errors.New("Error creating remote file name for pvc backup") - } - - if ok := p.cl.Write(data, filename+".pvc"); !ok { - return errors.New("Failed to upload PVC") - } - - return nil -} - // SetVolumeID set volumeID for given PV func (p *Plugin) SetVolumeID(unstructuredPV runtime.Unstructured, volumeID string) (runtime.Unstructured, error) { pv := new(v1.PersistentVolume) @@ -634,139 +506,3 @@ func (p *Plugin) SetVolumeID(unstructuredPV runtime.Unstructured, volumeID strin return &unstructured.Unstructured{Object: res}, nil } - -// httpRestCall execute REST API -func (p *Plugin) httpRestCall(url, reqtype string, data []byte) ([]byte, error) { - req, err := http.NewRequest(reqtype, url, bytes.NewBuffer(data)) - if err != nil { - return nil, err - } - req.Header.Add("Content-Type", "application/json") - - c := &http.Client{ - Timeout: 60 * time.Second, - } - - resp, err := c.Do(req) - if err != nil { - return nil, errors.Errorf("Error when connecting to maya-apiserver : %s", err.Error()) - } - - defer func() { - if err := resp.Body.Close(); err != nil { - p.Log.Warnf("Failed to close response : %s", err.Error()) - } - }() - - respdata, err := ioutil.ReadAll(resp.Body) - if err != nil { - return nil, errors.Errorf("Unable to read response from maya-apiserver : %s", err.Error()) - } - - code := resp.StatusCode - if code != http.StatusOK { - return nil, errors.Errorf("Status error{%v}", http.StatusText(code)) - } - return respdata, nil -} - -// getVolumeFromPVC returns volume info for given PVC if PVC is in bound state -func (p *Plugin) getVolumeFromPVC(pvc v1.PersistentVolumeClaim) (*Volume, error) { - rpvc, err := p.K8sClient.PersistentVolumeClaims(pvc.Namespace).Get(pvc.Name, metav1.GetOptions{}) - if err != nil { - return nil, errors.Errorf("PVC{%s} does not exist", pvc.Name) - } - - if rpvc.Status.Phase == v1.ClaimLost { - p.Log.Errorf("PVC{%s} is not bound yet!", rpvc.Name) - panic(errors.Errorf("PVC{%s} is not bound yet", rpvc.Name)) - } else { - return &Volume{ - volname: rpvc.Spec.VolumeName, - namespace: rpvc.Namespace, - casType: *rpvc.Spec.StorageClassName, - }, nil - } -} - -// checkBackupStatus queries MayaAPI server for given backup status -// and wait until backup completes -func (p *Plugin) checkBackupStatus(bkp *v1alpha1.CStorBackup) { - var bkpdone bool - url := p.mayaAddr + backupEndpoint - bkpvolume, exists := p.volumes[bkp.Spec.VolumeName] - - if !exists { - p.Log.Errorf("Failed to fetch volume info for {%s}", bkp.Spec.VolumeName) - panic(errors.Errorf("Failed to fetch volume info for {%s}", bkp.Spec.VolumeName)) - } - - bkpData, err := json.Marshal(bkp) - if err != nil { - p.Log.Errorf("JSON marshal failed : %s", err.Error()) - panic(errors.Errorf("JSON marshal failed : %s", err.Error())) - } - - for !bkpdone { - time.Sleep(backupStatusInterval * time.Second) - var bs v1alpha1.CStorBackup - - resp, err := p.httpRestCall(url, "GET", bkpData) - if err != nil { - p.Log.Warnf("Failed to fetch backup status : %s", err.Error()) - continue - } - - err = json.Unmarshal(resp, &bs) - if err != nil { - p.Log.Warnf("Unmarshal failed : %s", err.Error()) - continue - } - - bkpvolume.backupStatus = bs.Status - - switch bs.Status { - case v1alpha1.BKPCStorStatusDone, v1alpha1.BKPCStorStatusFailed, v1alpha1.BKPCStorStatusInvalid: - bkpdone = true - p.cl.ExitServer = true - } - } -} - -// checkRestoreStatus queries MayaAPI server for given restore status -// and wait until restore completes -func (p *Plugin) checkRestoreStatus(rst *v1alpha1.CStorRestore, vol *Volume) { - var rstdone bool - url := p.mayaAddr + restorePath - - rstData, err := json.Marshal(rst) - if err != nil { - p.Log.Errorf("JSON marshal failed : %s", err.Error()) - panic(errors.Errorf("JSON marshal failed : %s", err.Error())) - } - - for !rstdone { - time.Sleep(restoreStatusInterval * time.Second) - var rs v1alpha1.CStorRestore - - resp, err := p.httpRestCall(url, "GET", rstData) - if err != nil { - p.Log.Warnf("Failed to fetch backup status : %s", err.Error()) - continue - } - - err = json.Unmarshal(resp, &rs.Status) - if err != nil { - p.Log.Warnf("Unmarshal failed : %s", err.Error()) - continue - } - - vol.restoreStatus = rs.Status - - switch rs.Status { - case v1alpha1.RSTCStorStatusDone, v1alpha1.RSTCStorStatusFailed, v1alpha1.RSTCStorStatusInvalid: - rstdone = true - p.cl.ExitServer = true - } - } -} diff --git a/pkg/cstor/cvr_operation.go b/pkg/cstor/cvr_operation.go new file mode 100644 index 00000000..00445253 --- /dev/null +++ b/pkg/cstor/cvr_operation.go @@ -0,0 +1,86 @@ +/* +Copyright 2019 The OpenEBS Authors. + +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. +*/ + +package cstor + +import ( + "time" + + "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + "github.com/pkg/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// CVRWaitCount control time limit for waitForAllCVR +var CVRWaitCount = 100 + +// CVRCheckInterval defines amount of delay for CVR check +var CVRCheckInterval = 5 * time.Second + +// waitForAllCVR will ensure that all CVR related to +// given volumes are created +func (p *Plugin) waitForAllCVR(vol *Volume) error { + replicaCount := p.getCVRCount(vol.volname) + if replicaCount == -1 { + return errors.Errorf("Failed to fetch replicaCount for volume{%s}", vol.volname) + } + + for cnt := 0; cnt < CVRWaitCount; cnt++ { + cvrList, err := p.OpenEBSClient. + OpenebsV1alpha1(). + CStorVolumeReplicas(p.namespace). + List(metav1.ListOptions{ + LabelSelector: "openebs.io/persistent-volume=" + vol.volname, + }) + if err != nil { + return errors.Errorf("Failed to fetch CVR.. %s", err) + } + + if len(cvrList.Items) != replicaCount { + time.Sleep(CVRCheckInterval) + continue + } + + cvrCount := 0 + for _, cvr := range cvrList.Items { + if cvr.Status.Phase == v1alpha1.CVRStatusOnline || + cvr.Status.Phase == v1alpha1.CVRStatusError || + cvr.Status.Phase == v1alpha1.CVRStatusDegraded { + cvrCount++ + } + } + if cvrCount == replicaCount { + return nil + } + time.Sleep(CVRCheckInterval) + } + + return errors.Errorf("CVR for volume{%s} are not ready!", vol.volname) +} + +// getCVRCount returns the number of CVR for given volume +func (p *Plugin) getCVRCount(volname string) int { + obj, err := p.OpenEBSClient. + OpenebsV1alpha1(). + CStorVolumes(p.namespace). + Get(volname, metav1.GetOptions{}) + if err != nil { + p.Log.Errorf("Failed to fetch cstorVolume.. %s", err) + return -1 + } + + return obj.Spec.ReplicationFactor +} diff --git a/pkg/cstor/pvc_operation.go b/pkg/cstor/pvc_operation.go new file mode 100644 index 00000000..5e11114f --- /dev/null +++ b/pkg/cstor/pvc_operation.go @@ -0,0 +1,181 @@ +/* +Copyright 2019 The OpenEBS Authors. + +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. +*/ + +package cstor + +import ( + "encoding/json" + "time" + + "github.com/pkg/errors" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// PVCWaitCount control time limit for createPVC +var PVCWaitCount = 100 + +// PVCCheckInterval defines amount of delay for PVC bound check +var PVCCheckInterval = 5 * time.Second + +// backupPVC perform backup for given volume's PVC +func (p *Plugin) backupPVC(volumeID string) error { + vol := p.volumes[volumeID] + var bkpPvc *v1.PersistentVolumeClaim + + pvcs, err := p.K8sClient. + CoreV1(). + PersistentVolumeClaims(vol.namespace). + List(metav1.ListOptions{}) + if err != nil { + p.Log.Errorf("Error fetching PVC list : %s", err.Error()) + return errors.New("Failed to fetch PVC list") + } + + for _, pvc := range pvcs.Items { + if pvc.Spec.VolumeName == vol.volname { + bkpPvc = &pvc + break + } + } + + if bkpPvc == nil { + p.Log.Errorf("Failed to find PVC for PV{%s}", vol.volname) + return errors.Errorf("Failed to find PVC for volume{%s}", vol.volname) + } + + bkpPvc.ResourceVersion = "" + bkpPvc.SelfLink = "" + bkpPvc.Annotations = nil + bkpPvc.UID = "" + bkpPvc.Spec.VolumeName = "" + + data, err := json.MarshalIndent(bkpPvc, "", "\t") + if err != nil { + return errors.New("Error doing json parsing") + } + + filename := p.cl.GenerateRemoteFilename(vol.volname, vol.backupName) + if filename == "" { + return errors.New("Error creating remote file name for pvc backup") + } + + if ok := p.cl.Write(data, filename+".pvc"); !ok { + return errors.New("Failed to upload PVC") + } + + return nil +} + +// createPVC create PVC for given volume name +func (p *Plugin) createPVC(volumeID, snapName string) (*Volume, error) { + pvc := &v1.PersistentVolumeClaim{} + var vol *Volume + var data []byte + var ok bool + + filename := p.cl.GenerateRemoteFilename(volumeID, snapName) + if filename == "" { + return nil, errors.New("Error creating remote file name for pvc backup") + } + + if data, ok = p.cl.Read(filename + ".pvc"); !ok { + return nil, errors.New("Failed to download PVC") + } + + if err := json.Unmarshal(data, pvc); err != nil { + return nil, errors.New("Failed to decode pvc") + } + + newVol, err := p.getVolumeFromPVC(*pvc) + if err == nil { + newVol.backupName = snapName + return newVol, nil + } + + pvc.Annotations = make(map[string]string) + pvc.Annotations["openebs.io/created-through"] = "restore" + rpvc, err := p.K8sClient. + CoreV1(). + PersistentVolumeClaims(pvc.Namespace). + Create(pvc) + if err != nil { + return nil, errors.Errorf("Failed to create PVC : %s", err.Error()) + } + + for cnt := 0; cnt < PVCWaitCount; cnt++ { + pvc, err = p.K8sClient. + CoreV1(). + PersistentVolumeClaims(rpvc.Namespace). + Get(rpvc.Name, metav1.GetOptions{}) + if err != nil || pvc.Status.Phase == v1.ClaimLost { + if err := p.K8sClient. + CoreV1(). + PersistentVolumeClaims(pvc.Namespace). + Delete(rpvc.Name, nil); err != nil { + p.Log.Warnf("Failed to delete pvc {%s} : %s", rpvc.Name, err.Error()) + } + return nil, errors.Errorf("Failed to create PVC : %s", err.Error()) + } + if pvc.Status.Phase == v1.ClaimBound { + p.Log.Infof("PVC(%v) created..", pvc.Name) + vol = &Volume{ + volname: pvc.Spec.VolumeName, + namespace: pvc.Namespace, + backupName: snapName, + casType: *pvc.Spec.StorageClassName, + } + break + } + time.Sleep(PVCCheckInterval) + } + + if vol == nil { + return nil, errors.Errorf("PVC{%s} is not bounded!", rpvc.Name) + } + + if err = p.waitForAllCVR(vol); err != nil { + return nil, err + } + return vol, nil +} + +// getVolumeFromPVC returns volume info for given PVC if PVC is in bound state +func (p *Plugin) getVolumeFromPVC(pvc v1.PersistentVolumeClaim) (*Volume, error) { + rpvc, err := p.K8sClient. + CoreV1(). + PersistentVolumeClaims(pvc.Namespace). + Get(pvc.Name, metav1.GetOptions{}) + if err != nil { + return nil, errors.Errorf("PVC{%s} does not exist", pvc.Name) + } + + if rpvc.Status.Phase == v1.ClaimLost { + p.Log.Errorf("PVC{%s} is not bound yet!", rpvc.Name) + panic(errors.Errorf("PVC{%s} is not bound yet", rpvc.Name)) + } else { + vol := &Volume{ + volname: rpvc.Spec.VolumeName, + namespace: rpvc.Namespace, + casType: *rpvc.Spec.StorageClassName, + } + + if err = p.waitForAllCVR(vol); err != nil { + return nil, err + } + return vol, nil + } +} diff --git a/pkg/cstor/status.go b/pkg/cstor/status.go new file mode 100644 index 00000000..f5b00e32 --- /dev/null +++ b/pkg/cstor/status.go @@ -0,0 +1,109 @@ +/* +Copyright 2019 The OpenEBS Authors. + +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. +*/ + +package cstor + +import ( + "encoding/json" + "time" + + "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + "github.com/pkg/errors" +) + +// checkBackupStatus queries MayaAPI server for given backup status +// and wait until backup completes +func (p *Plugin) checkBackupStatus(bkp *v1alpha1.CStorBackup) { + var bkpDone bool + + url := p.mayaAddr + backupEndpoint + + bkpvolume, exists := p.volumes[bkp.Spec.VolumeName] + if !exists { + p.Log.Errorf("Failed to fetch volume info for {%s}", bkp.Spec.VolumeName) + panic(errors.Errorf("Failed to fetch volume info for {%s}", bkp.Spec.VolumeName)) + } + + bkpData, err := json.Marshal(bkp) + if err != nil { + p.Log.Errorf("JSON marshal failed : %s", err.Error()) + panic(errors.Errorf("JSON marshal failed : %s", err.Error())) + } + + for !bkpDone { + var bs v1alpha1.CStorBackup + + time.Sleep(backupStatusInterval * time.Second) + resp, err := p.httpRestCall(url, "GET", bkpData) + if err != nil { + p.Log.Warnf("Failed to fetch backup status : %s", err.Error()) + continue + } + + err = json.Unmarshal(resp, &bs) + if err != nil { + p.Log.Warnf("Unmarshal failed : %s", err.Error()) + continue + } + + bkpvolume.backupStatus = bs.Status + + switch bs.Status { + case v1alpha1.BKPCStorStatusDone, v1alpha1.BKPCStorStatusFailed, v1alpha1.BKPCStorStatusInvalid: + bkpDone = true + p.cl.ExitServer = true + } + } +} + +// checkRestoreStatus queries MayaAPI server for given restore status +// and wait until restore completes +func (p *Plugin) checkRestoreStatus(rst *v1alpha1.CStorRestore, vol *Volume) { + var rstDone bool + + url := p.mayaAddr + restorePath + + rstData, err := json.Marshal(rst) + if err != nil { + p.Log.Errorf("JSON marshal failed : %s", err.Error()) + panic(errors.Errorf("JSON marshal failed : %s", err.Error())) + } + + for !rstDone { + var rs v1alpha1.CStorRestore + + time.Sleep(restoreStatusInterval * time.Second) + resp, err := p.httpRestCall(url, "GET", rstData) + if err != nil { + p.Log.Warnf("Failed to fetch backup status : %s", err.Error()) + continue + } + + err = json.Unmarshal(resp, &rs.Status) + if err != nil { + p.Log.Warnf("Unmarshal failed : %s", err.Error()) + continue + } + + vol.restoreStatus = rs.Status + + switch rs.Status { + case v1alpha1.RSTCStorStatusDone, v1alpha1.RSTCStorStatusFailed, v1alpha1.RSTCStorStatusInvalid: + rstDone = true + p.cl.ExitServer = true + } + } +} diff --git a/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/clientset.go b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/clientset.go new file mode 100644 index 00000000..a0c45879 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/clientset.go @@ -0,0 +1,98 @@ +/* +Copyright 2019 The OpenEBS Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package versioned + +import ( + openebsv1alpha1 "github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1" + discovery "k8s.io/client-go/discovery" + rest "k8s.io/client-go/rest" + flowcontrol "k8s.io/client-go/util/flowcontrol" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + OpenebsV1alpha1() openebsv1alpha1.OpenebsV1alpha1Interface + // Deprecated: please explicitly pick a version if possible. + Openebs() openebsv1alpha1.OpenebsV1alpha1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + openebsV1alpha1 *openebsv1alpha1.OpenebsV1alpha1Client +} + +// OpenebsV1alpha1 retrieves the OpenebsV1alpha1Client +func (c *Clientset) OpenebsV1alpha1() openebsv1alpha1.OpenebsV1alpha1Interface { + return c.openebsV1alpha1 +} + +// Deprecated: Openebs retrieves the default version of OpenebsClient. +// Please explicitly pick a version. +func (c *Clientset) Openebs() openebsv1alpha1.OpenebsV1alpha1Interface { + return c.openebsV1alpha1 +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + if c == nil { + return nil + } + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *rest.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var cs Clientset + var err error + cs.openebsV1alpha1, err = openebsv1alpha1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + return &cs, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *Clientset { + var cs Clientset + cs.openebsV1alpha1 = openebsv1alpha1.NewForConfigOrDie(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &cs +} + +// New creates a new Clientset for the given RESTClient. +func New(c rest.Interface) *Clientset { + var cs Clientset + cs.openebsV1alpha1 = openebsv1alpha1.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/doc.go b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/doc.go new file mode 100644 index 00000000..32493846 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2019 The OpenEBS Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated clientset. +package versioned diff --git a/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/fake/clientset_generated.go b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/fake/clientset_generated.go new file mode 100644 index 00000000..56262feb --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/fake/clientset_generated.go @@ -0,0 +1,82 @@ +/* +Copyright 2019 The OpenEBS Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + clientset "github.com/openebs/maya/pkg/client/generated/clientset/versioned" + openebsv1alpha1 "github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1" + fakeopenebsv1alpha1 "github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/discovery" + fakediscovery "k8s.io/client-go/discovery/fake" + "k8s.io/client-go/testing" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + cs := &Clientset{} + cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} + cs.AddReactor("*", "*", testing.ObjectReaction(o)) + cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { + gvr := action.GetResource() + ns := action.GetNamespace() + watch, err := o.Watch(gvr, ns) + if err != nil { + return false, nil, err + } + return true, watch, nil + }) + + return cs +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + testing.Fake + discovery *fakediscovery.FakeDiscovery +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.discovery +} + +var _ clientset.Interface = &Clientset{} + +// OpenebsV1alpha1 retrieves the OpenebsV1alpha1Client +func (c *Clientset) OpenebsV1alpha1() openebsv1alpha1.OpenebsV1alpha1Interface { + return &fakeopenebsv1alpha1.FakeOpenebsV1alpha1{Fake: &c.Fake} +} + +// Openebs retrieves the OpenebsV1alpha1Client +func (c *Clientset) Openebs() openebsv1alpha1.OpenebsV1alpha1Interface { + return &fakeopenebsv1alpha1.FakeOpenebsV1alpha1{Fake: &c.Fake} +} diff --git a/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/fake/doc.go b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/fake/doc.go new file mode 100644 index 00000000..420f67c8 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2019 The OpenEBS Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated fake clientset. +package fake diff --git a/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/fake/register.go b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/fake/register.go new file mode 100644 index 00000000..b7ddb4a3 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/fake/register.go @@ -0,0 +1,56 @@ +/* +Copyright 2019 The OpenEBS Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + openebsv1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" +) + +var scheme = runtime.NewScheme() +var codecs = serializer.NewCodecFactory(scheme) +var parameterCodec = runtime.NewParameterCodec(scheme) +var localSchemeBuilder = runtime.SchemeBuilder{ + openebsv1alpha1.AddToScheme, +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +var AddToScheme = localSchemeBuilder.AddToScheme + +func init() { + v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) + utilruntime.Must(AddToScheme(scheme)) +} diff --git a/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/scheme/doc.go b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/scheme/doc.go new file mode 100644 index 00000000..c1f8e04f --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/scheme/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2019 The OpenEBS Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package contains the scheme of the automatically generated clientset. +package scheme diff --git a/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/scheme/register.go b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/scheme/register.go new file mode 100644 index 00000000..0f89bb0e --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/scheme/register.go @@ -0,0 +1,56 @@ +/* +Copyright 2019 The OpenEBS Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package scheme + +import ( + openebsv1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" +) + +var Scheme = runtime.NewScheme() +var Codecs = serializer.NewCodecFactory(Scheme) +var ParameterCodec = runtime.NewParameterCodec(Scheme) +var localSchemeBuilder = runtime.SchemeBuilder{ + openebsv1alpha1.AddToScheme, +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +var AddToScheme = localSchemeBuilder.AddToScheme + +func init() { + v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) + utilruntime.Must(AddToScheme(Scheme)) +} diff --git a/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/castemplate.go b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/castemplate.go new file mode 100644 index 00000000..27fa8de3 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/castemplate.go @@ -0,0 +1,147 @@ +/* +Copyright 2019 The OpenEBS Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + scheme "github.com/openebs/maya/pkg/client/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// CASTemplatesGetter has a method to return a CASTemplateInterface. +// A group's client should implement this interface. +type CASTemplatesGetter interface { + CASTemplates() CASTemplateInterface +} + +// CASTemplateInterface has methods to work with CASTemplate resources. +type CASTemplateInterface interface { + Create(*v1alpha1.CASTemplate) (*v1alpha1.CASTemplate, error) + Update(*v1alpha1.CASTemplate) (*v1alpha1.CASTemplate, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.CASTemplate, error) + List(opts v1.ListOptions) (*v1alpha1.CASTemplateList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CASTemplate, err error) + CASTemplateExpansion +} + +// cASTemplates implements CASTemplateInterface +type cASTemplates struct { + client rest.Interface +} + +// newCASTemplates returns a CASTemplates +func newCASTemplates(c *OpenebsV1alpha1Client) *cASTemplates { + return &cASTemplates{ + client: c.RESTClient(), + } +} + +// Get takes name of the cASTemplate, and returns the corresponding cASTemplate object, and an error if there is any. +func (c *cASTemplates) Get(name string, options v1.GetOptions) (result *v1alpha1.CASTemplate, err error) { + result = &v1alpha1.CASTemplate{} + err = c.client.Get(). + Resource("castemplates"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of CASTemplates that match those selectors. +func (c *cASTemplates) List(opts v1.ListOptions) (result *v1alpha1.CASTemplateList, err error) { + result = &v1alpha1.CASTemplateList{} + err = c.client.Get(). + Resource("castemplates"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested cASTemplates. +func (c *cASTemplates) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Resource("castemplates"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a cASTemplate and creates it. Returns the server's representation of the cASTemplate, and an error, if there is any. +func (c *cASTemplates) Create(cASTemplate *v1alpha1.CASTemplate) (result *v1alpha1.CASTemplate, err error) { + result = &v1alpha1.CASTemplate{} + err = c.client.Post(). + Resource("castemplates"). + Body(cASTemplate). + Do(). + Into(result) + return +} + +// Update takes the representation of a cASTemplate and updates it. Returns the server's representation of the cASTemplate, and an error, if there is any. +func (c *cASTemplates) Update(cASTemplate *v1alpha1.CASTemplate) (result *v1alpha1.CASTemplate, err error) { + result = &v1alpha1.CASTemplate{} + err = c.client.Put(). + Resource("castemplates"). + Name(cASTemplate.Name). + Body(cASTemplate). + Do(). + Into(result) + return +} + +// Delete takes name of the cASTemplate and deletes it. Returns an error if one occurs. +func (c *cASTemplates) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Resource("castemplates"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *cASTemplates) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Resource("castemplates"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched cASTemplate. +func (c *cASTemplates) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CASTemplate, err error) { + result = &v1alpha1.CASTemplate{} + err = c.client.Patch(pt). + Resource("castemplates"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/cstorbackup.go b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/cstorbackup.go new file mode 100644 index 00000000..286cb8c4 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/cstorbackup.go @@ -0,0 +1,157 @@ +/* +Copyright 2019 The OpenEBS Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + scheme "github.com/openebs/maya/pkg/client/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// CStorBackupsGetter has a method to return a CStorBackupInterface. +// A group's client should implement this interface. +type CStorBackupsGetter interface { + CStorBackups(namespace string) CStorBackupInterface +} + +// CStorBackupInterface has methods to work with CStorBackup resources. +type CStorBackupInterface interface { + Create(*v1alpha1.CStorBackup) (*v1alpha1.CStorBackup, error) + Update(*v1alpha1.CStorBackup) (*v1alpha1.CStorBackup, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.CStorBackup, error) + List(opts v1.ListOptions) (*v1alpha1.CStorBackupList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CStorBackup, err error) + CStorBackupExpansion +} + +// cStorBackups implements CStorBackupInterface +type cStorBackups struct { + client rest.Interface + ns string +} + +// newCStorBackups returns a CStorBackups +func newCStorBackups(c *OpenebsV1alpha1Client, namespace string) *cStorBackups { + return &cStorBackups{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the cStorBackup, and returns the corresponding cStorBackup object, and an error if there is any. +func (c *cStorBackups) Get(name string, options v1.GetOptions) (result *v1alpha1.CStorBackup, err error) { + result = &v1alpha1.CStorBackup{} + err = c.client.Get(). + Namespace(c.ns). + Resource("cstorbackups"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of CStorBackups that match those selectors. +func (c *cStorBackups) List(opts v1.ListOptions) (result *v1alpha1.CStorBackupList, err error) { + result = &v1alpha1.CStorBackupList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("cstorbackups"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested cStorBackups. +func (c *cStorBackups) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("cstorbackups"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a cStorBackup and creates it. Returns the server's representation of the cStorBackup, and an error, if there is any. +func (c *cStorBackups) Create(cStorBackup *v1alpha1.CStorBackup) (result *v1alpha1.CStorBackup, err error) { + result = &v1alpha1.CStorBackup{} + err = c.client.Post(). + Namespace(c.ns). + Resource("cstorbackups"). + Body(cStorBackup). + Do(). + Into(result) + return +} + +// Update takes the representation of a cStorBackup and updates it. Returns the server's representation of the cStorBackup, and an error, if there is any. +func (c *cStorBackups) Update(cStorBackup *v1alpha1.CStorBackup) (result *v1alpha1.CStorBackup, err error) { + result = &v1alpha1.CStorBackup{} + err = c.client.Put(). + Namespace(c.ns). + Resource("cstorbackups"). + Name(cStorBackup.Name). + Body(cStorBackup). + Do(). + Into(result) + return +} + +// Delete takes name of the cStorBackup and deletes it. Returns an error if one occurs. +func (c *cStorBackups) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("cstorbackups"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *cStorBackups) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("cstorbackups"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched cStorBackup. +func (c *cStorBackups) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CStorBackup, err error) { + result = &v1alpha1.CStorBackup{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("cstorbackups"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/cstorcompletedbackup.go b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/cstorcompletedbackup.go new file mode 100644 index 00000000..4eb8c645 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/cstorcompletedbackup.go @@ -0,0 +1,157 @@ +/* +Copyright 2019 The OpenEBS Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + scheme "github.com/openebs/maya/pkg/client/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// CStorCompletedBackupsGetter has a method to return a CStorCompletedBackupInterface. +// A group's client should implement this interface. +type CStorCompletedBackupsGetter interface { + CStorCompletedBackups(namespace string) CStorCompletedBackupInterface +} + +// CStorCompletedBackupInterface has methods to work with CStorCompletedBackup resources. +type CStorCompletedBackupInterface interface { + Create(*v1alpha1.CStorCompletedBackup) (*v1alpha1.CStorCompletedBackup, error) + Update(*v1alpha1.CStorCompletedBackup) (*v1alpha1.CStorCompletedBackup, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.CStorCompletedBackup, error) + List(opts v1.ListOptions) (*v1alpha1.CStorCompletedBackupList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CStorCompletedBackup, err error) + CStorCompletedBackupExpansion +} + +// cStorCompletedBackups implements CStorCompletedBackupInterface +type cStorCompletedBackups struct { + client rest.Interface + ns string +} + +// newCStorCompletedBackups returns a CStorCompletedBackups +func newCStorCompletedBackups(c *OpenebsV1alpha1Client, namespace string) *cStorCompletedBackups { + return &cStorCompletedBackups{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the cStorCompletedBackup, and returns the corresponding cStorCompletedBackup object, and an error if there is any. +func (c *cStorCompletedBackups) Get(name string, options v1.GetOptions) (result *v1alpha1.CStorCompletedBackup, err error) { + result = &v1alpha1.CStorCompletedBackup{} + err = c.client.Get(). + Namespace(c.ns). + Resource("cstorcompletedbackups"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of CStorCompletedBackups that match those selectors. +func (c *cStorCompletedBackups) List(opts v1.ListOptions) (result *v1alpha1.CStorCompletedBackupList, err error) { + result = &v1alpha1.CStorCompletedBackupList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("cstorcompletedbackups"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested cStorCompletedBackups. +func (c *cStorCompletedBackups) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("cstorcompletedbackups"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a cStorCompletedBackup and creates it. Returns the server's representation of the cStorCompletedBackup, and an error, if there is any. +func (c *cStorCompletedBackups) Create(cStorCompletedBackup *v1alpha1.CStorCompletedBackup) (result *v1alpha1.CStorCompletedBackup, err error) { + result = &v1alpha1.CStorCompletedBackup{} + err = c.client.Post(). + Namespace(c.ns). + Resource("cstorcompletedbackups"). + Body(cStorCompletedBackup). + Do(). + Into(result) + return +} + +// Update takes the representation of a cStorCompletedBackup and updates it. Returns the server's representation of the cStorCompletedBackup, and an error, if there is any. +func (c *cStorCompletedBackups) Update(cStorCompletedBackup *v1alpha1.CStorCompletedBackup) (result *v1alpha1.CStorCompletedBackup, err error) { + result = &v1alpha1.CStorCompletedBackup{} + err = c.client.Put(). + Namespace(c.ns). + Resource("cstorcompletedbackups"). + Name(cStorCompletedBackup.Name). + Body(cStorCompletedBackup). + Do(). + Into(result) + return +} + +// Delete takes name of the cStorCompletedBackup and deletes it. Returns an error if one occurs. +func (c *cStorCompletedBackups) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("cstorcompletedbackups"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *cStorCompletedBackups) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("cstorcompletedbackups"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched cStorCompletedBackup. +func (c *cStorCompletedBackups) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CStorCompletedBackup, err error) { + result = &v1alpha1.CStorCompletedBackup{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("cstorcompletedbackups"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/cstorpool.go b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/cstorpool.go new file mode 100644 index 00000000..e3ea908b --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/cstorpool.go @@ -0,0 +1,147 @@ +/* +Copyright 2019 The OpenEBS Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + scheme "github.com/openebs/maya/pkg/client/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// CStorPoolsGetter has a method to return a CStorPoolInterface. +// A group's client should implement this interface. +type CStorPoolsGetter interface { + CStorPools() CStorPoolInterface +} + +// CStorPoolInterface has methods to work with CStorPool resources. +type CStorPoolInterface interface { + Create(*v1alpha1.CStorPool) (*v1alpha1.CStorPool, error) + Update(*v1alpha1.CStorPool) (*v1alpha1.CStorPool, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.CStorPool, error) + List(opts v1.ListOptions) (*v1alpha1.CStorPoolList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CStorPool, err error) + CStorPoolExpansion +} + +// cStorPools implements CStorPoolInterface +type cStorPools struct { + client rest.Interface +} + +// newCStorPools returns a CStorPools +func newCStorPools(c *OpenebsV1alpha1Client) *cStorPools { + return &cStorPools{ + client: c.RESTClient(), + } +} + +// Get takes name of the cStorPool, and returns the corresponding cStorPool object, and an error if there is any. +func (c *cStorPools) Get(name string, options v1.GetOptions) (result *v1alpha1.CStorPool, err error) { + result = &v1alpha1.CStorPool{} + err = c.client.Get(). + Resource("cstorpools"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of CStorPools that match those selectors. +func (c *cStorPools) List(opts v1.ListOptions) (result *v1alpha1.CStorPoolList, err error) { + result = &v1alpha1.CStorPoolList{} + err = c.client.Get(). + Resource("cstorpools"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested cStorPools. +func (c *cStorPools) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Resource("cstorpools"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a cStorPool and creates it. Returns the server's representation of the cStorPool, and an error, if there is any. +func (c *cStorPools) Create(cStorPool *v1alpha1.CStorPool) (result *v1alpha1.CStorPool, err error) { + result = &v1alpha1.CStorPool{} + err = c.client.Post(). + Resource("cstorpools"). + Body(cStorPool). + Do(). + Into(result) + return +} + +// Update takes the representation of a cStorPool and updates it. Returns the server's representation of the cStorPool, and an error, if there is any. +func (c *cStorPools) Update(cStorPool *v1alpha1.CStorPool) (result *v1alpha1.CStorPool, err error) { + result = &v1alpha1.CStorPool{} + err = c.client.Put(). + Resource("cstorpools"). + Name(cStorPool.Name). + Body(cStorPool). + Do(). + Into(result) + return +} + +// Delete takes name of the cStorPool and deletes it. Returns an error if one occurs. +func (c *cStorPools) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Resource("cstorpools"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *cStorPools) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Resource("cstorpools"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched cStorPool. +func (c *cStorPools) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CStorPool, err error) { + result = &v1alpha1.CStorPool{} + err = c.client.Patch(pt). + Resource("cstorpools"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/cstorrestore.go b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/cstorrestore.go new file mode 100644 index 00000000..5735ba70 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/cstorrestore.go @@ -0,0 +1,157 @@ +/* +Copyright 2019 The OpenEBS Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + scheme "github.com/openebs/maya/pkg/client/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// CStorRestoresGetter has a method to return a CStorRestoreInterface. +// A group's client should implement this interface. +type CStorRestoresGetter interface { + CStorRestores(namespace string) CStorRestoreInterface +} + +// CStorRestoreInterface has methods to work with CStorRestore resources. +type CStorRestoreInterface interface { + Create(*v1alpha1.CStorRestore) (*v1alpha1.CStorRestore, error) + Update(*v1alpha1.CStorRestore) (*v1alpha1.CStorRestore, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.CStorRestore, error) + List(opts v1.ListOptions) (*v1alpha1.CStorRestoreList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CStorRestore, err error) + CStorRestoreExpansion +} + +// cStorRestores implements CStorRestoreInterface +type cStorRestores struct { + client rest.Interface + ns string +} + +// newCStorRestores returns a CStorRestores +func newCStorRestores(c *OpenebsV1alpha1Client, namespace string) *cStorRestores { + return &cStorRestores{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the cStorRestore, and returns the corresponding cStorRestore object, and an error if there is any. +func (c *cStorRestores) Get(name string, options v1.GetOptions) (result *v1alpha1.CStorRestore, err error) { + result = &v1alpha1.CStorRestore{} + err = c.client.Get(). + Namespace(c.ns). + Resource("cstorrestores"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of CStorRestores that match those selectors. +func (c *cStorRestores) List(opts v1.ListOptions) (result *v1alpha1.CStorRestoreList, err error) { + result = &v1alpha1.CStorRestoreList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("cstorrestores"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested cStorRestores. +func (c *cStorRestores) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("cstorrestores"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a cStorRestore and creates it. Returns the server's representation of the cStorRestore, and an error, if there is any. +func (c *cStorRestores) Create(cStorRestore *v1alpha1.CStorRestore) (result *v1alpha1.CStorRestore, err error) { + result = &v1alpha1.CStorRestore{} + err = c.client.Post(). + Namespace(c.ns). + Resource("cstorrestores"). + Body(cStorRestore). + Do(). + Into(result) + return +} + +// Update takes the representation of a cStorRestore and updates it. Returns the server's representation of the cStorRestore, and an error, if there is any. +func (c *cStorRestores) Update(cStorRestore *v1alpha1.CStorRestore) (result *v1alpha1.CStorRestore, err error) { + result = &v1alpha1.CStorRestore{} + err = c.client.Put(). + Namespace(c.ns). + Resource("cstorrestores"). + Name(cStorRestore.Name). + Body(cStorRestore). + Do(). + Into(result) + return +} + +// Delete takes name of the cStorRestore and deletes it. Returns an error if one occurs. +func (c *cStorRestores) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("cstorrestores"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *cStorRestores) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("cstorrestores"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched cStorRestore. +func (c *cStorRestores) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CStorRestore, err error) { + result = &v1alpha1.CStorRestore{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("cstorrestores"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/cstorvolume.go b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/cstorvolume.go new file mode 100644 index 00000000..9a9d5a71 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/cstorvolume.go @@ -0,0 +1,174 @@ +/* +Copyright 2019 The OpenEBS Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + scheme "github.com/openebs/maya/pkg/client/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// CStorVolumesGetter has a method to return a CStorVolumeInterface. +// A group's client should implement this interface. +type CStorVolumesGetter interface { + CStorVolumes(namespace string) CStorVolumeInterface +} + +// CStorVolumeInterface has methods to work with CStorVolume resources. +type CStorVolumeInterface interface { + Create(*v1alpha1.CStorVolume) (*v1alpha1.CStorVolume, error) + Update(*v1alpha1.CStorVolume) (*v1alpha1.CStorVolume, error) + UpdateStatus(*v1alpha1.CStorVolume) (*v1alpha1.CStorVolume, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.CStorVolume, error) + List(opts v1.ListOptions) (*v1alpha1.CStorVolumeList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CStorVolume, err error) + CStorVolumeExpansion +} + +// cStorVolumes implements CStorVolumeInterface +type cStorVolumes struct { + client rest.Interface + ns string +} + +// newCStorVolumes returns a CStorVolumes +func newCStorVolumes(c *OpenebsV1alpha1Client, namespace string) *cStorVolumes { + return &cStorVolumes{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the cStorVolume, and returns the corresponding cStorVolume object, and an error if there is any. +func (c *cStorVolumes) Get(name string, options v1.GetOptions) (result *v1alpha1.CStorVolume, err error) { + result = &v1alpha1.CStorVolume{} + err = c.client.Get(). + Namespace(c.ns). + Resource("cstorvolumes"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of CStorVolumes that match those selectors. +func (c *cStorVolumes) List(opts v1.ListOptions) (result *v1alpha1.CStorVolumeList, err error) { + result = &v1alpha1.CStorVolumeList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("cstorvolumes"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested cStorVolumes. +func (c *cStorVolumes) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("cstorvolumes"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a cStorVolume and creates it. Returns the server's representation of the cStorVolume, and an error, if there is any. +func (c *cStorVolumes) Create(cStorVolume *v1alpha1.CStorVolume) (result *v1alpha1.CStorVolume, err error) { + result = &v1alpha1.CStorVolume{} + err = c.client.Post(). + Namespace(c.ns). + Resource("cstorvolumes"). + Body(cStorVolume). + Do(). + Into(result) + return +} + +// Update takes the representation of a cStorVolume and updates it. Returns the server's representation of the cStorVolume, and an error, if there is any. +func (c *cStorVolumes) Update(cStorVolume *v1alpha1.CStorVolume) (result *v1alpha1.CStorVolume, err error) { + result = &v1alpha1.CStorVolume{} + err = c.client.Put(). + Namespace(c.ns). + Resource("cstorvolumes"). + Name(cStorVolume.Name). + Body(cStorVolume). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *cStorVolumes) UpdateStatus(cStorVolume *v1alpha1.CStorVolume) (result *v1alpha1.CStorVolume, err error) { + result = &v1alpha1.CStorVolume{} + err = c.client.Put(). + Namespace(c.ns). + Resource("cstorvolumes"). + Name(cStorVolume.Name). + SubResource("status"). + Body(cStorVolume). + Do(). + Into(result) + return +} + +// Delete takes name of the cStorVolume and deletes it. Returns an error if one occurs. +func (c *cStorVolumes) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("cstorvolumes"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *cStorVolumes) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("cstorvolumes"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched cStorVolume. +func (c *cStorVolumes) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CStorVolume, err error) { + result = &v1alpha1.CStorVolume{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("cstorvolumes"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/cstorvolumereplica.go b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/cstorvolumereplica.go new file mode 100644 index 00000000..61b02982 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/cstorvolumereplica.go @@ -0,0 +1,157 @@ +/* +Copyright 2019 The OpenEBS Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + scheme "github.com/openebs/maya/pkg/client/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// CStorVolumeReplicasGetter has a method to return a CStorVolumeReplicaInterface. +// A group's client should implement this interface. +type CStorVolumeReplicasGetter interface { + CStorVolumeReplicas(namespace string) CStorVolumeReplicaInterface +} + +// CStorVolumeReplicaInterface has methods to work with CStorVolumeReplica resources. +type CStorVolumeReplicaInterface interface { + Create(*v1alpha1.CStorVolumeReplica) (*v1alpha1.CStorVolumeReplica, error) + Update(*v1alpha1.CStorVolumeReplica) (*v1alpha1.CStorVolumeReplica, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.CStorVolumeReplica, error) + List(opts v1.ListOptions) (*v1alpha1.CStorVolumeReplicaList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CStorVolumeReplica, err error) + CStorVolumeReplicaExpansion +} + +// cStorVolumeReplicas implements CStorVolumeReplicaInterface +type cStorVolumeReplicas struct { + client rest.Interface + ns string +} + +// newCStorVolumeReplicas returns a CStorVolumeReplicas +func newCStorVolumeReplicas(c *OpenebsV1alpha1Client, namespace string) *cStorVolumeReplicas { + return &cStorVolumeReplicas{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the cStorVolumeReplica, and returns the corresponding cStorVolumeReplica object, and an error if there is any. +func (c *cStorVolumeReplicas) Get(name string, options v1.GetOptions) (result *v1alpha1.CStorVolumeReplica, err error) { + result = &v1alpha1.CStorVolumeReplica{} + err = c.client.Get(). + Namespace(c.ns). + Resource("cstorvolumereplicas"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of CStorVolumeReplicas that match those selectors. +func (c *cStorVolumeReplicas) List(opts v1.ListOptions) (result *v1alpha1.CStorVolumeReplicaList, err error) { + result = &v1alpha1.CStorVolumeReplicaList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("cstorvolumereplicas"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested cStorVolumeReplicas. +func (c *cStorVolumeReplicas) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("cstorvolumereplicas"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a cStorVolumeReplica and creates it. Returns the server's representation of the cStorVolumeReplica, and an error, if there is any. +func (c *cStorVolumeReplicas) Create(cStorVolumeReplica *v1alpha1.CStorVolumeReplica) (result *v1alpha1.CStorVolumeReplica, err error) { + result = &v1alpha1.CStorVolumeReplica{} + err = c.client.Post(). + Namespace(c.ns). + Resource("cstorvolumereplicas"). + Body(cStorVolumeReplica). + Do(). + Into(result) + return +} + +// Update takes the representation of a cStorVolumeReplica and updates it. Returns the server's representation of the cStorVolumeReplica, and an error, if there is any. +func (c *cStorVolumeReplicas) Update(cStorVolumeReplica *v1alpha1.CStorVolumeReplica) (result *v1alpha1.CStorVolumeReplica, err error) { + result = &v1alpha1.CStorVolumeReplica{} + err = c.client.Put(). + Namespace(c.ns). + Resource("cstorvolumereplicas"). + Name(cStorVolumeReplica.Name). + Body(cStorVolumeReplica). + Do(). + Into(result) + return +} + +// Delete takes name of the cStorVolumeReplica and deletes it. Returns an error if one occurs. +func (c *cStorVolumeReplicas) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("cstorvolumereplicas"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *cStorVolumeReplicas) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("cstorvolumereplicas"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched cStorVolumeReplica. +func (c *cStorVolumeReplicas) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CStorVolumeReplica, err error) { + result = &v1alpha1.CStorVolumeReplica{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("cstorvolumereplicas"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/doc.go b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/doc.go new file mode 100644 index 00000000..1e48067b --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2019 The OpenEBS Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1alpha1 diff --git a/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/doc.go b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/doc.go new file mode 100644 index 00000000..d2f341f6 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2019 The OpenEBS Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_castemplate.go b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_castemplate.go new file mode 100644 index 00000000..3765fd16 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_castemplate.go @@ -0,0 +1,120 @@ +/* +Copyright 2019 The OpenEBS Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeCASTemplates implements CASTemplateInterface +type FakeCASTemplates struct { + Fake *FakeOpenebsV1alpha1 +} + +var castemplatesResource = schema.GroupVersionResource{Group: "openebs.io", Version: "v1alpha1", Resource: "castemplates"} + +var castemplatesKind = schema.GroupVersionKind{Group: "openebs.io", Version: "v1alpha1", Kind: "CASTemplate"} + +// Get takes name of the cASTemplate, and returns the corresponding cASTemplate object, and an error if there is any. +func (c *FakeCASTemplates) Get(name string, options v1.GetOptions) (result *v1alpha1.CASTemplate, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(castemplatesResource, name), &v1alpha1.CASTemplate{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CASTemplate), err +} + +// List takes label and field selectors, and returns the list of CASTemplates that match those selectors. +func (c *FakeCASTemplates) List(opts v1.ListOptions) (result *v1alpha1.CASTemplateList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(castemplatesResource, castemplatesKind, opts), &v1alpha1.CASTemplateList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.CASTemplateList{ListMeta: obj.(*v1alpha1.CASTemplateList).ListMeta} + for _, item := range obj.(*v1alpha1.CASTemplateList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested cASTemplates. +func (c *FakeCASTemplates) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(castemplatesResource, opts)) +} + +// Create takes the representation of a cASTemplate and creates it. Returns the server's representation of the cASTemplate, and an error, if there is any. +func (c *FakeCASTemplates) Create(cASTemplate *v1alpha1.CASTemplate) (result *v1alpha1.CASTemplate, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(castemplatesResource, cASTemplate), &v1alpha1.CASTemplate{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CASTemplate), err +} + +// Update takes the representation of a cASTemplate and updates it. Returns the server's representation of the cASTemplate, and an error, if there is any. +func (c *FakeCASTemplates) Update(cASTemplate *v1alpha1.CASTemplate) (result *v1alpha1.CASTemplate, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(castemplatesResource, cASTemplate), &v1alpha1.CASTemplate{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CASTemplate), err +} + +// Delete takes name of the cASTemplate and deletes it. Returns an error if one occurs. +func (c *FakeCASTemplates) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(castemplatesResource, name), &v1alpha1.CASTemplate{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeCASTemplates) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(castemplatesResource, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.CASTemplateList{}) + return err +} + +// Patch applies the patch and returns the patched cASTemplate. +func (c *FakeCASTemplates) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CASTemplate, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(castemplatesResource, name, data, subresources...), &v1alpha1.CASTemplate{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CASTemplate), err +} diff --git a/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorbackup.go b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorbackup.go new file mode 100644 index 00000000..ef2ccb83 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorbackup.go @@ -0,0 +1,128 @@ +/* +Copyright 2019 The OpenEBS Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeCStorBackups implements CStorBackupInterface +type FakeCStorBackups struct { + Fake *FakeOpenebsV1alpha1 + ns string +} + +var cstorbackupsResource = schema.GroupVersionResource{Group: "openebs.io", Version: "v1alpha1", Resource: "cstorbackups"} + +var cstorbackupsKind = schema.GroupVersionKind{Group: "openebs.io", Version: "v1alpha1", Kind: "CStorBackup"} + +// Get takes name of the cStorBackup, and returns the corresponding cStorBackup object, and an error if there is any. +func (c *FakeCStorBackups) Get(name string, options v1.GetOptions) (result *v1alpha1.CStorBackup, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(cstorbackupsResource, c.ns, name), &v1alpha1.CStorBackup{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorBackup), err +} + +// List takes label and field selectors, and returns the list of CStorBackups that match those selectors. +func (c *FakeCStorBackups) List(opts v1.ListOptions) (result *v1alpha1.CStorBackupList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(cstorbackupsResource, cstorbackupsKind, c.ns, opts), &v1alpha1.CStorBackupList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.CStorBackupList{ListMeta: obj.(*v1alpha1.CStorBackupList).ListMeta} + for _, item := range obj.(*v1alpha1.CStorBackupList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested cStorBackups. +func (c *FakeCStorBackups) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(cstorbackupsResource, c.ns, opts)) + +} + +// Create takes the representation of a cStorBackup and creates it. Returns the server's representation of the cStorBackup, and an error, if there is any. +func (c *FakeCStorBackups) Create(cStorBackup *v1alpha1.CStorBackup) (result *v1alpha1.CStorBackup, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(cstorbackupsResource, c.ns, cStorBackup), &v1alpha1.CStorBackup{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorBackup), err +} + +// Update takes the representation of a cStorBackup and updates it. Returns the server's representation of the cStorBackup, and an error, if there is any. +func (c *FakeCStorBackups) Update(cStorBackup *v1alpha1.CStorBackup) (result *v1alpha1.CStorBackup, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(cstorbackupsResource, c.ns, cStorBackup), &v1alpha1.CStorBackup{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorBackup), err +} + +// Delete takes name of the cStorBackup and deletes it. Returns an error if one occurs. +func (c *FakeCStorBackups) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(cstorbackupsResource, c.ns, name), &v1alpha1.CStorBackup{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeCStorBackups) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(cstorbackupsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.CStorBackupList{}) + return err +} + +// Patch applies the patch and returns the patched cStorBackup. +func (c *FakeCStorBackups) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CStorBackup, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(cstorbackupsResource, c.ns, name, data, subresources...), &v1alpha1.CStorBackup{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorBackup), err +} diff --git a/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorcompletedbackup.go b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorcompletedbackup.go new file mode 100644 index 00000000..b3a247c8 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorcompletedbackup.go @@ -0,0 +1,128 @@ +/* +Copyright 2019 The OpenEBS Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeCStorCompletedBackups implements CStorCompletedBackupInterface +type FakeCStorCompletedBackups struct { + Fake *FakeOpenebsV1alpha1 + ns string +} + +var cstorcompletedbackupsResource = schema.GroupVersionResource{Group: "openebs.io", Version: "v1alpha1", Resource: "cstorcompletedbackups"} + +var cstorcompletedbackupsKind = schema.GroupVersionKind{Group: "openebs.io", Version: "v1alpha1", Kind: "CStorCompletedBackup"} + +// Get takes name of the cStorCompletedBackup, and returns the corresponding cStorCompletedBackup object, and an error if there is any. +func (c *FakeCStorCompletedBackups) Get(name string, options v1.GetOptions) (result *v1alpha1.CStorCompletedBackup, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(cstorcompletedbackupsResource, c.ns, name), &v1alpha1.CStorCompletedBackup{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorCompletedBackup), err +} + +// List takes label and field selectors, and returns the list of CStorCompletedBackups that match those selectors. +func (c *FakeCStorCompletedBackups) List(opts v1.ListOptions) (result *v1alpha1.CStorCompletedBackupList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(cstorcompletedbackupsResource, cstorcompletedbackupsKind, c.ns, opts), &v1alpha1.CStorCompletedBackupList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.CStorCompletedBackupList{ListMeta: obj.(*v1alpha1.CStorCompletedBackupList).ListMeta} + for _, item := range obj.(*v1alpha1.CStorCompletedBackupList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested cStorCompletedBackups. +func (c *FakeCStorCompletedBackups) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(cstorcompletedbackupsResource, c.ns, opts)) + +} + +// Create takes the representation of a cStorCompletedBackup and creates it. Returns the server's representation of the cStorCompletedBackup, and an error, if there is any. +func (c *FakeCStorCompletedBackups) Create(cStorCompletedBackup *v1alpha1.CStorCompletedBackup) (result *v1alpha1.CStorCompletedBackup, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(cstorcompletedbackupsResource, c.ns, cStorCompletedBackup), &v1alpha1.CStorCompletedBackup{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorCompletedBackup), err +} + +// Update takes the representation of a cStorCompletedBackup and updates it. Returns the server's representation of the cStorCompletedBackup, and an error, if there is any. +func (c *FakeCStorCompletedBackups) Update(cStorCompletedBackup *v1alpha1.CStorCompletedBackup) (result *v1alpha1.CStorCompletedBackup, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(cstorcompletedbackupsResource, c.ns, cStorCompletedBackup), &v1alpha1.CStorCompletedBackup{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorCompletedBackup), err +} + +// Delete takes name of the cStorCompletedBackup and deletes it. Returns an error if one occurs. +func (c *FakeCStorCompletedBackups) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(cstorcompletedbackupsResource, c.ns, name), &v1alpha1.CStorCompletedBackup{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeCStorCompletedBackups) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(cstorcompletedbackupsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.CStorCompletedBackupList{}) + return err +} + +// Patch applies the patch and returns the patched cStorCompletedBackup. +func (c *FakeCStorCompletedBackups) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CStorCompletedBackup, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(cstorcompletedbackupsResource, c.ns, name, data, subresources...), &v1alpha1.CStorCompletedBackup{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorCompletedBackup), err +} diff --git a/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorpool.go b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorpool.go new file mode 100644 index 00000000..85d3b6bc --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorpool.go @@ -0,0 +1,120 @@ +/* +Copyright 2019 The OpenEBS Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeCStorPools implements CStorPoolInterface +type FakeCStorPools struct { + Fake *FakeOpenebsV1alpha1 +} + +var cstorpoolsResource = schema.GroupVersionResource{Group: "openebs.io", Version: "v1alpha1", Resource: "cstorpools"} + +var cstorpoolsKind = schema.GroupVersionKind{Group: "openebs.io", Version: "v1alpha1", Kind: "CStorPool"} + +// Get takes name of the cStorPool, and returns the corresponding cStorPool object, and an error if there is any. +func (c *FakeCStorPools) Get(name string, options v1.GetOptions) (result *v1alpha1.CStorPool, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(cstorpoolsResource, name), &v1alpha1.CStorPool{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorPool), err +} + +// List takes label and field selectors, and returns the list of CStorPools that match those selectors. +func (c *FakeCStorPools) List(opts v1.ListOptions) (result *v1alpha1.CStorPoolList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(cstorpoolsResource, cstorpoolsKind, opts), &v1alpha1.CStorPoolList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.CStorPoolList{ListMeta: obj.(*v1alpha1.CStorPoolList).ListMeta} + for _, item := range obj.(*v1alpha1.CStorPoolList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested cStorPools. +func (c *FakeCStorPools) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(cstorpoolsResource, opts)) +} + +// Create takes the representation of a cStorPool and creates it. Returns the server's representation of the cStorPool, and an error, if there is any. +func (c *FakeCStorPools) Create(cStorPool *v1alpha1.CStorPool) (result *v1alpha1.CStorPool, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(cstorpoolsResource, cStorPool), &v1alpha1.CStorPool{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorPool), err +} + +// Update takes the representation of a cStorPool and updates it. Returns the server's representation of the cStorPool, and an error, if there is any. +func (c *FakeCStorPools) Update(cStorPool *v1alpha1.CStorPool) (result *v1alpha1.CStorPool, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(cstorpoolsResource, cStorPool), &v1alpha1.CStorPool{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorPool), err +} + +// Delete takes name of the cStorPool and deletes it. Returns an error if one occurs. +func (c *FakeCStorPools) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(cstorpoolsResource, name), &v1alpha1.CStorPool{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeCStorPools) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(cstorpoolsResource, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.CStorPoolList{}) + return err +} + +// Patch applies the patch and returns the patched cStorPool. +func (c *FakeCStorPools) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CStorPool, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(cstorpoolsResource, name, data, subresources...), &v1alpha1.CStorPool{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorPool), err +} diff --git a/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorpoolcluster.go b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorpoolcluster.go new file mode 100644 index 00000000..529d2b15 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorpoolcluster.go @@ -0,0 +1,128 @@ +/* +Copyright 2019 The OpenEBS Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeCStorPoolClusters implements CStorPoolClusterInterface +type FakeCStorPoolClusters struct { + Fake *FakeOpenebsV1alpha1 + ns string +} + +var cstorpoolclustersResource = schema.GroupVersionResource{Group: "openebs.io", Version: "v1alpha1", Resource: "cstorpoolclusters"} + +var cstorpoolclustersKind = schema.GroupVersionKind{Group: "openebs.io", Version: "v1alpha1", Kind: "CStorPoolCluster"} + +// Get takes name of the cStorPoolCluster, and returns the corresponding cStorPoolCluster object, and an error if there is any. +func (c *FakeCStorPoolClusters) Get(name string, options v1.GetOptions) (result *v1alpha1.CStorPoolCluster, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(cstorpoolclustersResource, c.ns, name), &v1alpha1.CStorPoolCluster{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorPoolCluster), err +} + +// List takes label and field selectors, and returns the list of CStorPoolClusters that match those selectors. +func (c *FakeCStorPoolClusters) List(opts v1.ListOptions) (result *v1alpha1.CStorPoolClusterList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(cstorpoolclustersResource, cstorpoolclustersKind, c.ns, opts), &v1alpha1.CStorPoolClusterList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.CStorPoolClusterList{ListMeta: obj.(*v1alpha1.CStorPoolClusterList).ListMeta} + for _, item := range obj.(*v1alpha1.CStorPoolClusterList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested cStorPoolClusters. +func (c *FakeCStorPoolClusters) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(cstorpoolclustersResource, c.ns, opts)) + +} + +// Create takes the representation of a cStorPoolCluster and creates it. Returns the server's representation of the cStorPoolCluster, and an error, if there is any. +func (c *FakeCStorPoolClusters) Create(cStorPoolCluster *v1alpha1.CStorPoolCluster) (result *v1alpha1.CStorPoolCluster, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(cstorpoolclustersResource, c.ns, cStorPoolCluster), &v1alpha1.CStorPoolCluster{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorPoolCluster), err +} + +// Update takes the representation of a cStorPoolCluster and updates it. Returns the server's representation of the cStorPoolCluster, and an error, if there is any. +func (c *FakeCStorPoolClusters) Update(cStorPoolCluster *v1alpha1.CStorPoolCluster) (result *v1alpha1.CStorPoolCluster, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(cstorpoolclustersResource, c.ns, cStorPoolCluster), &v1alpha1.CStorPoolCluster{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorPoolCluster), err +} + +// Delete takes name of the cStorPoolCluster and deletes it. Returns an error if one occurs. +func (c *FakeCStorPoolClusters) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(cstorpoolclustersResource, c.ns, name), &v1alpha1.CStorPoolCluster{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeCStorPoolClusters) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(cstorpoolclustersResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.CStorPoolClusterList{}) + return err +} + +// Patch applies the patch and returns the patched cStorPoolCluster. +func (c *FakeCStorPoolClusters) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CStorPoolCluster, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(cstorpoolclustersResource, c.ns, name, data, subresources...), &v1alpha1.CStorPoolCluster{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorPoolCluster), err +} diff --git a/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorpoolinstance.go b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorpoolinstance.go new file mode 100644 index 00000000..9a434048 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorpoolinstance.go @@ -0,0 +1,128 @@ +/* +Copyright 2019 The OpenEBS Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeCStorPoolInstances implements CStorPoolInstanceInterface +type FakeCStorPoolInstances struct { + Fake *FakeOpenebsV1alpha1 + ns string +} + +var cstorpoolinstancesResource = schema.GroupVersionResource{Group: "openebs.io", Version: "v1alpha1", Resource: "cstorpoolinstances"} + +var cstorpoolinstancesKind = schema.GroupVersionKind{Group: "openebs.io", Version: "v1alpha1", Kind: "CStorPoolInstance"} + +// Get takes name of the cStorPoolInstance, and returns the corresponding cStorPoolInstance object, and an error if there is any. +func (c *FakeCStorPoolInstances) Get(name string, options v1.GetOptions) (result *v1alpha1.CStorPoolInstance, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(cstorpoolinstancesResource, c.ns, name), &v1alpha1.CStorPoolInstance{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorPoolInstance), err +} + +// List takes label and field selectors, and returns the list of CStorPoolInstances that match those selectors. +func (c *FakeCStorPoolInstances) List(opts v1.ListOptions) (result *v1alpha1.CStorPoolInstanceList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(cstorpoolinstancesResource, cstorpoolinstancesKind, c.ns, opts), &v1alpha1.CStorPoolInstanceList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.CStorPoolInstanceList{ListMeta: obj.(*v1alpha1.CStorPoolInstanceList).ListMeta} + for _, item := range obj.(*v1alpha1.CStorPoolInstanceList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested cStorPoolInstances. +func (c *FakeCStorPoolInstances) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(cstorpoolinstancesResource, c.ns, opts)) + +} + +// Create takes the representation of a cStorPoolInstance and creates it. Returns the server's representation of the cStorPoolInstance, and an error, if there is any. +func (c *FakeCStorPoolInstances) Create(cStorPoolInstance *v1alpha1.CStorPoolInstance) (result *v1alpha1.CStorPoolInstance, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(cstorpoolinstancesResource, c.ns, cStorPoolInstance), &v1alpha1.CStorPoolInstance{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorPoolInstance), err +} + +// Update takes the representation of a cStorPoolInstance and updates it. Returns the server's representation of the cStorPoolInstance, and an error, if there is any. +func (c *FakeCStorPoolInstances) Update(cStorPoolInstance *v1alpha1.CStorPoolInstance) (result *v1alpha1.CStorPoolInstance, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(cstorpoolinstancesResource, c.ns, cStorPoolInstance), &v1alpha1.CStorPoolInstance{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorPoolInstance), err +} + +// Delete takes name of the cStorPoolInstance and deletes it. Returns an error if one occurs. +func (c *FakeCStorPoolInstances) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(cstorpoolinstancesResource, c.ns, name), &v1alpha1.CStorPoolInstance{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeCStorPoolInstances) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(cstorpoolinstancesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.CStorPoolInstanceList{}) + return err +} + +// Patch applies the patch and returns the patched cStorPoolInstance. +func (c *FakeCStorPoolInstances) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CStorPoolInstance, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(cstorpoolinstancesResource, c.ns, name, data, subresources...), &v1alpha1.CStorPoolInstance{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorPoolInstance), err +} diff --git a/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorrestore.go b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorrestore.go new file mode 100644 index 00000000..a18d53f6 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorrestore.go @@ -0,0 +1,128 @@ +/* +Copyright 2019 The OpenEBS Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeCStorRestores implements CStorRestoreInterface +type FakeCStorRestores struct { + Fake *FakeOpenebsV1alpha1 + ns string +} + +var cstorrestoresResource = schema.GroupVersionResource{Group: "openebs.io", Version: "v1alpha1", Resource: "cstorrestores"} + +var cstorrestoresKind = schema.GroupVersionKind{Group: "openebs.io", Version: "v1alpha1", Kind: "CStorRestore"} + +// Get takes name of the cStorRestore, and returns the corresponding cStorRestore object, and an error if there is any. +func (c *FakeCStorRestores) Get(name string, options v1.GetOptions) (result *v1alpha1.CStorRestore, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(cstorrestoresResource, c.ns, name), &v1alpha1.CStorRestore{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorRestore), err +} + +// List takes label and field selectors, and returns the list of CStorRestores that match those selectors. +func (c *FakeCStorRestores) List(opts v1.ListOptions) (result *v1alpha1.CStorRestoreList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(cstorrestoresResource, cstorrestoresKind, c.ns, opts), &v1alpha1.CStorRestoreList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.CStorRestoreList{ListMeta: obj.(*v1alpha1.CStorRestoreList).ListMeta} + for _, item := range obj.(*v1alpha1.CStorRestoreList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested cStorRestores. +func (c *FakeCStorRestores) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(cstorrestoresResource, c.ns, opts)) + +} + +// Create takes the representation of a cStorRestore and creates it. Returns the server's representation of the cStorRestore, and an error, if there is any. +func (c *FakeCStorRestores) Create(cStorRestore *v1alpha1.CStorRestore) (result *v1alpha1.CStorRestore, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(cstorrestoresResource, c.ns, cStorRestore), &v1alpha1.CStorRestore{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorRestore), err +} + +// Update takes the representation of a cStorRestore and updates it. Returns the server's representation of the cStorRestore, and an error, if there is any. +func (c *FakeCStorRestores) Update(cStorRestore *v1alpha1.CStorRestore) (result *v1alpha1.CStorRestore, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(cstorrestoresResource, c.ns, cStorRestore), &v1alpha1.CStorRestore{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorRestore), err +} + +// Delete takes name of the cStorRestore and deletes it. Returns an error if one occurs. +func (c *FakeCStorRestores) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(cstorrestoresResource, c.ns, name), &v1alpha1.CStorRestore{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeCStorRestores) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(cstorrestoresResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.CStorRestoreList{}) + return err +} + +// Patch applies the patch and returns the patched cStorRestore. +func (c *FakeCStorRestores) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CStorRestore, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(cstorrestoresResource, c.ns, name, data, subresources...), &v1alpha1.CStorRestore{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorRestore), err +} diff --git a/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorvolume.go b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorvolume.go new file mode 100644 index 00000000..ec1e1868 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorvolume.go @@ -0,0 +1,140 @@ +/* +Copyright 2019 The OpenEBS Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeCStorVolumes implements CStorVolumeInterface +type FakeCStorVolumes struct { + Fake *FakeOpenebsV1alpha1 + ns string +} + +var cstorvolumesResource = schema.GroupVersionResource{Group: "openebs.io", Version: "v1alpha1", Resource: "cstorvolumes"} + +var cstorvolumesKind = schema.GroupVersionKind{Group: "openebs.io", Version: "v1alpha1", Kind: "CStorVolume"} + +// Get takes name of the cStorVolume, and returns the corresponding cStorVolume object, and an error if there is any. +func (c *FakeCStorVolumes) Get(name string, options v1.GetOptions) (result *v1alpha1.CStorVolume, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(cstorvolumesResource, c.ns, name), &v1alpha1.CStorVolume{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorVolume), err +} + +// List takes label and field selectors, and returns the list of CStorVolumes that match those selectors. +func (c *FakeCStorVolumes) List(opts v1.ListOptions) (result *v1alpha1.CStorVolumeList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(cstorvolumesResource, cstorvolumesKind, c.ns, opts), &v1alpha1.CStorVolumeList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.CStorVolumeList{ListMeta: obj.(*v1alpha1.CStorVolumeList).ListMeta} + for _, item := range obj.(*v1alpha1.CStorVolumeList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested cStorVolumes. +func (c *FakeCStorVolumes) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(cstorvolumesResource, c.ns, opts)) + +} + +// Create takes the representation of a cStorVolume and creates it. Returns the server's representation of the cStorVolume, and an error, if there is any. +func (c *FakeCStorVolumes) Create(cStorVolume *v1alpha1.CStorVolume) (result *v1alpha1.CStorVolume, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(cstorvolumesResource, c.ns, cStorVolume), &v1alpha1.CStorVolume{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorVolume), err +} + +// Update takes the representation of a cStorVolume and updates it. Returns the server's representation of the cStorVolume, and an error, if there is any. +func (c *FakeCStorVolumes) Update(cStorVolume *v1alpha1.CStorVolume) (result *v1alpha1.CStorVolume, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(cstorvolumesResource, c.ns, cStorVolume), &v1alpha1.CStorVolume{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorVolume), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeCStorVolumes) UpdateStatus(cStorVolume *v1alpha1.CStorVolume) (*v1alpha1.CStorVolume, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(cstorvolumesResource, "status", c.ns, cStorVolume), &v1alpha1.CStorVolume{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorVolume), err +} + +// Delete takes name of the cStorVolume and deletes it. Returns an error if one occurs. +func (c *FakeCStorVolumes) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(cstorvolumesResource, c.ns, name), &v1alpha1.CStorVolume{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeCStorVolumes) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(cstorvolumesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.CStorVolumeList{}) + return err +} + +// Patch applies the patch and returns the patched cStorVolume. +func (c *FakeCStorVolumes) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CStorVolume, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(cstorvolumesResource, c.ns, name, data, subresources...), &v1alpha1.CStorVolume{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorVolume), err +} diff --git a/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorvolumeclaim.go b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorvolumeclaim.go new file mode 100644 index 00000000..e9d12d43 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorvolumeclaim.go @@ -0,0 +1,140 @@ +/* +Copyright 2019 The OpenEBS Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeCStorVolumeClaims implements CStorVolumeClaimInterface +type FakeCStorVolumeClaims struct { + Fake *FakeOpenebsV1alpha1 + ns string +} + +var cstorvolumeclaimsResource = schema.GroupVersionResource{Group: "openebs.io", Version: "v1alpha1", Resource: "cstorvolumeclaims"} + +var cstorvolumeclaimsKind = schema.GroupVersionKind{Group: "openebs.io", Version: "v1alpha1", Kind: "CStorVolumeClaim"} + +// Get takes name of the cStorVolumeClaim, and returns the corresponding cStorVolumeClaim object, and an error if there is any. +func (c *FakeCStorVolumeClaims) Get(name string, options v1.GetOptions) (result *v1alpha1.CStorVolumeClaim, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(cstorvolumeclaimsResource, c.ns, name), &v1alpha1.CStorVolumeClaim{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorVolumeClaim), err +} + +// List takes label and field selectors, and returns the list of CStorVolumeClaims that match those selectors. +func (c *FakeCStorVolumeClaims) List(opts v1.ListOptions) (result *v1alpha1.CStorVolumeClaimList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(cstorvolumeclaimsResource, cstorvolumeclaimsKind, c.ns, opts), &v1alpha1.CStorVolumeClaimList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.CStorVolumeClaimList{ListMeta: obj.(*v1alpha1.CStorVolumeClaimList).ListMeta} + for _, item := range obj.(*v1alpha1.CStorVolumeClaimList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested cStorVolumeClaims. +func (c *FakeCStorVolumeClaims) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(cstorvolumeclaimsResource, c.ns, opts)) + +} + +// Create takes the representation of a cStorVolumeClaim and creates it. Returns the server's representation of the cStorVolumeClaim, and an error, if there is any. +func (c *FakeCStorVolumeClaims) Create(cStorVolumeClaim *v1alpha1.CStorVolumeClaim) (result *v1alpha1.CStorVolumeClaim, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(cstorvolumeclaimsResource, c.ns, cStorVolumeClaim), &v1alpha1.CStorVolumeClaim{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorVolumeClaim), err +} + +// Update takes the representation of a cStorVolumeClaim and updates it. Returns the server's representation of the cStorVolumeClaim, and an error, if there is any. +func (c *FakeCStorVolumeClaims) Update(cStorVolumeClaim *v1alpha1.CStorVolumeClaim) (result *v1alpha1.CStorVolumeClaim, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(cstorvolumeclaimsResource, c.ns, cStorVolumeClaim), &v1alpha1.CStorVolumeClaim{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorVolumeClaim), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeCStorVolumeClaims) UpdateStatus(cStorVolumeClaim *v1alpha1.CStorVolumeClaim) (*v1alpha1.CStorVolumeClaim, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(cstorvolumeclaimsResource, "status", c.ns, cStorVolumeClaim), &v1alpha1.CStorVolumeClaim{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorVolumeClaim), err +} + +// Delete takes name of the cStorVolumeClaim and deletes it. Returns an error if one occurs. +func (c *FakeCStorVolumeClaims) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(cstorvolumeclaimsResource, c.ns, name), &v1alpha1.CStorVolumeClaim{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeCStorVolumeClaims) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(cstorvolumeclaimsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.CStorVolumeClaimList{}) + return err +} + +// Patch applies the patch and returns the patched cStorVolumeClaim. +func (c *FakeCStorVolumeClaims) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CStorVolumeClaim, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(cstorvolumeclaimsResource, c.ns, name, data, subresources...), &v1alpha1.CStorVolumeClaim{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorVolumeClaim), err +} diff --git a/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorvolumereplica.go b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorvolumereplica.go new file mode 100644 index 00000000..e50d7ab1 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorvolumereplica.go @@ -0,0 +1,128 @@ +/* +Copyright 2019 The OpenEBS Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeCStorVolumeReplicas implements CStorVolumeReplicaInterface +type FakeCStorVolumeReplicas struct { + Fake *FakeOpenebsV1alpha1 + ns string +} + +var cstorvolumereplicasResource = schema.GroupVersionResource{Group: "openebs.io", Version: "v1alpha1", Resource: "cstorvolumereplicas"} + +var cstorvolumereplicasKind = schema.GroupVersionKind{Group: "openebs.io", Version: "v1alpha1", Kind: "CStorVolumeReplica"} + +// Get takes name of the cStorVolumeReplica, and returns the corresponding cStorVolumeReplica object, and an error if there is any. +func (c *FakeCStorVolumeReplicas) Get(name string, options v1.GetOptions) (result *v1alpha1.CStorVolumeReplica, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(cstorvolumereplicasResource, c.ns, name), &v1alpha1.CStorVolumeReplica{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorVolumeReplica), err +} + +// List takes label and field selectors, and returns the list of CStorVolumeReplicas that match those selectors. +func (c *FakeCStorVolumeReplicas) List(opts v1.ListOptions) (result *v1alpha1.CStorVolumeReplicaList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(cstorvolumereplicasResource, cstorvolumereplicasKind, c.ns, opts), &v1alpha1.CStorVolumeReplicaList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.CStorVolumeReplicaList{ListMeta: obj.(*v1alpha1.CStorVolumeReplicaList).ListMeta} + for _, item := range obj.(*v1alpha1.CStorVolumeReplicaList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested cStorVolumeReplicas. +func (c *FakeCStorVolumeReplicas) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(cstorvolumereplicasResource, c.ns, opts)) + +} + +// Create takes the representation of a cStorVolumeReplica and creates it. Returns the server's representation of the cStorVolumeReplica, and an error, if there is any. +func (c *FakeCStorVolumeReplicas) Create(cStorVolumeReplica *v1alpha1.CStorVolumeReplica) (result *v1alpha1.CStorVolumeReplica, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(cstorvolumereplicasResource, c.ns, cStorVolumeReplica), &v1alpha1.CStorVolumeReplica{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorVolumeReplica), err +} + +// Update takes the representation of a cStorVolumeReplica and updates it. Returns the server's representation of the cStorVolumeReplica, and an error, if there is any. +func (c *FakeCStorVolumeReplicas) Update(cStorVolumeReplica *v1alpha1.CStorVolumeReplica) (result *v1alpha1.CStorVolumeReplica, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(cstorvolumereplicasResource, c.ns, cStorVolumeReplica), &v1alpha1.CStorVolumeReplica{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorVolumeReplica), err +} + +// Delete takes name of the cStorVolumeReplica and deletes it. Returns an error if one occurs. +func (c *FakeCStorVolumeReplicas) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(cstorvolumereplicasResource, c.ns, name), &v1alpha1.CStorVolumeReplica{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeCStorVolumeReplicas) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(cstorvolumereplicasResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.CStorVolumeReplicaList{}) + return err +} + +// Patch applies the patch and returns the patched cStorVolumeReplica. +func (c *FakeCStorVolumeReplicas) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CStorVolumeReplica, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(cstorvolumereplicasResource, c.ns, name, data, subresources...), &v1alpha1.CStorVolumeReplica{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorVolumeReplica), err +} diff --git a/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_openebs.io_client.go b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_openebs.io_client.go new file mode 100644 index 00000000..c9edb1e1 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_openebs.io_client.go @@ -0,0 +1,88 @@ +/* +Copyright 2019 The OpenEBS Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeOpenebsV1alpha1 struct { + *testing.Fake +} + +func (c *FakeOpenebsV1alpha1) CASTemplates() v1alpha1.CASTemplateInterface { + return &FakeCASTemplates{c} +} + +func (c *FakeOpenebsV1alpha1) CStorBackups(namespace string) v1alpha1.CStorBackupInterface { + return &FakeCStorBackups{c, namespace} +} + +func (c *FakeOpenebsV1alpha1) CStorCompletedBackups(namespace string) v1alpha1.CStorCompletedBackupInterface { + return &FakeCStorCompletedBackups{c, namespace} +} + +func (c *FakeOpenebsV1alpha1) CStorPools() v1alpha1.CStorPoolInterface { + return &FakeCStorPools{c} +} + +func (c *FakeOpenebsV1alpha1) CStorPoolClusters(namespace string) v1alpha1.CStorPoolClusterInterface { + return &FakeCStorPoolClusters{c, namespace} +} + +func (c *FakeOpenebsV1alpha1) CStorPoolInstances(namespace string) v1alpha1.CStorPoolInstanceInterface { + return &FakeCStorPoolInstances{c, namespace} +} + +func (c *FakeOpenebsV1alpha1) CStorRestores(namespace string) v1alpha1.CStorRestoreInterface { + return &FakeCStorRestores{c, namespace} +} + +func (c *FakeOpenebsV1alpha1) CStorVolumes(namespace string) v1alpha1.CStorVolumeInterface { + return &FakeCStorVolumes{c, namespace} +} + +func (c *FakeOpenebsV1alpha1) CStorVolumeClaims(namespace string) v1alpha1.CStorVolumeClaimInterface { + return &FakeCStorVolumeClaims{c, namespace} +} + +func (c *FakeOpenebsV1alpha1) CStorVolumeReplicas(namespace string) v1alpha1.CStorVolumeReplicaInterface { + return &FakeCStorVolumeReplicas{c, namespace} +} + +func (c *FakeOpenebsV1alpha1) RunTasks(namespace string) v1alpha1.RunTaskInterface { + return &FakeRunTasks{c, namespace} +} + +func (c *FakeOpenebsV1alpha1) StoragePools() v1alpha1.StoragePoolInterface { + return &FakeStoragePools{c} +} + +func (c *FakeOpenebsV1alpha1) StoragePoolClaims() v1alpha1.StoragePoolClaimInterface { + return &FakeStoragePoolClaims{c} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeOpenebsV1alpha1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_runtask.go b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_runtask.go new file mode 100644 index 00000000..c55a0a6d --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_runtask.go @@ -0,0 +1,128 @@ +/* +Copyright 2019 The OpenEBS Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeRunTasks implements RunTaskInterface +type FakeRunTasks struct { + Fake *FakeOpenebsV1alpha1 + ns string +} + +var runtasksResource = schema.GroupVersionResource{Group: "openebs.io", Version: "v1alpha1", Resource: "runtasks"} + +var runtasksKind = schema.GroupVersionKind{Group: "openebs.io", Version: "v1alpha1", Kind: "RunTask"} + +// Get takes name of the runTask, and returns the corresponding runTask object, and an error if there is any. +func (c *FakeRunTasks) Get(name string, options v1.GetOptions) (result *v1alpha1.RunTask, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(runtasksResource, c.ns, name), &v1alpha1.RunTask{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.RunTask), err +} + +// List takes label and field selectors, and returns the list of RunTasks that match those selectors. +func (c *FakeRunTasks) List(opts v1.ListOptions) (result *v1alpha1.RunTaskList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(runtasksResource, runtasksKind, c.ns, opts), &v1alpha1.RunTaskList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.RunTaskList{ListMeta: obj.(*v1alpha1.RunTaskList).ListMeta} + for _, item := range obj.(*v1alpha1.RunTaskList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested runTasks. +func (c *FakeRunTasks) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(runtasksResource, c.ns, opts)) + +} + +// Create takes the representation of a runTask and creates it. Returns the server's representation of the runTask, and an error, if there is any. +func (c *FakeRunTasks) Create(runTask *v1alpha1.RunTask) (result *v1alpha1.RunTask, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(runtasksResource, c.ns, runTask), &v1alpha1.RunTask{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.RunTask), err +} + +// Update takes the representation of a runTask and updates it. Returns the server's representation of the runTask, and an error, if there is any. +func (c *FakeRunTasks) Update(runTask *v1alpha1.RunTask) (result *v1alpha1.RunTask, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(runtasksResource, c.ns, runTask), &v1alpha1.RunTask{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.RunTask), err +} + +// Delete takes name of the runTask and deletes it. Returns an error if one occurs. +func (c *FakeRunTasks) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(runtasksResource, c.ns, name), &v1alpha1.RunTask{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeRunTasks) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(runtasksResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.RunTaskList{}) + return err +} + +// Patch applies the patch and returns the patched runTask. +func (c *FakeRunTasks) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.RunTask, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(runtasksResource, c.ns, name, data, subresources...), &v1alpha1.RunTask{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.RunTask), err +} diff --git a/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_storagepool.go b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_storagepool.go new file mode 100644 index 00000000..da1a5a51 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_storagepool.go @@ -0,0 +1,120 @@ +/* +Copyright 2019 The OpenEBS Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeStoragePools implements StoragePoolInterface +type FakeStoragePools struct { + Fake *FakeOpenebsV1alpha1 +} + +var storagepoolsResource = schema.GroupVersionResource{Group: "openebs.io", Version: "v1alpha1", Resource: "storagepools"} + +var storagepoolsKind = schema.GroupVersionKind{Group: "openebs.io", Version: "v1alpha1", Kind: "StoragePool"} + +// Get takes name of the storagePool, and returns the corresponding storagePool object, and an error if there is any. +func (c *FakeStoragePools) Get(name string, options v1.GetOptions) (result *v1alpha1.StoragePool, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(storagepoolsResource, name), &v1alpha1.StoragePool{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.StoragePool), err +} + +// List takes label and field selectors, and returns the list of StoragePools that match those selectors. +func (c *FakeStoragePools) List(opts v1.ListOptions) (result *v1alpha1.StoragePoolList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(storagepoolsResource, storagepoolsKind, opts), &v1alpha1.StoragePoolList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.StoragePoolList{ListMeta: obj.(*v1alpha1.StoragePoolList).ListMeta} + for _, item := range obj.(*v1alpha1.StoragePoolList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested storagePools. +func (c *FakeStoragePools) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(storagepoolsResource, opts)) +} + +// Create takes the representation of a storagePool and creates it. Returns the server's representation of the storagePool, and an error, if there is any. +func (c *FakeStoragePools) Create(storagePool *v1alpha1.StoragePool) (result *v1alpha1.StoragePool, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(storagepoolsResource, storagePool), &v1alpha1.StoragePool{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.StoragePool), err +} + +// Update takes the representation of a storagePool and updates it. Returns the server's representation of the storagePool, and an error, if there is any. +func (c *FakeStoragePools) Update(storagePool *v1alpha1.StoragePool) (result *v1alpha1.StoragePool, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(storagepoolsResource, storagePool), &v1alpha1.StoragePool{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.StoragePool), err +} + +// Delete takes name of the storagePool and deletes it. Returns an error if one occurs. +func (c *FakeStoragePools) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(storagepoolsResource, name), &v1alpha1.StoragePool{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeStoragePools) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(storagepoolsResource, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.StoragePoolList{}) + return err +} + +// Patch applies the patch and returns the patched storagePool. +func (c *FakeStoragePools) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.StoragePool, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(storagepoolsResource, name, data, subresources...), &v1alpha1.StoragePool{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.StoragePool), err +} diff --git a/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_storagepoolclaim.go b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_storagepoolclaim.go new file mode 100644 index 00000000..368ccd81 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_storagepoolclaim.go @@ -0,0 +1,120 @@ +/* +Copyright 2019 The OpenEBS Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeStoragePoolClaims implements StoragePoolClaimInterface +type FakeStoragePoolClaims struct { + Fake *FakeOpenebsV1alpha1 +} + +var storagepoolclaimsResource = schema.GroupVersionResource{Group: "openebs.io", Version: "v1alpha1", Resource: "storagepoolclaims"} + +var storagepoolclaimsKind = schema.GroupVersionKind{Group: "openebs.io", Version: "v1alpha1", Kind: "StoragePoolClaim"} + +// Get takes name of the storagePoolClaim, and returns the corresponding storagePoolClaim object, and an error if there is any. +func (c *FakeStoragePoolClaims) Get(name string, options v1.GetOptions) (result *v1alpha1.StoragePoolClaim, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(storagepoolclaimsResource, name), &v1alpha1.StoragePoolClaim{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.StoragePoolClaim), err +} + +// List takes label and field selectors, and returns the list of StoragePoolClaims that match those selectors. +func (c *FakeStoragePoolClaims) List(opts v1.ListOptions) (result *v1alpha1.StoragePoolClaimList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(storagepoolclaimsResource, storagepoolclaimsKind, opts), &v1alpha1.StoragePoolClaimList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.StoragePoolClaimList{ListMeta: obj.(*v1alpha1.StoragePoolClaimList).ListMeta} + for _, item := range obj.(*v1alpha1.StoragePoolClaimList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested storagePoolClaims. +func (c *FakeStoragePoolClaims) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(storagepoolclaimsResource, opts)) +} + +// Create takes the representation of a storagePoolClaim and creates it. Returns the server's representation of the storagePoolClaim, and an error, if there is any. +func (c *FakeStoragePoolClaims) Create(storagePoolClaim *v1alpha1.StoragePoolClaim) (result *v1alpha1.StoragePoolClaim, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(storagepoolclaimsResource, storagePoolClaim), &v1alpha1.StoragePoolClaim{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.StoragePoolClaim), err +} + +// Update takes the representation of a storagePoolClaim and updates it. Returns the server's representation of the storagePoolClaim, and an error, if there is any. +func (c *FakeStoragePoolClaims) Update(storagePoolClaim *v1alpha1.StoragePoolClaim) (result *v1alpha1.StoragePoolClaim, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(storagepoolclaimsResource, storagePoolClaim), &v1alpha1.StoragePoolClaim{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.StoragePoolClaim), err +} + +// Delete takes name of the storagePoolClaim and deletes it. Returns an error if one occurs. +func (c *FakeStoragePoolClaims) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(storagepoolclaimsResource, name), &v1alpha1.StoragePoolClaim{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeStoragePoolClaims) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(storagepoolclaimsResource, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.StoragePoolClaimList{}) + return err +} + +// Patch applies the patch and returns the patched storagePoolClaim. +func (c *FakeStoragePoolClaims) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.StoragePoolClaim, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(storagepoolclaimsResource, name, data, subresources...), &v1alpha1.StoragePoolClaim{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.StoragePoolClaim), err +} diff --git a/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/generated_expansion.go b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/generated_expansion.go new file mode 100644 index 00000000..801ab347 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/generated_expansion.go @@ -0,0 +1,45 @@ +/* +Copyright 2019 The OpenEBS Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +type CASTemplateExpansion interface{} + +type CStorBackupExpansion interface{} + +type CStorCompletedBackupExpansion interface{} + +type CStorPoolExpansion interface{} + +type CStorPoolClusterExpansion interface{} + +type CStorPoolInstanceExpansion interface{} + +type CStorRestoreExpansion interface{} + +type CStorVolumeExpansion interface{} + +type CStorVolumeClaimExpansion interface{} + +type CStorVolumeReplicaExpansion interface{} + +type RunTaskExpansion interface{} + +type StoragePoolExpansion interface{} + +type StoragePoolClaimExpansion interface{} diff --git a/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/openebs.io_client.go b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/openebs.io_client.go new file mode 100644 index 00000000..d4edcfd2 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/openebs.io_client.go @@ -0,0 +1,135 @@ +/* +Copyright 2019 The OpenEBS Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + "github.com/openebs/maya/pkg/client/generated/clientset/versioned/scheme" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + rest "k8s.io/client-go/rest" +) + +type OpenebsV1alpha1Interface interface { + RESTClient() rest.Interface + CASTemplatesGetter + CStorBackupsGetter + CStorCompletedBackupsGetter + CStorPoolsGetter + CStorRestoresGetter + CStorVolumesGetter + CStorVolumeReplicasGetter + RunTasksGetter + StoragePoolsGetter + StoragePoolClaimsGetter +} + +// OpenebsV1alpha1Client is used to interact with features provided by the openebs.io group. +type OpenebsV1alpha1Client struct { + restClient rest.Interface +} + +func (c *OpenebsV1alpha1Client) CASTemplates() CASTemplateInterface { + return newCASTemplates(c) +} + +func (c *OpenebsV1alpha1Client) CStorBackups(namespace string) CStorBackupInterface { + return newCStorBackups(c, namespace) +} + +func (c *OpenebsV1alpha1Client) CStorCompletedBackups(namespace string) CStorCompletedBackupInterface { + return newCStorCompletedBackups(c, namespace) +} + +func (c *OpenebsV1alpha1Client) CStorPools() CStorPoolInterface { + return newCStorPools(c) +} + +func (c *OpenebsV1alpha1Client) CStorRestores(namespace string) CStorRestoreInterface { + return newCStorRestores(c, namespace) +} + +func (c *OpenebsV1alpha1Client) CStorVolumes(namespace string) CStorVolumeInterface { + return newCStorVolumes(c, namespace) +} + +func (c *OpenebsV1alpha1Client) CStorVolumeReplicas(namespace string) CStorVolumeReplicaInterface { + return newCStorVolumeReplicas(c, namespace) +} + +func (c *OpenebsV1alpha1Client) RunTasks(namespace string) RunTaskInterface { + return newRunTasks(c, namespace) +} + +func (c *OpenebsV1alpha1Client) StoragePools() StoragePoolInterface { + return newStoragePools(c) +} + +func (c *OpenebsV1alpha1Client) StoragePoolClaims() StoragePoolClaimInterface { + return newStoragePoolClaims(c) +} + +// NewForConfig creates a new OpenebsV1alpha1Client for the given config. +func NewForConfig(c *rest.Config) (*OpenebsV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &OpenebsV1alpha1Client{client}, nil +} + +// NewForConfigOrDie creates a new OpenebsV1alpha1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *OpenebsV1alpha1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new OpenebsV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *OpenebsV1alpha1Client { + return &OpenebsV1alpha1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1alpha1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs} + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *OpenebsV1alpha1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/runtask.go b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/runtask.go new file mode 100644 index 00000000..ecd84f35 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/runtask.go @@ -0,0 +1,157 @@ +/* +Copyright 2019 The OpenEBS Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + scheme "github.com/openebs/maya/pkg/client/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// RunTasksGetter has a method to return a RunTaskInterface. +// A group's client should implement this interface. +type RunTasksGetter interface { + RunTasks(namespace string) RunTaskInterface +} + +// RunTaskInterface has methods to work with RunTask resources. +type RunTaskInterface interface { + Create(*v1alpha1.RunTask) (*v1alpha1.RunTask, error) + Update(*v1alpha1.RunTask) (*v1alpha1.RunTask, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.RunTask, error) + List(opts v1.ListOptions) (*v1alpha1.RunTaskList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.RunTask, err error) + RunTaskExpansion +} + +// runTasks implements RunTaskInterface +type runTasks struct { + client rest.Interface + ns string +} + +// newRunTasks returns a RunTasks +func newRunTasks(c *OpenebsV1alpha1Client, namespace string) *runTasks { + return &runTasks{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the runTask, and returns the corresponding runTask object, and an error if there is any. +func (c *runTasks) Get(name string, options v1.GetOptions) (result *v1alpha1.RunTask, err error) { + result = &v1alpha1.RunTask{} + err = c.client.Get(). + Namespace(c.ns). + Resource("runtasks"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of RunTasks that match those selectors. +func (c *runTasks) List(opts v1.ListOptions) (result *v1alpha1.RunTaskList, err error) { + result = &v1alpha1.RunTaskList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("runtasks"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested runTasks. +func (c *runTasks) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("runtasks"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a runTask and creates it. Returns the server's representation of the runTask, and an error, if there is any. +func (c *runTasks) Create(runTask *v1alpha1.RunTask) (result *v1alpha1.RunTask, err error) { + result = &v1alpha1.RunTask{} + err = c.client.Post(). + Namespace(c.ns). + Resource("runtasks"). + Body(runTask). + Do(). + Into(result) + return +} + +// Update takes the representation of a runTask and updates it. Returns the server's representation of the runTask, and an error, if there is any. +func (c *runTasks) Update(runTask *v1alpha1.RunTask) (result *v1alpha1.RunTask, err error) { + result = &v1alpha1.RunTask{} + err = c.client.Put(). + Namespace(c.ns). + Resource("runtasks"). + Name(runTask.Name). + Body(runTask). + Do(). + Into(result) + return +} + +// Delete takes name of the runTask and deletes it. Returns an error if one occurs. +func (c *runTasks) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("runtasks"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *runTasks) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("runtasks"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched runTask. +func (c *runTasks) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.RunTask, err error) { + result = &v1alpha1.RunTask{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("runtasks"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/storagepool.go b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/storagepool.go new file mode 100644 index 00000000..c6aaa031 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/storagepool.go @@ -0,0 +1,147 @@ +/* +Copyright 2019 The OpenEBS Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + scheme "github.com/openebs/maya/pkg/client/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// StoragePoolsGetter has a method to return a StoragePoolInterface. +// A group's client should implement this interface. +type StoragePoolsGetter interface { + StoragePools() StoragePoolInterface +} + +// StoragePoolInterface has methods to work with StoragePool resources. +type StoragePoolInterface interface { + Create(*v1alpha1.StoragePool) (*v1alpha1.StoragePool, error) + Update(*v1alpha1.StoragePool) (*v1alpha1.StoragePool, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.StoragePool, error) + List(opts v1.ListOptions) (*v1alpha1.StoragePoolList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.StoragePool, err error) + StoragePoolExpansion +} + +// storagePools implements StoragePoolInterface +type storagePools struct { + client rest.Interface +} + +// newStoragePools returns a StoragePools +func newStoragePools(c *OpenebsV1alpha1Client) *storagePools { + return &storagePools{ + client: c.RESTClient(), + } +} + +// Get takes name of the storagePool, and returns the corresponding storagePool object, and an error if there is any. +func (c *storagePools) Get(name string, options v1.GetOptions) (result *v1alpha1.StoragePool, err error) { + result = &v1alpha1.StoragePool{} + err = c.client.Get(). + Resource("storagepools"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of StoragePools that match those selectors. +func (c *storagePools) List(opts v1.ListOptions) (result *v1alpha1.StoragePoolList, err error) { + result = &v1alpha1.StoragePoolList{} + err = c.client.Get(). + Resource("storagepools"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested storagePools. +func (c *storagePools) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Resource("storagepools"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a storagePool and creates it. Returns the server's representation of the storagePool, and an error, if there is any. +func (c *storagePools) Create(storagePool *v1alpha1.StoragePool) (result *v1alpha1.StoragePool, err error) { + result = &v1alpha1.StoragePool{} + err = c.client.Post(). + Resource("storagepools"). + Body(storagePool). + Do(). + Into(result) + return +} + +// Update takes the representation of a storagePool and updates it. Returns the server's representation of the storagePool, and an error, if there is any. +func (c *storagePools) Update(storagePool *v1alpha1.StoragePool) (result *v1alpha1.StoragePool, err error) { + result = &v1alpha1.StoragePool{} + err = c.client.Put(). + Resource("storagepools"). + Name(storagePool.Name). + Body(storagePool). + Do(). + Into(result) + return +} + +// Delete takes name of the storagePool and deletes it. Returns an error if one occurs. +func (c *storagePools) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Resource("storagepools"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *storagePools) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Resource("storagepools"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched storagePool. +func (c *storagePools) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.StoragePool, err error) { + result = &v1alpha1.StoragePool{} + err = c.client.Patch(pt). + Resource("storagepools"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/storagepoolclaim.go b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/storagepoolclaim.go new file mode 100644 index 00000000..b432a0e3 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/generated/clientset/versioned/typed/openebs.io/v1alpha1/storagepoolclaim.go @@ -0,0 +1,147 @@ +/* +Copyright 2019 The OpenEBS Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + scheme "github.com/openebs/maya/pkg/client/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// StoragePoolClaimsGetter has a method to return a StoragePoolClaimInterface. +// A group's client should implement this interface. +type StoragePoolClaimsGetter interface { + StoragePoolClaims() StoragePoolClaimInterface +} + +// StoragePoolClaimInterface has methods to work with StoragePoolClaim resources. +type StoragePoolClaimInterface interface { + Create(*v1alpha1.StoragePoolClaim) (*v1alpha1.StoragePoolClaim, error) + Update(*v1alpha1.StoragePoolClaim) (*v1alpha1.StoragePoolClaim, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.StoragePoolClaim, error) + List(opts v1.ListOptions) (*v1alpha1.StoragePoolClaimList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.StoragePoolClaim, err error) + StoragePoolClaimExpansion +} + +// storagePoolClaims implements StoragePoolClaimInterface +type storagePoolClaims struct { + client rest.Interface +} + +// newStoragePoolClaims returns a StoragePoolClaims +func newStoragePoolClaims(c *OpenebsV1alpha1Client) *storagePoolClaims { + return &storagePoolClaims{ + client: c.RESTClient(), + } +} + +// Get takes name of the storagePoolClaim, and returns the corresponding storagePoolClaim object, and an error if there is any. +func (c *storagePoolClaims) Get(name string, options v1.GetOptions) (result *v1alpha1.StoragePoolClaim, err error) { + result = &v1alpha1.StoragePoolClaim{} + err = c.client.Get(). + Resource("storagepoolclaims"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of StoragePoolClaims that match those selectors. +func (c *storagePoolClaims) List(opts v1.ListOptions) (result *v1alpha1.StoragePoolClaimList, err error) { + result = &v1alpha1.StoragePoolClaimList{} + err = c.client.Get(). + Resource("storagepoolclaims"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested storagePoolClaims. +func (c *storagePoolClaims) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Resource("storagepoolclaims"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a storagePoolClaim and creates it. Returns the server's representation of the storagePoolClaim, and an error, if there is any. +func (c *storagePoolClaims) Create(storagePoolClaim *v1alpha1.StoragePoolClaim) (result *v1alpha1.StoragePoolClaim, err error) { + result = &v1alpha1.StoragePoolClaim{} + err = c.client.Post(). + Resource("storagepoolclaims"). + Body(storagePoolClaim). + Do(). + Into(result) + return +} + +// Update takes the representation of a storagePoolClaim and updates it. Returns the server's representation of the storagePoolClaim, and an error, if there is any. +func (c *storagePoolClaims) Update(storagePoolClaim *v1alpha1.StoragePoolClaim) (result *v1alpha1.StoragePoolClaim, err error) { + result = &v1alpha1.StoragePoolClaim{} + err = c.client.Put(). + Resource("storagepoolclaims"). + Name(storagePoolClaim.Name). + Body(storagePoolClaim). + Do(). + Into(result) + return +} + +// Delete takes name of the storagePoolClaim and deletes it. Returns an error if one occurs. +func (c *storagePoolClaims) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Resource("storagepoolclaims"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *storagePoolClaims) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Resource("storagepoolclaims"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched storagePoolClaim. +func (c *storagePoolClaims) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.StoragePoolClaim, err error) { + result = &v1alpha1.StoragePoolClaim{} + err = c.client.Patch(pt). + Resource("storagepoolclaims"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +}