github.com/openebs/api@v1.12.0/pkg/apis/openebs.io/v1alpha1/cstorbackup.go (about)

     1  /*
     2  Copyright 2020 The OpenEBS Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package v1alpha1
    18  
    19  import (
    20  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
    21  )
    22  
    23  // +genclient
    24  // +genclient:noStatus
    25  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
    26  // +resource:path=cstorbackup
    27  
    28  // CStorBackup describes a cstor backup resource created as a custom resource
    29  type CStorBackup struct {
    30  	metav1.TypeMeta   `json:",inline"`
    31  	metav1.ObjectMeta `json:"metadata,omitempty"`
    32  	Spec              CStorBackupSpec   `json:"spec"`
    33  	Status            CStorBackupStatus `json:"status"`
    34  }
    35  
    36  // CStorBackupSpec is the spec for a CStorBackup resource
    37  type CStorBackupSpec struct {
    38  	// BackupName is a name of the backup or scheduled backup
    39  	BackupName string `json:"backupName"`
    40  
    41  	// VolumeName is a name of the volume for which this backup is destined
    42  	VolumeName string `json:"volumeName"`
    43  
    44  	// SnapName is a name of the current backup snapshot
    45  	SnapName string `json:"snapName"`
    46  
    47  	// PrevSnapName is the last completed-backup's snapshot name
    48  	PrevSnapName string `json:"prevSnapName"`
    49  
    50  	// BackupDest is the remote address for backup transfer
    51  	BackupDest string `json:"backupDest"`
    52  
    53  	// LocalSnap is flag to enable local snapshot only
    54  	LocalSnap bool `json:"localSnap"`
    55  }
    56  
    57  // CStorBackupStatus is to hold status of backup
    58  type CStorBackupStatus string
    59  
    60  // Status written onto CStorBackup objects.
    61  const (
    62  	// BKPCStorStatusEmpty ensures the create operation is to be done, if import fails.
    63  	BKPCStorStatusEmpty CStorBackupStatus = ""
    64  
    65  	// BKPCStorStatusDone , backup is completed.
    66  	BKPCStorStatusDone CStorBackupStatus = "Done"
    67  
    68  	// BKPCStorStatusFailed , backup is failed.
    69  	BKPCStorStatusFailed CStorBackupStatus = "Failed"
    70  
    71  	// BKPCStorStatusInit , backup is initialized.
    72  	BKPCStorStatusInit CStorBackupStatus = "Init"
    73  
    74  	// BKPCStorStatusPending , backup is pending.
    75  	BKPCStorStatusPending CStorBackupStatus = "Pending"
    76  
    77  	// BKPCStorStatusInProgress , backup is in progress.
    78  	BKPCStorStatusInProgress CStorBackupStatus = "InProgress"
    79  
    80  	// BKPCStorStatusInvalid , backup operation is invalid.
    81  	BKPCStorStatusInvalid CStorBackupStatus = "Invalid"
    82  )
    83  
    84  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
    85  // +resource:path=cstorbackup
    86  
    87  // CStorBackupList is a list of CStorBackup resources
    88  type CStorBackupList struct {
    89  	metav1.TypeMeta `json:",inline"`
    90  	metav1.ListMeta `json:"metadata"`
    91  
    92  	Items []CStorBackup `json:"items"`
    93  }