Skip to content

Commit

Permalink
shared/api: Add swagger metadata for storage volume backups
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Graber <[email protected]>
  • Loading branch information
stgraber committed Jun 9, 2021
1 parent dc0601d commit 0bb12cb
Showing 1 changed file with 49 additions and 13 deletions.
62 changes: 49 additions & 13 deletions shared/api/storage_pool_volume_backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,68 @@ package api

import "time"

// StoragePoolVolumeBackup represents a LXD volume backup.
// StoragePoolVolumeBackup represents a LXD volume backup
//
// swagger:model
//
// API extension: custom_volume_backup
type StoragePoolVolumeBackup struct {
Name string `json:"name" yaml:"name"`
CreatedAt time.Time `json:"created_at" yaml:"created_at"`
ExpiresAt time.Time `json:"expires_at" yaml:"expires_at"`
VolumeOnly bool `json:"volume_only" yaml:"volume_only"`
OptimizedStorage bool `json:"optimized_storage" yaml:"optimized_storage"`
// Backup name
// Example: backup0
Name string `json:"name" yaml:"name"`

// When the backup was cerated
// Example: 2021-03-23T16:38:37.753398689-04:00
CreatedAt time.Time `json:"created_at" yaml:"created_at"`

// When the backup expires (gets auto-deleted)
// Example: 2021-03-23T17:38:37.753398689-04:00
ExpiresAt time.Time `json:"expires_at" yaml:"expires_at"`

// Whether to ignore snapshots
// Example: false
VolumeOnly bool `json:"volume_only" yaml:"volume_only"`

// Whether to use a pool-optimized binary format (instead of plain tarball)
// Example: true
OptimizedStorage bool `json:"optimized_storage" yaml:"optimized_storage"`
}

// StoragePoolVolumeBackupsPost represents the fields available for a new LXD volume backup.
// StoragePoolVolumeBackupsPost represents the fields available for a new LXD volume backup
//
// swagger:model
//
// API extension: custom_volume_backup
type StoragePoolVolumeBackupsPost struct {
Name string `json:"name" yaml:"name"`
ExpiresAt time.Time `json:"expires_at" yaml:"expires_at"`
VolumeOnly bool `json:"volume_only" yaml:"volume_only"`
OptimizedStorage bool `json:"optimized_storage" yaml:"optimized_storage"`
CompressionAlgorithm string `json:"compression_algorithm" yaml:"compression_algorithm"`
// Backup name
// Example: backup0
Name string `json:"name" yaml:"name"`

// When the backup expires (gets auto-deleted)
// Example: 2021-03-23T17:38:37.753398689-04:00
ExpiresAt time.Time `json:"expires_at" yaml:"expires_at"`

// Whether to ignore snapshots
// Example: false
VolumeOnly bool `json:"volume_only" yaml:"volume_only"`

// Whether to use a pool-optimized binary format (instead of plain tarball)
// Example: true
OptimizedStorage bool `json:"optimized_storage" yaml:"optimized_storage"`

// What compression algorithm to use
// Example: gzip
CompressionAlgorithm string `json:"compression_algorithm" yaml:"compression_algorithm"`
}

// StoragePoolVolumeBackupPost represents the fields available for the renaming of a volume backup.
// StoragePoolVolumeBackupPost represents the fields available for the renaming of a volume backup
//
// swagger:model
//
// API extension: custom_volume_backup
type StoragePoolVolumeBackupPost struct {
// New backup name
// Example: backup1
Name string `json:"name" yaml:"name"`
}

Expand Down

0 comments on commit 0bb12cb

Please sign in to comment.