Source code for iottsbulk.models.file_info

# coding: utf-8

"""
    IoT Time Series Bulk API

    This API allows to bulk import IoT time series data based on files uploaded via IoT File Service. Data import for simulation assets (entities) is supported with up to nano second precision and for performance assets (entities) with up to milli second precision. A bulk import is modeled as asynchronous job whose status can be retrieved after creation. Successfully imported time series data can be retrieved using the read operation.   # noqa: E501
"""


import pprint
import re
import six
from mindsphere_core.exceptions import MindsphereClientError


[docs]class FileInfo(object): """ Attributes: attribute_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in definition. """ attribute_types = { 'file_path': 'str', '_from': 'datetime', 'to': 'datetime' } attribute_map = { 'file_path': 'filePath', '_from': 'from', 'to': 'to' } def __init__(self, file_path=None, _from=None, to=None): self._file_path = file_path self.__from = _from self._to = to self.discriminator = None @property def file_path(self): """Gets the file_path of this FileInfo. Path of JSON text file containing time series data, uploaded with IoT File Service. :return: The file_path of this FileInfo. :rtype: str """ return self._file_path @file_path.setter def file_path(self, file_path): """Sets the file_path of this FileInfo. Path of JSON text file containing time series data, uploaded with IoT File Service. :param file_path: The file_path of this FileInfo. :type: str """ if file_path is None: raise MindsphereClientError("Invalid value for `file_path`, must not be `None`") self._file_path = file_path @property def _from(self): """Gets the _from of this FileInfo. Must match the time of the first time series record appearing in the file, in ISO date-time format. Is used for pre-validations on import job creation. :return: The _from of this FileInfo. :rtype: datetime """ return self.__from @_from.setter def _from(self, _from): """Sets the _from of this FileInfo. Must match the time of the first time series record appearing in the file, in ISO date-time format. Is used for pre-validations on import job creation. :param _from: The _from of this FileInfo. :type: datetime """ if _from is None: raise MindsphereClientError("Invalid value for `_from`, must not be `None`") self.__from = _from @property def to(self): """Gets the to of this FileInfo. Must match the time of the last time series record in the file, in ISO date-time format. Is used for pre-validations on import job creation. :return: The to of this FileInfo. :rtype: datetime """ return self._to @to.setter def to(self, to): """Sets the to of this FileInfo. Must match the time of the last time series record in the file, in ISO date-time format. Is used for pre-validations on import job creation. :param to: The to of this FileInfo. :type: datetime """ if to is None: raise MindsphereClientError("Invalid value for `to`, must not be `None`") self._to = to
[docs] def to_dict(self): """Returns the model properties as a dict""" result = {} for attr, _ in six.iteritems(self.attribute_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, value.items() )) else: result[attr] = value if issubclass(FileInfo, dict): for key, value in self.items(): result[key] = value return result
[docs] def to_str(self): """Returns the string representation of the model""" return pprint.pformat(self.to_dict())
def __repr__(self): """For `print` and `pprint`""" return self.to_str() def __eq__(self, other): """Returns true if both objects are equal""" if not isinstance(other, FileInfo): return False return self.__dict__ == other.__dict__ def __ne__(self, other): """Returns true if both objects are not equal""" return not self == other