Skip to content

Modern Docker Management, Designed for Everyone

1.4 KB
Raw Blame
package volume

import "github.com/getarcaneapp/arcane/types/v2/workspace"

const (
	FileOpCreateFile   = workspace.FileOpCreateFile
	FileOpCreateFolder = workspace.FileOpCreateFolder
	FileOpUpdateFile   = workspace.FileOpUpdateFile
	FileOpRename       = workspace.FileOpRename
	FileOpMove         = workspace.FileOpMove
	FileOpDelete       = workspace.FileOpDelete
	FileOpRestoreFile  = "restore_file"
)

type WorkspaceFileChange struct {
	Operation     string `json:"operation" binding:"required" enum:"create_file,create_folder,update_file,rename,move,delete,restore_file"`
	RelativePath  string `json:"relativePath" binding:"required"`
	NewName       string `json:"newName,omitempty"`
	NewParentPath string `json:"newParentPath,omitempty"`
	UploadIndex   *int   `json:"uploadIndex,omitempty" minimum:"0"`
	// BaselineIndex references an uploaded copy of the content an update_file
	// change was drafted against. The volume workspace revision is already
	// content-aware, so the baseline is accepted for API symmetry with
	// project workspaces but not separately compared.
	BaselineIndex *int   `json:"baselineIndex,omitempty" minimum:"0"`
	BackupID      string `json:"backupId,omitempty"`
	Recursive     bool   `json:"recursive,omitempty"`
}

type WorkspaceUpdateManifest struct {
	FileTreeRevision string                `json:"fileTreeRevision" binding:"required"`
	FileChanges      []WorkspaceFileChange `json:"fileChanges" binding:"required" minItems:"1" maxItems:"500"`
}