Files
velero/pkg/itemoperation/shared.go
Scott Seago 70b4238013 Define itemoperations.json format and update DownloadRequest API.
This is to support uploading async operation metadata to
object storage to support progress monitoring.

Signed-off-by: Scott Seago <sseago@redhat.com>
2023-01-09 18:19:21 -05:00

68 lines
2.1 KiB
Go

/*
Copyright the Velero contributors.
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 itemoperation
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// OperationPhase is the lifecycle phase of a Velero item operation
type OperationPhase string
type OperationStatus struct {
// Phase is the current state of the item operation.
Phase OperationPhase `json:"phase,omitempty"`
// Error displays the reason for a failed operation
Error string `json:"error,omitempty"`
// Amount of operation completed (measured in OperationUnits)
// i.e. number of bytes transferred for a volume
NCompleted int64 `json:"nCompleted,omitempty"`
// Total Amount of operation (measured in OperationUnits)
// i.e. volume size in bytes
NTotal int64 `json:"nTotal,omitempty"`
// Units that NCompleted,NTotal are measured in
// i.e. "bytes"
OperationUnits int64 `json:"nTotal,omitempty"`
// Started records the time the item operation was started, if known
// +optional
// +nullable
Started *metav1.Time `json:"start,omitempty"`
// Updated records the time the item operation was updated, if known.
// +optional
// +nullable
Updated *metav1.Time `json:"updated,omitempty"`
}
const (
// OperationPhaseNew means the item operation has been created and started
// by the plugin
OperationPhaseInProgress OperationPhase = "New"
// OperationPhaseCompleted means the item operation was successfully completed
// and can be used for restore.
OperationPhaseCompleted OperationPhase = "Completed"
// OperationPhaseFailed means the item operation ended with an error.
OperationPhaseFailed OperationPhase = "Failed"
)