Skip to content

Commit

Permalink
Modify BackupOverview API (#140)
Browse files Browse the repository at this point in the history
Signed-off-by: Pulak Kanti Bhowmick <[email protected]>
  • Loading branch information
pkbhowmick authored Jan 8, 2022
1 parent c60601b commit d19cc47
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 38 deletions.
35 changes: 25 additions & 10 deletions apis/ui/v1alpha1/backup_overview_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,30 @@ const (
ResourceBackupOverviews = "backupoverviews"
)

// BackupOverviewSpec defines the desired state of BackupOverview
type BackupOverviewSpec struct {
// BackupOverviewRequest defines the request fields of BackupOverview
type BackupOverviewRequest struct {
Group string `json:"group" protobuf:"bytes,1,opt,name=group"`
Version string `json:"version" protobuf:"version,2,opt,name=version"`
Resource string `json:"resource" protobuf:"resource,3,opt,name=resource"`
}

type BackupStatus string

const (
BackupStatusActive = "Active"
BackupStatusPaused = "Paused"
)

// BackupOverviewResponse defines the response fields of BackupOverview
type BackupOverviewResponse struct {
Schedule string `json:"schedule,omitempty" protobuf:"bytes,1,opt,name=schedule"`
LastBackupTime *metav1.Time `json:"lastBackupTime,omitempty" protobuf:"bytes,2,opt,name=lastBackupTime"`
UpcomingBackupTime *metav1.Time `json:"upcomingBackupTime,omitempty" protobuf:"bytes,3,opt,name=upcomingBackupTime"`
BackupStorage string `json:"backupStorage,omitempty" protobuf:"bytes,4,opt,name=backupStorage"`
DataSize string `json:"dataSize" protobuf:"bytes,5,opt,name=dataSize"`
NumberOfSnapshots int64 `json:"numberOfSnapshots,omitempty" protobuf:"bytes,6,opt,name=numberOfSnapshots"`
DataIntegrity bool `json:"dataIntegrity,omitempty" protobuf:"bytes,7,opt,name=dataIntegrity"`
DataDirectory string `json:"dataDirectory,omitempty" protobuf:"bytes,8,opt,name=dataDirectory"`
Status BackupStatus `json:"status,omitempty" protobuf:"bytes,2,opt,name=status"`
LastBackupTime *metav1.Time `json:"lastBackupTime,omitempty" protobuf:"bytes,3,opt,name=lastBackupTime"`
UpcomingBackupTime *metav1.Time `json:"upcomingBackupTime,omitempty" protobuf:"bytes,4,opt,name=upcomingBackupTime"`
Repository string `json:"repository,omitempty" protobuf:"bytes,5,opt,name=repository"`
DataSize string `json:"dataSize,omitempty" protobuf:"bytes,6,opt,name=dataSize"`
NumberOfSnapshots int64 `json:"numberOfSnapshots,omitempty" protobuf:"bytes,7,opt,name=numberOfSnapshots"`
DataIntegrity bool `json:"dataIntegrity,omitempty" protobuf:"bytes,8,opt,name=dataIntegrity"`
}

// BackupOverview is the Schema for the BackupOverviews API
Expand All @@ -45,7 +59,8 @@ type BackupOverview struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`

Spec BackupOverviewSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
Request BackupOverviewRequest `json:"request,omitempty" protobuf:"bytes,2,opt,name=request"`
Response BackupOverviewResponse `json:"response,omitempty" protobuf:"bytes,3,opt,name=response"`
}

// BackupOverviewList contains a list of BackupOverview
Expand Down
74 changes: 57 additions & 17 deletions apis/ui/v1alpha1/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 22 additions & 5 deletions apis/ui/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 18 additions & 6 deletions crds/ui.stash.appscode.com_backupoverviews.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,23 @@ spec:
type: string
metadata:
type: object
spec:
description: BackupOverviewSpec defines the desired state of BackupOverview
request:
description: BackupOverviewRequest defines the request fields of BackupOverview
properties:
backupStorage:
group:
type: string
dataDirectory:
resource:
type: string
version:
type: string
required:
- group
- resource
- version
type: object
response:
description: BackupOverviewResponse defines the response fields of BackupOverview
properties:
dataIntegrity:
type: boolean
dataSize:
Expand All @@ -47,13 +57,15 @@ spec:
numberOfSnapshots:
format: int64
type: integer
repository:
type: string
schedule:
type: string
status:
type: string
upcomingBackupTime:
format: date-time
type: string
required:
- dataSize
type: object
type: object
served: true
Expand Down

0 comments on commit d19cc47

Please sign in to comment.