Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ocp_resources/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ class ApiGroup:
APPS: str = "apps"
APPSTUDIO_REDHAT_COM: str = "appstudio.redhat.com"
AUTHENTICATION_K8S_IO: str = "authentication.k8s.io"
BACKUP_KUBEVIRT_IO: str = "backup.kubevirt.io"
BATCH: str = "batch"
BITNAMI_COM: str = "bitnami.com"
CACHING_INTERNAL_KNATIVE_DEV: str = "caching.internal.knative.dev"
Expand Down
102 changes: 102 additions & 0 deletions ocp_resources/virtual_machine_backup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Generated using https://github.com/RedHatQE/openshift-python-wrapper/blob/main/scripts/resource/README.md

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please regenerate the resources, this has chnaged in #2750



from typing import Any

from ocp_resources.exceptions import MissingRequiredArgumentError
from ocp_resources.resource import NamespacedResource


class VirtualMachineBackup(NamespacedResource):
"""
VirtualMachineBackup defines the operation of backing up a VM
"""

api_group: str = NamespacedResource.ApiGroup.BACKUP_KUBEVIRT_IO

def __init__(
self,
force_full_backup: bool | None = None,
mode: str | None = None,
pvc_name: str | None = None,
skip_quiesce: bool | None = None,
source: dict[str, Any] | None = None,
token_secret_ref: str | None = None,
ttl_duration: str | None = None,
**kwargs: Any,
) -> None:
r"""
Args:
force_full_backup (bool): ForceFullBackup indicates that a full backup is desired

mode (str): Mode specifies the way the backup output will be recieved

pvc_name (str): PvcName required in push mode. Specifies the name of the PVC where the
backup output will be stored

skip_quiesce (bool): SkipQuiesce indicates whether the VM's filesystem shoule not be
quiesced before the backup

source (dict[str, Any]): Source specifies the backup source - either a VirtualMachine or a
VirtualMachineBackupTracker. When Kind is VirtualMachine: performs
a backup of the specified VM. When Kind is
VirtualMachineBackupTracker: uses the tracker to get the source VM
and the base checkpoint for incremental backup. The tracker will
be updated with the new checkpoint after backup completion.

token_secret_ref (str): TokenSecretRef is the name of the secret that will be used to pull the
backup from an associated endpoint

ttl_duration (str): TtlDuration limits the lifetime of a pull mode backup and its export
If this field is set, after this duration has passed from counting
from CreationTimestamp, the backup is eligible to be automatically
considered as complete. If this field is omitted, a reasonable
default is applied.

"""
super().__init__(**kwargs)

self.force_full_backup = force_full_backup
self.mode = mode
self.pvc_name = pvc_name
self.skip_quiesce = skip_quiesce
self.source = source
self.token_secret_ref = token_secret_ref
self.ttl_duration = ttl_duration

def to_dict(self) -> None:

super().to_dict()

if not self.kind_dict and not self.yaml_file:
if self.source is None:
raise MissingRequiredArgumentError(argument="self.source")

self.res["spec"] = {}
_spec = self.res["spec"]

_spec["source"] = self.source

if self.force_full_backup is not None:
_spec["forceFullBackup"] = self.force_full_backup

if self.mode is not None:
_spec["mode"] = self.mode

if self.pvc_name is not None:
_spec["pvcName"] = self.pvc_name

if self.skip_quiesce is not None:
_spec["skipQuiesce"] = self.skip_quiesce

if self.token_secret_ref is not None:
_spec["tokenSecretRef"] = self.token_secret_ref

if self.ttl_duration is not None:
_spec["ttlDuration"] = self.ttl_duration

# End of generated code

class Mode:
PUSH: str = "Push"
PULL: str = "Pull"
45 changes: 45 additions & 0 deletions ocp_resources/virtual_machine_backup_tracker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Generated using https://github.com/RedHatQE/openshift-python-wrapper/blob/main/scripts/resource/README.md


from typing import Any

from ocp_resources.exceptions import MissingRequiredArgumentError
from ocp_resources.resource import NamespacedResource


class VirtualMachineBackupTracker(NamespacedResource):
"""
VirtualMachineBackupTracker defines the way to track the latest checkpoint of
a backup solution for a vm
"""

api_group: str = NamespacedResource.ApiGroup.BACKUP_KUBEVIRT_IO

def __init__(
self,
source: dict[str, Any] | None = None,
**kwargs: Any,
) -> None:
r"""
Args:
source (dict[str, Any]): Source specifies the VM that this backupTracker is associated with

"""
super().__init__(**kwargs)

self.source = source

def to_dict(self) -> None:

super().to_dict()

if not self.kind_dict and not self.yaml_file:
if self.source is None:
raise MissingRequiredArgumentError(argument="self.source")

self.res["spec"] = {}
_spec = self.res["spec"]

_spec["source"] = self.source

# End of generated code