loadero_python.resources.resource module
Describes generics and utility functions of Loadero resources.
- class loadero_python.resources.resource.DuplicateResourceBodyParams(name: str | None = None)[source]
Bases:
LoaderoResourceParamsDuplicate resource body params.
- class loadero_python.resources.resource.FilterKey(value)[source]
Bases:
EnumFilterKey is a base class that all resource filter keys inherit form.
- class loadero_python.resources.resource.LoaderoResource(params: LoaderoResourceParams)[source]
Bases:
objectBase class for Loadero resources.
- All Loadero resources have
params attribute that contains the resources data.
__str__ method.
- class loadero_python.resources.resource.LoaderoResourceParams(**kwargs)[source]
Bases:
ParamsSerializerBase class for Loadero resource params.
- class loadero_python.resources.resource.ParamsSerializer(attribute_map: dict[str, str] = {}, custom_deserializers: dict[str, Any] = {}, body_attributes: list[str] = [], required_body_attributes: list[str] = [])[source]
Bases:
SerializableParamsSerializer implements Serializable for Loadero resource params.
- from_dict(json_dict: Dict[str, Any]) ParamsSerializer[source]
Sets the attributes of the resource params object from a JSON representation.
- Args:
json_dict (dict[str, any]): JSON parsed as dictionary representation of the resource.
- Returns:
ParamsSerializer: The resource params object.
- class loadero_python.resources.resource.QueryParams[source]
Bases:
objectQueryParams allows setting pagination settings an filters for requests.
- filter(key: FilterKey, *values: Any) QueryParams[source]
Set filter for read all operation.
- Args:
key (ResourceFilters): Filter key.
value (any): Filter value. Variadic argument.
- Returns:
QueryParams: QueryParams with filter set.
- limit(limit: int) QueryParams[source]
Set maximum number of resources to return in a single read all operation.
- Args:
limit (int): Maximum number of resources to return.
- Returns:
QueryParams: QueryParams with limit set.
- offset(offset: int) QueryParams[source]
Set the number of resources the read all response should be offset by.
- Args:
offset (int): Offset of resources.
- Returns:
QueryParams: QueryParams with offset set.
- class loadero_python.resources.resource.Serializable[source]
Bases:
objectBase class for serializable objects. Serializable objects can be converted to and from JSON using Python dictionary as a JSON representation.
- from_dict(_: Dict[str, Any]) Serializable[source]
Returns an instance of the object from a dictionary.
- class loadero_python.resources.resource.URL(url: str = '')[source]
Bases:
SerializableURL describes a single Loadero log file or artifact. Allows downloading without manually supplying access token.
- download() str[source]
Downloads the contents of a the URL, storing the result as a file in current working directory
- Returns
str: File name of the download.
- loadero_python.resources.resource.convert_params_list(resource_class: type, params: List[LoaderoResource]) list[source]
Converts a list of resource params to a list of resource objects. User of this function is responsible for matching the type of params and resource, otherwise the function will produce invalid resource instances.
- Args:
resource_class (type): Class name of the target resource object type.
params (list[LoaderoResource]): List of resource params.
- Returns:
List[LoaderoResource]: List of resource objects.
- loadero_python.resources.resource.from_dict_as_list(resource_params_class: type) Callable[[Dict[str, Any]], List[LoaderoResourceParams]][source]
Returns a function that deserializes a dictionary to a list of new instances of the resource params class
- Args:
resource_params_class (type): Loadero resource params class.
- Returns:
function: Function that deserializes a json dictionary to a list of new LoaderoResourceParams objects.
- loadero_python.resources.resource.from_dict_as_new(resource_params_class: type) Callable[[Dict[str, Any]], LoaderoResourceParams][source]
Returns a function that deserializes a dictionary to a new instance of the resource params class.
- Args:
resource_params_class (type): Loadero resource params class.
- Returns:
function: Function that deserializes a json dictionary to a new LoaderoResourceParams object.