class documentation
class Factory:
Factory for creating resources.
| Method | get |
Get the resource class for a given resource type. |
| Method | init |
Initialize the resource factory. |
| Method | resource |
Create a resource from a dictionary structure. |
| Instance Variable | resource |
Mapping of resource types to their corresponding resource classes and factory callables. The factory callable is used to create an instance of the resource class from a dictionary. |
Get the resource class for a given resource type.
| Parameters | |
ty:ResourceTypes | The resource type. |
| Returns | |
type[ | The resource class for the given resource type, or None if not found. |
def resourceFromDict(self, resDict:
JSON | None = {}, pi: str | None = None, ty: ResourceTypes | None = None, create: bool | None = False, template: bool | None = False, trusted: bool = True) -> Resource:
¶
Create a resource from a dictionary structure.
This function will not call the resource's activate() method, therefore some attributes may need to be set separately.
| Parameters | |
resJSON | None | Dictionary with the resource definition. |
pi:str | None | The parent's resource ID. |
ty:ResourceTypes | None | The resource type of the resource that shall be created. |
create:bool | None | The resource will be newly created. |
template:bool | None | True when the resource is used as a template. In this case some checks may not be performed. |
trusted:bool | True when the resource is created from a trusted source, such as an internal process, or was already validated. |
| Returns | |
Resource | Result object with the resource attribute set to the created resource object. |