-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: add PVEVolume and PVEBackupJob classes
- Loading branch information
Showing
5 changed files
with
66 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
class PVEBackupJob: | ||
"""Proxmox VE Backup Job""" | ||
|
||
_default_kwargs = { | ||
"compress": None, | ||
"enabled": None, | ||
"fleecing": None, | ||
"mode": None, | ||
"next-run": None, | ||
"notes-template": None, | ||
"prune-backups": None, | ||
"schedule": None, | ||
"storage": None, | ||
"type": None, | ||
"vmid": None, | ||
} | ||
|
||
def __init__(self, backup_id, **kwargs): | ||
self.id = backup_id | ||
|
||
for k, v in self._default_kwargs.items(): | ||
self.__setattr__(k, kwargs.get(k, v)) | ||
|
||
def __str__(self): | ||
output = f"Vm(s): {self.vmid}\n" + f"Id: {self.id}\n" | ||
for key in self._default_kwargs: | ||
output += f"{key.capitalize()}: {self.__getattribute__(key)}\n" | ||
return output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
class PVEVolume: | ||
"""Proxmox VE Volume""" | ||
|
||
_default_kwargs = { | ||
"content": None, | ||
"ctime": None, | ||
"encrypted": None, | ||
"notes": None, | ||
"parent": None, | ||
"path": None, | ||
"protected": None, | ||
"subtype": None, | ||
"used": None, | ||
"verification": None, | ||
"vmid": None, | ||
} | ||
|
||
def __init__(self, volid, volume_format, size, **kwargs): | ||
self.volid = volid | ||
self.format = volume_format | ||
self.size = size | ||
|
||
for k, v in self._default_kwargs.items(): | ||
self.__setattr__(k, kwargs.get(k, v)) |