Esempio n. 1
0
class RollupUpdateResponse(BaseAbstractEntity):
    """
    Represents a Rollup Update Response.
    """

    rollup_updates = JsonProperty('rollupUpdates', klass=list, list_klass=RollupUpdate)
    errors = JsonProperty('errors')
Esempio n. 2
0
class Unit(BaseEntity):
    """
    Represents a Unit which defines the Point units.
    """

    name = JsonProperty('name')
    abbreviation = JsonProperty('abbreviation')
Esempio n. 3
0
class HttpError(BaseAbstractEntity):
    """
    A Generic Error message.
    """

    error_code = JsonProperty('errorCode')
    error_message = JsonProperty('errorMessage')
Esempio n. 4
0
class DataRetrieveResponse(BaseAbstractEntity):
    """
    Represents a Data Retrieve Response.
    """

    observations = JsonProperty('observations', klass=dict)
    errors = JsonProperty('errors', klass=list, list_klass=DataRetrieveError)
Esempio n. 5
0
class SetPointRequest(BaseAbstractEntity):
    """
    A Set Point Request.
    """

    value = JsonProperty('value')
    previous_value = JsonProperty('previousValue')
Esempio n. 6
0
class Tenant(BaseEntity):
    """
    Represents a Tenant or Sub-Tenant.
    """

    name = JsonProperty('name')
    effective_timestamp = JsonProperty('effectiveTimestamp')
    timezone = JsonProperty('timezone')
Esempio n. 7
0
class Asset(BaseEntity):
    """
    Represents an Asset containing Points.
    """

    name = JsonProperty('name')
    asset_type = JsonProperty('assetType')
    timezone = JsonProperty('timezone')
Esempio n. 8
0
class DataRetrieveRequest(BaseAbstractEntity):
    """
    Represents a request for data.
    """
    start_timestamp = JsonProperty('start')
    end_timestamp = JsonProperty('end')
    order = JsonProperty('order')
    limit = JsonProperty('limit')
    point_ids = JsonProperty('pointIds', klass=list)
Esempio n. 9
0
class Site(BaseEntity):
    """
    Represents a Site containing Assets.
    """

    name = JsonProperty('name')
    latitude = JsonProperty('latitude')
    longitude = JsonProperty('longitude')
    timezone = JsonProperty('timezone')
Esempio n. 10
0
class MultiReverseLookup(BaseAbstractEntity):

    lookups = JsonProperty(
        "lookups", klass=list,
        list_klass=ReverseLookup)  # type: list(ReverseLookup)
    error_ids = JsonProperty(
        "errorIds",
        klass=dict,
        dict_key_klass=long_,
        dict_value_klass=HttpError)  # type: dict(long, HttpError)
Esempio n. 11
0
class ReverseLookup(BaseAbstractEntity):

    tenant_uuid = JsonProperty("tenantUuid")  # type: str
    tenant_id = JsonProperty("tenantId")  # type: long
    entity_type = JsonProperty("type")  # type: str
    entity = JsonProperty("entity", klass=dict)  # type: dict

    def get_entity_as(self, entity_class):
        if entity_class and issubclass(entity_class, BaseAbstractEntity):
            return entity_class.from_dict(self.entity)
        return self.entity
Esempio n. 12
0
class Observation(BaseAbstractEntity):
    """
    Represents an Observation for a Point Stream.

    This is a time-value object with some additional meta-data.
    """

    point_id = JsonProperty('pointId')
    timestamp = JsonProperty('timestamp')
    received = JsonProperty('receivedTimestamp')
    value = JsonProperty('value')
    email = JsonProperty('email')
Esempio n. 13
0
class Subject(BaseEntity):
    """
    Represents a User.
    """

    username = JsonProperty('username')
    email = JsonProperty('email')
    phone = JsonProperty('phone')
    given_name = JsonProperty('firstName')
    family_name = JsonProperty('lastName')
    password = JsonProperty('password')
Esempio n. 14
0
class RollupUpdateError(HttpError):
    """
    Rollup update error.
    """

    rollup = JsonProperty('rollupUpdate', klass=RollupUpdate)
Esempio n. 15
0
class DataSaveResponse(BaseAbstractEntity):
    """
    Represents a Data Create Response.
    """

    errors = JsonProperty('errors', klass=list, list_klass=DataSaveError)
Esempio n. 16
0
class DataRetrieveError(HttpError):
    """
    A Data Retrieve Error message.
    """

    point_id = JsonProperty('pointId')
Esempio n. 17
0
class DataModificationError(HttpError):
    """
    A Data Modification Error.
    """

    observation = JsonProperty('observation', klass=Observation)
Esempio n. 18
0
class Point(BaseEntity):
    """
    Represents a Point which represents and observation stream or parameter.
    """

    name = JsonProperty('name')
    point_type = JsonProperty('pointType')
    data_type = JsonProperty('dataType')
    rollup_type = JsonProperty('rollupType')
    expected_period_ms = JsonProperty('expectedPeriodMs')
    timezone = JsonProperty('timezone')
    unit = JsonProperty('unit')
    color = JsonProperty('color')
    is_parameter = JsonProperty('isParameter')
    is_process_variable = JsonProperty('isProcessVar')
    is_hidden = JsonProperty('isHidden')
    is_graphed_by_default = JsonProperty('isGraphedByDefault')
    is_shown_in_summary = JsonProperty('isShownInSummary')
    is_accumulable = JsonProperty('isAccumulable')
    is_automated = JsonProperty('isAutomated')
