From 876c264580ac7ef42c6a36e404911b8f2a9ff994 Mon Sep 17 00:00:00 2001 From: Anja Strunk Date: Thu, 16 Nov 2023 13:42:23 +0100 Subject: [PATCH] Update python classes Signed-off-by: Anja Strunk --- generator/common/gx-schema.py | 16 ++++----- generator/gx_schema/code_artifact.py | 14 -------- generator/gx_schema/cpu.py | 36 -------------------- generator/gx_schema/credential.py | 8 ----- generator/gx_schema/cyptography.py | 0 generator/gx_schema/image.py | 32 ------------------ generator/gx_schema/operation_system.py | 26 -------------- generator/gx_schema/participant.py | 14 -------- generator/gx_schema/resource.py | 17 ---------- generator/gx_schema/software_resource.py | 43 ------------------------ generator/gx_schema/virtual_resource.py | 26 -------------- generator/gx_schema/vm_image.py | 17 ---------- 12 files changed, 8 insertions(+), 241 deletions(-) delete mode 100644 generator/gx_schema/code_artifact.py delete mode 100644 generator/gx_schema/cpu.py delete mode 100644 generator/gx_schema/credential.py delete mode 100644 generator/gx_schema/cyptography.py delete mode 100644 generator/gx_schema/image.py delete mode 100644 generator/gx_schema/operation_system.py delete mode 100644 generator/gx_schema/participant.py delete mode 100644 generator/gx_schema/resource.py delete mode 100644 generator/gx_schema/software_resource.py delete mode 100644 generator/gx_schema/virtual_resource.py delete mode 100644 generator/gx_schema/vm_image.py diff --git a/generator/common/gx-schema.py b/generator/common/gx-schema.py index 9ffe1d3..d519c1d 100644 --- a/generator/common/gx-schema.py +++ b/generator/common/gx-schema.py @@ -1,5 +1,5 @@ # Auto generated from gaia-x.yaml by pythongen.py version: 0.0.1 -# Generation date: 2023-11-16T13:30:52 +# Generation date: 2023-11-16T13:40:58 # Schema: gaia-x # # id: http://w3id.org/gaia-x/gx-trust-framework/gaia-x @@ -475,16 +475,16 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass -class Latest-N(YAMLRoot): +class LatestN(YAMLRoot): """ Number of latest N outdated image versions, which will be valid. """ _inherited_slots: ClassVar[List[str]] = [] - class_class_uri: ClassVar[URIRef] = GX["Latest-N"] - class_class_curie: ClassVar[str] = "gx:Latest-N" - class_name: ClassVar[str] = "Latest-N" - class_model_uri: ClassVar[URIRef] = GX.Latest-N + class_class_uri: ClassVar[URIRef] = GX.LatestN + class_class_curie: ClassVar[str] = "gx:LatestN" + class_name: ClassVar[str] = "Latest_N" + class_model_uri: ClassVar[URIRef] = GX.LatestN value: Optional[int] = None @@ -8740,8 +8740,8 @@ class slots: slots.updateStrategy__providedUntil = Slot(uri=GX.providedUntil, name="updateStrategy__providedUntil", curie=GX.curie('providedUntil'), model_uri=GX.updateStrategy__providedUntil, domain=None, range=Optional[str]) -slots.latest_N__value = Slot(uri=GX.value, name="latest-N__value", curie=GX.curie('value'), - model_uri=GX.latest_N__value, domain=None, range=Optional[int]) +slots.latestN__value = Slot(uri=GX.value, name="latestN__value", curie=GX.curie('value'), + model_uri=GX.latestN__value, domain=None, range=Optional[int]) slots.issuer__issuerTermsAndConditions = Slot(uri=GX.issuerTermsAndConditions, name="issuer__issuerTermsAndConditions", curie=GX.curie('issuerTermsAndConditions'), model_uri=GX.issuer__issuerTermsAndConditions, domain=None, range=Union[str, "GaiaXTermsAndConditions"]) diff --git a/generator/gx_schema/code_artifact.py b/generator/gx_schema/code_artifact.py deleted file mode 100644 index ef2c7d8..0000000 --- a/generator/gx_schema/code_artifact.py +++ /dev/null @@ -1,14 +0,0 @@ -""""" -These classe reflect the class 'CodeArtifact' of Gaia-X Credential schema. -""" -from generator.gx.gx_credential import GxCredential - - - -class CodeArtifact(GxCredential): - - def __init__(self, ) -> None: - pass - - def generate_gx_cred(self) -> str: - return super().generate_gx_cred() diff --git a/generator/gx_schema/cpu.py b/generator/gx_schema/cpu.py deleted file mode 100644 index 62689cb..0000000 --- a/generator/gx_schema/cpu.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env python3 -# vim: set ts=4 sw=4 et: -# -# cpu.py -""" -These classes reflect the Gaia-X view on physical infra - -(c) Kurt Garloff , 3/2022 - 6/2022 -SPDX-License-Identifier: EPL-2.0 -""" - - -class CPU: - "CPU abstraction according to Gaia-X attributes" - def __init__(self): - "c'tor setting all vals to defaults" - # Gaia-X attrs - self.numberOfCores = 0 - self.numberOfThreads = 0 - self.frequency = 0 - self.boostFrequency = 0 - self.cacheSize = 0 - # This would not be interesting typically - self.allowedSocket = "" - # Virt. attrs -- not in GaX - self.dedicatedCore = False - self.dedicatedThread = False - self.limitOversubscr = False - - -class MEM: - "RAM of an instance" - def __init__(self): - "c'tor setting all vals to defaults" - self.memGB = 0 - self.ECC = True diff --git a/generator/gx_schema/credential.py b/generator/gx_schema/credential.py deleted file mode 100644 index a687cea..0000000 --- a/generator/gx_schema/credential.py +++ /dev/null @@ -1,8 +0,0 @@ -from abc import ABC -from abc import abstractmethod - - -class GxCredential(ABC): - @abstractmethod - def generate_gx_cred(self) -> str: - return "" diff --git a/generator/gx_schema/cyptography.py b/generator/gx_schema/cyptography.py deleted file mode 100644 index e69de29..0000000 diff --git a/generator/gx_schema/image.py b/generator/gx_schema/image.py deleted file mode 100644 index ed83c1f..0000000 --- a/generator/gx_schema/image.py +++ /dev/null @@ -1,32 +0,0 @@ -from code_artifact import CodeArtifact -""""" -This class reflects the class 'Image' of Gaia-X Credential schema. - -""" - -from cpu import CPU - -class Image(CodeArtifact): - - def __init__(self, - fileSize: int, - operatingSystem: str, - cpuReq: CPU, - gpuReq: GPU, - ramReq: Memory, - videoRamSize: int, - rootDiskReq: Disk, - encryption: Enrcyption, - secureBoot: boolean, - vPMU: boolean, - updateStrategfy: UpdateStrategy, - license_included: boolean, - maintenance: Maintenance ) -> None: - pass - - def generate_gx_cred(self) -> str: - return super().generate_gx_cred() - - - - diff --git a/generator/gx_schema/operation_system.py b/generator/gx_schema/operation_system.py deleted file mode 100644 index 7eebf0d..0000000 --- a/generator/gx_schema/operation_system.py +++ /dev/null @@ -1,26 +0,0 @@ -""""" -These classe reflect the class 'VirtualResource' of Gaia-X Credential schema. -""" - -from __future__ import annotations - -from generator.gx_schema.resource import Resource -from generator.gx_schema.participant import Participant - -from typing import Union - - -class VirtualResource(Resource): - copyright_owned_by: Union[str, Participant] - license: str - resource_policy: str - - def __init__(self, copyright_owned_by: Union[str, Participant], license: str, - resource_policy: str, aggregation_of_resources: Resource = None) -> None: - super().__init__(aggregation_of_resources=aggregation_of_resources) - self.copyright_owned_by = copyright_owned_by - self.license = license - self.resource_policy = resource_policy - - def generate_gx_cred(self) -> str: - return super().generate_gx_cred() diff --git a/generator/gx_schema/participant.py b/generator/gx_schema/participant.py deleted file mode 100644 index ef2c7d8..0000000 --- a/generator/gx_schema/participant.py +++ /dev/null @@ -1,14 +0,0 @@ -""""" -These classe reflect the class 'CodeArtifact' of Gaia-X Credential schema. -""" -from generator.gx.gx_credential import GxCredential - - - -class CodeArtifact(GxCredential): - - def __init__(self, ) -> None: - pass - - def generate_gx_cred(self) -> str: - return super().generate_gx_cred() diff --git a/generator/gx_schema/resource.py b/generator/gx_schema/resource.py deleted file mode 100644 index 70bd985..0000000 --- a/generator/gx_schema/resource.py +++ /dev/null @@ -1,17 +0,0 @@ -""""" -These classe reflect the class 'Resource' of Gaia-X Credential schema. -""" - -from __future__ import annotations - -from generator.gx.gx_credential import GxCredential - - -class Resource(GxCredential): - aggregation_of_resources: Resource - - def __init__(self, aggregation_of_resources: Resource = None) -> None: - self.aggregation_of_resources = aggregation_of_resources - - def generate_gx_cred(self) -> str: - return super().generate_gx_cred() diff --git a/generator/gx_schema/software_resource.py b/generator/gx_schema/software_resource.py deleted file mode 100644 index 5c24cdd..0000000 --- a/generator/gx_schema/software_resource.py +++ /dev/null @@ -1,43 +0,0 @@ -""""" -These classe reflect the class 'SoftwareResource' of Gaia-X Credential schema. -""" - -from __future__ import annotations - -from generator.gx_schema.resource import Resource -from generator.gx_schema.participant import Participant - -from typing import Union - - -class SoftwareResource(Resource): - checksum: HypervisorType - signature: HypervisorType - version: HypervisorType - patch_level: Location - buidl_date: Location - - def __init__(self, checksum: HypervisorType, signature: HypervisorType, version: HypervisorType, - patch_level: Location, buidl_date: Location) -> None: - self.checksum = checksum - self.signature = signature - self.version = version - self.patch_level = patch_level - self.buidl_date = buidl_date - - - - - copyright_owned_by: Union[str, Participant] - license: str - resource_policy: str - - def __init__(self, copyright_owned_by: Union[str, Participant], license: str, - resource_policy: str, aggregation_of_resources: Resource = None) -> None: - super().__init__(aggregation_of_resources=aggregation_of_resources) - self.copyright_owned_by = copyright_owned_by - self.license = license - self.resource_policy = resource_policy - - def generate_gx_cred(self) -> str: - return super().generate_gx_cred() diff --git a/generator/gx_schema/virtual_resource.py b/generator/gx_schema/virtual_resource.py deleted file mode 100644 index 7eebf0d..0000000 --- a/generator/gx_schema/virtual_resource.py +++ /dev/null @@ -1,26 +0,0 @@ -""""" -These classe reflect the class 'VirtualResource' of Gaia-X Credential schema. -""" - -from __future__ import annotations - -from generator.gx_schema.resource import Resource -from generator.gx_schema.participant import Participant - -from typing import Union - - -class VirtualResource(Resource): - copyright_owned_by: Union[str, Participant] - license: str - resource_policy: str - - def __init__(self, copyright_owned_by: Union[str, Participant], license: str, - resource_policy: str, aggregation_of_resources: Resource = None) -> None: - super().__init__(aggregation_of_resources=aggregation_of_resources) - self.copyright_owned_by = copyright_owned_by - self.license = license - self.resource_policy = resource_policy - - def generate_gx_cred(self) -> str: - return super().generate_gx_cred() diff --git a/generator/gx_schema/vm_image.py b/generator/gx_schema/vm_image.py deleted file mode 100644 index bc557b6..0000000 --- a/generator/gx_schema/vm_image.py +++ /dev/null @@ -1,17 +0,0 @@ -class VmImage(): - - def __init__(self, - fileSize: int, - operatingSystem: str, - diskFormat: str, - hypervisorType: str, - firmwareType: str, - hwRngTypeOfImage: str, - watchDogAction: strl, - cpuReq: CPU) -> None: - pass - - - - -