예제 #1
0
class RollupUpdateResponse(BaseAbstractEntity):
    """
    Represents a Rollup Update Response.
    """

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

    name = JsonProperty('name')
    abbreviation = JsonProperty('abbreviation')
예제 #3
0
class HttpError(BaseAbstractEntity):
    """
    A Generic Error message.
    """

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

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

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

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

    name = JsonProperty('name')
    asset_type = JsonProperty('assetType')
    timezone = JsonProperty('timezone')
예제 #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)
예제 #9
0
class Site(BaseEntity):
    """
    Represents a Site containing Assets.
    """

    name = JsonProperty('name')
    latitude = JsonProperty('latitude')
    longitude = JsonProperty('longitude')
    timezone = JsonProperty('timezone')
예제 #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)
예제 #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
예제 #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')
예제 #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')
예제 #14
0
class RollupUpdateError(HttpError):
    """
    Rollup update error.
    """

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

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

    point_id = JsonProperty('pointId')
예제 #17
0
class DataModificationError(HttpError):
    """
    A Data Modification Error.
    """

    observation = JsonProperty('observation', klass=Observation)
예제 #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')
예제 #19
0
class DataSaveError(HttpError):
    """
    A Data Create error.
    """

    observation = JsonProperty('observation', klass=Observation)
예제 #20
0
class SiteGroupViewConfig(BaseAbstractEntity):
    summaries = JsonProperty('summaries', klass=SiteGroupSummary)
예제 #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')
예제 #22
0
class SiteGroupNotificationSetting(BaseAbstractEntity):
    notify_sms = JsonProperty('notifySms')
    notify_email = JsonProperty('notifyEmail')
예제 #23
0
class SiteGroup(BaseEntity):
    """
    Represents a SiteGroup which contains Sites.
    """

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

    errors = JsonProperty('errors', klass=list, list_klass=DataModificationError)
예제 #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)
예제 #27
0
class RollupUpdate(BaseAbstractEntity):
    """
    A Rollup Update request.
    """
    point_id = JsonProperty('pointId')
    timestamp = JsonProperty('timestamp')
예제 #28
0
class Role(BaseEntity):
    """
    Roles define permissions and Subjects have Role(s).
    """

    name = JsonProperty('name')
예제 #29
0
class SiteGroupSummary(BaseAbstractEntity):
    asset_type = JsonProperty('assetType')
    point_type = JsonProperty('pointType')
    aggregation_type = JsonProperty('aggregationType')
    label = JsonProperty('label')
    unit = JsonProperty('unit')
예제 #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