Esempio n. 19
0
class DataSaveError(HttpError):
    """
    A Data Create error.
    """

    observation = JsonProperty('observation', klass=Observation)
Esempio n. 20
0
class SiteGroupViewConfig(BaseAbstractEntity):
    summaries = JsonProperty('summaries', klass=SiteGroupSummary)
Esempio n. 21
0
class ControlRule(BaseEntity):
    """
    Represents a ControlPoint.

    Something which can be changed remotely.
    """

    name = JsonProperty('name')
    enabled = JsonProperty('enabled')
    order = JsonProperty('order')
    site_id = JsonProperty('siteId')
    asset_id = JsonProperty('assetId')
    point_id = JsonProperty('pointId')
    control_point_id = JsonProperty('controlPointId')
    rule_type = JsonProperty('type')
    rule_value = JsonProperty('ruleValue')
    rule_direction_match = JsonProperty('ruleDirectionMatch')
    rule_string_value = JsonProperty('ruleStringValue')
    target_control_point_name = JsonProperty('targetControlPointName')
Esempio n. 22
0
class SiteGroupNotificationSetting(BaseAbstractEntity):
    notify_sms = JsonProperty('notifySms')
    notify_email = JsonProperty('notifyEmail')
Esempio n. 23
0
class SiteGroup(BaseEntity):
    """
    Represents a SiteGroup which contains Sites.
    """

    name = JsonProperty('name')
Esempio n. 24
0
class SiteGroupNotificationResponse(BaseAbstractEntity):
    settings = JsonProperty('settings',
                            klass=dict,
                            dict_key_klass=long_,
                            dict_value_klass=SiteGroupNotificationSetting)
Esempio n. 25
0
class DataModificationResponse(BaseAbstractEntity):
    """
    Represents a Data Update Response.
    """

    errors = JsonProperty('errors', klass=list, list_klass=DataModificationError)
Esempio n. 26
0
class ControlPoint(BaseEntity):
    """
    Represents a ControlPoint.

    Something which can be changed remotely.
    """

    name = JsonProperty('name')
    tag = JsonProperty('tag')
    site_id = JsonProperty('siteId')
    asset_id = JsonProperty('assetId')
    point_id = JsonProperty('pointId')
    data_type = JsonProperty('dataType')
    enabled = JsonProperty('enabled')
    hidden = JsonProperty('hidden')
    timeout = JsonProperty('timeout')
    locked_by_subject_id = JsonProperty('lockedBySubjectId')
    locked_by_subject_username = JsonProperty('lockedBySubjectUsername')
    locked_at = JsonProperty('lockedAt')
    lock_expires_at = JsonProperty('lockExpiresAt')
    latest_value = JsonProperty('latestValue')
    latest_value_timestamp = JsonProperty('latestValueTimestamp')
    parent_control_point_name = JsonProperty('parentControlPointName')
    parent_bit_mask = JsonProperty('parentBitMask')
    lower_numeric_bound = JsonProperty('lowerNumericBound')
    upper_numeric_bound = JsonProperty('upperNumericBound')
    string_length_bound = JsonProperty('stringLengthBound')
    string_enumeration_bound = JsonProperty('stringEnumerationBound', klass=list)
    value_enumeration_bound = JsonProperty('valueEnumerationBound', klass=list)
    string_value_enumeration = JsonProperty('stringValueEnumeration', klass=dict)
Esempio n. 27
0
class RollupUpdate(BaseAbstractEntity):
    """
    A Rollup Update request.
    """
    point_id = JsonProperty('pointId')
    timestamp = JsonProperty('timestamp')
Esempio n. 28
0
class Role(BaseEntity):
    """
    Roles define permissions and Subjects have Role(s).
    """

    name = JsonProperty('name')
Esempio n. 29
0
class SiteGroupSummary(BaseAbstractEntity):
    asset_type = JsonProperty('assetType')
    point_type = JsonProperty('pointType')
    aggregation_type = JsonProperty('aggregationType')
    label = JsonProperty('label')
    unit = JsonProperty('unit')
Esempio n. 30
0
class ControlAudit(BaseEntity):
    """
    Control Audit Record.
    """

    status = JsonProperty('status')
    quality = JsonProperty('quality')
    pre_set_read_value = JsonProperty('preSetReadValue')
    value = JsonProperty('value')
    post_set_read_value = JsonProperty('postSetReadValue')
    read_timestamp = JsonProperty('readTimestamp')
    subject_id = JsonProperty('subjectId')
    subject_username = JsonProperty('subjectUsername')
    audit_created_timestamp = JsonProperty('auditCreatedTimestamp')
    audit_updated_timestamp = JsonProperty('auditUpdatedTimestamp')
    request_type = JsonProperty('requestType')

    @property
    def quality_is_good(self):
        return self.quality == SetPointQuality.GOOD

    @property
    def quality_is_uncertain(self):
        return self.quality == SetPointQuality.UNCERTAIN

    @property
    def quality_is_bad(self):
        return self.quality == SetPointQuality.BAD

    @property
    def status_is_failed(self):
        return self.status == SetPointStatus.FAILED

    @property
    def status_is_success(self):
        return self.status == SetPointStatus.SUCCESS

    @property
    def status_is_pending(self):
        return self.status == SetPointStatus.PENDING

    @property
    def is_on_demand_read(self):
        return self.request_type == ControlRequestType.ON_DEMAND_READ

    @property
    def is_on_demand_set(self):
        return self.request_type == ControlRequestType.SET_POINT_CHANGE