{
  "description": "VirtualMachineBackup defines the operation of backing up a VM",
  "properties": {
    "apiVersion": {
      "description": "APIVersion defines the versioned schema of this representation of an object.\nServers should convert recognized schemas to the latest internal value, and\nmay reject unrecognized values.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
      "type": "string"
    },
    "kind": {
      "description": "Kind is a string value representing the REST resource this object represents.\nServers may infer this from the endpoint the client submits requests to.\nCannot be updated.\nIn CamelCase.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
      "type": "string"
    },
    "metadata": {
      "type": "object"
    },
    "spec": {
      "description": "VirtualMachineBackupSpec is the spec for a VirtualMachineBackup resource",
      "properties": {
        "forceFullBackup": {
          "description": "ForceFullBackup indicates that a full backup is desired",
          "type": "boolean"
        },
        "mode": {
          "description": "Mode specifies the way the backup output will be recieved",
          "enum": [
            "Push",
            "Pull"
          ],
          "type": "string"
        },
        "pvcName": {
          "description": "PvcName required in push mode. Specifies the name of the PVC\nwhere the backup output will be stored",
          "type": "string"
        },
        "skipQuiesce": {
          "description": "SkipQuiesce indicates whether the VM's filesystem shoule not be quiesced before the backup",
          "type": "boolean"
        },
        "source": {
          "description": "Source specifies the backup source - either a VirtualMachine or a VirtualMachineBackupTracker.\nWhen Kind is VirtualMachine: performs a backup of the specified VM.\nWhen Kind is VirtualMachineBackupTracker: uses the tracker to get the source VM\nand the base checkpoint for incremental backup. The tracker will be updated\nwith the new checkpoint after backup completion.",
          "properties": {
            "apiGroup": {
              "description": "APIGroup is the group for the resource being referenced.\nIf APIGroup is not specified, the specified Kind must be in the core API group.\nFor any other third-party types, APIGroup is required.",
              "type": "string"
            },
            "kind": {
              "description": "Kind is the type of resource being referenced",
              "type": "string"
            },
            "name": {
              "description": "Name is the name of resource being referenced",
              "type": "string"
            }
          },
          "required": [
            "kind",
            "name"
          ],
          "type": "object",
          "x-kubernetes-map-type": "atomic",
          "x-kubernetes-validations": [
            {
              "message": "apiGroup is required",
              "rule": "has(self.apiGroup)"
            },
            {
              "message": "apiGroup must be kubevirt.io or backup.kubevirt.io",
              "rule": "!has(self.apiGroup) || self.apiGroup == 'kubevirt.io' || self.apiGroup == 'backup.kubevirt.io'"
            },
            {
              "message": "kind must be VirtualMachine for kubevirt.io or VirtualMachineBackupTracker for backup.kubevirt.io",
              "rule": "!has(self.apiGroup) || (self.apiGroup == 'kubevirt.io' && self.kind == 'VirtualMachine') || (self.apiGroup == 'backup.kubevirt.io' && self.kind == 'VirtualMachineBackupTracker')"
            },
            {
              "message": "name is required",
              "rule": "self.name != ''"
            }
          ],
          "additionalProperties": false
        },
        "tokenSecretRef": {
          "description": "TokenSecretRef is the name of the secret that\nwill be used to pull the backup from an associated endpoint",
          "type": "string"
        },
        "ttlDuration": {
          "description": "TtlDuration limits the lifetime of a pull mode backup and its export\nIf this field is set, after this duration has passed from counting from CreationTimestamp,\nthe backup is eligible to be automatically considered as complete.\nIf this field is omitted, a reasonable default is applied.",
          "type": "string"
        }
      },
      "required": [
        "source"
      ],
      "type": "object",
      "x-kubernetes-validations": [
        {
          "message": "spec is immutable after creation",
          "rule": "self == oldSelf"
        },
        {
          "message": "pvcName is required",
          "rule": "has(self.pvcName) && self.pvcName != \"\""
        },
        {
          "message": "tokenSecretRef is required when mode is Pull",
          "rule": "!has(self.mode) || self.mode != 'Pull' || (has(self.tokenSecretRef) && self.tokenSecretRef != \"\")"
        }
      ],
      "additionalProperties": false
    },
    "status": {
      "description": "VirtualMachineBackupStatus is the status for a VirtualMachineBackup resource",
      "properties": {
        "checkpointName": {
          "description": "CheckpointName the name of the checkpoint created for the current backup",
          "type": "string"
        },
        "conditions": {
          "items": {
            "description": "Condition defines conditions",
            "properties": {
              "lastProbeTime": {
                "format": "date-time",
                "nullable": true,
                "type": "string"
              },
              "lastTransitionTime": {
                "format": "date-time",
                "nullable": true,
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "reason": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "type": {
                "description": "ConditionType is the const type for Conditions",
                "type": "string"
              }
            },
            "required": [
              "status",
              "type"
            ],
            "type": "object",
            "additionalProperties": false
          },
          "type": "array",
          "x-kubernetes-list-type": "atomic"
        },
        "endpointCert": {
          "description": "EndpointCert is the raw CACert that is to be used when connecting\nto an exported backup endpoint in pull mode.",
          "type": "string"
        },
        "includedVolumes": {
          "description": "IncludedVolumes lists the volumes that were included in the backup",
          "items": {
            "description": "BackupVolumeInfo contains information about a volume included in a backup",
            "properties": {
              "dataEndpoint": {
                "description": "DataEndpoint is the URL of the endpoint for read for pull mode",
                "type": "string"
              },
              "diskTarget": {
                "description": "DiskTarget is the disk target device name at backup time",
                "type": "string"
              },
              "mapEndpoint": {
                "description": "MapEndpoint is the URL of the endpoint for map for pull mode",
                "type": "string"
              },
              "volumeName": {
                "description": "VolumeName is the volume name from VMI spec",
                "type": "string"
              }
            },
            "required": [
              "diskTarget",
              "volumeName"
            ],
            "type": "object",
            "additionalProperties": false
          },
          "type": "array",
          "x-kubernetes-list-type": "atomic"
        },
        "type": {
          "description": "Type indicates if the backup was full or incremental",
          "type": "string"
        }
      },
      "type": "object",
      "additionalProperties": false
    }
  },
  "required": [
    "spec"
  ],
  "type": "object"
}
