Module static_topo_impl.model.stackstate_receiver

Expand source code
from datetime import datetime
from typing import Any, Dict, List

from schematics import Model
from schematics.transforms import blacklist, wholelist
from schematics.types import (BooleanType, DictType, IntType, ListType,
                              ModelType, StringType)
from static_topo_impl.model.stackstate import (AnyType, Component, Event,
                                               HealthCheckState, Relation,
                                               TimestampType)


class Instance(Model):
    instance_type: str = StringType(required=True, serialized_name="type")
    url: str = StringType(required=True)

    class Options:
        roles = {"public": wholelist()}


class TopologySync(Model):
    start_snapshot: bool = BooleanType(default=True)
    stop_snapshot: bool = BooleanType(default=True)
    instance: Instance = ModelType(Instance, required=True)
    delete_ids: List[str] = ListType(StringType(), default=[])
    components: List[Component] = ListType(ModelType(Component), default=[])
    relations: List[Relation] = ListType(ModelType(Relation), default=[])

    class Options:
        roles = {"public": wholelist()}


class HealthSyncStartSnapshot(Model):
    expiry_interval_s: int = IntType()
    repeat_interval_s: int = IntType(required=True, default=1800)  # 30 Minutes

    class Options:
        roles = {"public": blacklist("expiry_interval_s")}


class HealthStream(Model):
    urn: str = StringType(required=True)
    sub_stream_id: str = StringType()

    class Options:
        roles = {"public": blacklist("sub_stream_id")}


class HealthSync(Model):
    start_snapshot: HealthSyncStartSnapshot = ModelType(HealthSyncStartSnapshot, required=True)
    stop_snapshot: Dict[str, Any] = DictType(AnyType, required=True, default={})
    stream: HealthStream = ModelType(HealthStream, required=True)
    check_states: List[HealthCheckState] = ListType(ModelType(HealthCheckState), default=[])

    class Options:
        roles = {"public": wholelist()}


class ReceiverApi(Model):
    apiKey: str = StringType(required=True)
    collection_timestamp: datetime = TimestampType(required=True)
    internal_hostname: str = StringType(required=True, serialized_name="internalHostname")
    events: Dict[str, List[Event]] = DictType(ListType(ModelType(Event), default=[]), default={})
    metrics: List[Any] = ListType(AnyType(), default=[])
    service_checks: List[Any] = ListType(AnyType(), default=[])
    health: List[HealthSync] = ListType(ModelType(HealthSync), default=[])
    topologies: List[TopologySync] = ListType(ModelType(TopologySync), default=[])

    class Options:
        roles = {"public": wholelist()}


class SyncStats(Model):
    components: int = IntType()
    relations: int = IntType()
    checks: int = IntType()
    events: int = IntType()
    payloads: List[str] = ListType(StringType, default=[])

Classes

class HealthStream (raw_data=None, trusted_data=None, deserialize_mapping=None, init=True, partial=True, strict=True, validate=False, app_data=None, lazy=False, **kwargs)

Enclosure for fields and validation. Same pattern deployed by Django models, SQLAlchemy declarative extension and other developer friendly libraries.

:param Mapping raw_data: The data to be imported into the model instance. :param Mapping deserialize_mapping: Can be used to provide alternative input names for fields. Values may be strings or lists of strings, keyed by the actual field name. :param bool partial: Allow partial data to validate. Essentially drops the required=True settings from field definitions. Default: True :param bool strict: Complain about unrecognized keys. Default: True

Expand source code
class HealthStream(Model):
    urn: str = StringType(required=True)
    sub_stream_id: str = StringType()

    class Options:
        roles = {"public": blacklist("sub_stream_id")}

Ancestors

  • schematics.deprecated.patch_models..Model
  • schematics.deprecated.ModelCompatibilityMixin
  • schematics.models.Model

Class variables

var Options
var sub_stream_id : str
var urn : str
class HealthSync (raw_data=None, trusted_data=None, deserialize_mapping=None, init=True, partial=True, strict=True, validate=False, app_data=None, lazy=False, **kwargs)

Enclosure for fields and validation. Same pattern deployed by Django models, SQLAlchemy declarative extension and other developer friendly libraries.

:param Mapping raw_data: The data to be imported into the model instance. :param Mapping deserialize_mapping: Can be used to provide alternative input names for fields. Values may be strings or lists of strings, keyed by the actual field name. :param bool partial: Allow partial data to validate. Essentially drops the required=True settings from field definitions. Default: True :param bool strict: Complain about unrecognized keys. Default: True

Expand source code
class HealthSync(Model):
    start_snapshot: HealthSyncStartSnapshot = ModelType(HealthSyncStartSnapshot, required=True)
    stop_snapshot: Dict[str, Any] = DictType(AnyType, required=True, default={})
    stream: HealthStream = ModelType(HealthStream, required=True)
    check_states: List[HealthCheckState] = ListType(ModelType(HealthCheckState), default=[])

    class Options:
        roles = {"public": wholelist()}

Ancestors

  • schematics.deprecated.patch_models..Model
  • schematics.deprecated.ModelCompatibilityMixin
  • schematics.models.Model

Class variables

var Options
var check_states : List[HealthCheckState]
var start_snapshotHealthSyncStartSnapshot
var stop_snapshot : Dict[str, Any]
var streamHealthStream
class HealthSyncStartSnapshot (raw_data=None, trusted_data=None, deserialize_mapping=None, init=True, partial=True, strict=True, validate=False, app_data=None, lazy=False, **kwargs)

Enclosure for fields and validation. Same pattern deployed by Django models, SQLAlchemy declarative extension and other developer friendly libraries.

:param Mapping raw_data: The data to be imported into the model instance. :param Mapping deserialize_mapping: Can be used to provide alternative input names for fields. Values may be strings or lists of strings, keyed by the actual field name. :param bool partial: Allow partial data to validate. Essentially drops the required=True settings from field definitions. Default: True :param bool strict: Complain about unrecognized keys. Default: True

Expand source code
class HealthSyncStartSnapshot(Model):
    expiry_interval_s: int = IntType()
    repeat_interval_s: int = IntType(required=True, default=1800)  # 30 Minutes

    class Options:
        roles = {"public": blacklist("expiry_interval_s")}

Ancestors

  • schematics.deprecated.patch_models..Model
  • schematics.deprecated.ModelCompatibilityMixin
  • schematics.models.Model

Class variables

var Options
var expiry_interval_s : int
var repeat_interval_s : int
class Instance (raw_data=None, trusted_data=None, deserialize_mapping=None, init=True, partial=True, strict=True, validate=False, app_data=None, lazy=False, **kwargs)

Enclosure for fields and validation. Same pattern deployed by Django models, SQLAlchemy declarative extension and other developer friendly libraries.

:param Mapping raw_data: The data to be imported into the model instance. :param Mapping deserialize_mapping: Can be used to provide alternative input names for fields. Values may be strings or lists of strings, keyed by the actual field name. :param bool partial: Allow partial data to validate. Essentially drops the required=True settings from field definitions. Default: True :param bool strict: Complain about unrecognized keys. Default: True

Expand source code
class Instance(Model):
    instance_type: str = StringType(required=True, serialized_name="type")
    url: str = StringType(required=True)

    class Options:
        roles = {"public": wholelist()}

Ancestors

  • schematics.deprecated.patch_models..Model
  • schematics.deprecated.ModelCompatibilityMixin
  • schematics.models.Model

Class variables

var Options
var instance_type : str
var url : str
class ReceiverApi (raw_data=None, trusted_data=None, deserialize_mapping=None, init=True, partial=True, strict=True, validate=False, app_data=None, lazy=False, **kwargs)

Enclosure for fields and validation. Same pattern deployed by Django models, SQLAlchemy declarative extension and other developer friendly libraries.

:param Mapping raw_data: The data to be imported into the model instance. :param Mapping deserialize_mapping: Can be used to provide alternative input names for fields. Values may be strings or lists of strings, keyed by the actual field name. :param bool partial: Allow partial data to validate. Essentially drops the required=True settings from field definitions. Default: True :param bool strict: Complain about unrecognized keys. Default: True

Expand source code
class ReceiverApi(Model):
    apiKey: str = StringType(required=True)
    collection_timestamp: datetime = TimestampType(required=True)
    internal_hostname: str = StringType(required=True, serialized_name="internalHostname")
    events: Dict[str, List[Event]] = DictType(ListType(ModelType(Event), default=[]), default={})
    metrics: List[Any] = ListType(AnyType(), default=[])
    service_checks: List[Any] = ListType(AnyType(), default=[])
    health: List[HealthSync] = ListType(ModelType(HealthSync), default=[])
    topologies: List[TopologySync] = ListType(ModelType(TopologySync), default=[])

    class Options:
        roles = {"public": wholelist()}

Ancestors

  • schematics.deprecated.patch_models..Model
  • schematics.deprecated.ModelCompatibilityMixin
  • schematics.models.Model

Class variables

var Options
var apiKey : str
var collection_timestamp : datetime.datetime
var events : Dict[str, List[Event]]
var health : List[HealthSync]
var internal_hostname : str
var metrics : List[Any]
var service_checks : List[Any]
var topologies : List[TopologySync]
class SyncStats (raw_data=None, trusted_data=None, deserialize_mapping=None, init=True, partial=True, strict=True, validate=False, app_data=None, lazy=False, **kwargs)

Enclosure for fields and validation. Same pattern deployed by Django models, SQLAlchemy declarative extension and other developer friendly libraries.

:param Mapping raw_data: The data to be imported into the model instance. :param Mapping deserialize_mapping: Can be used to provide alternative input names for fields. Values may be strings or lists of strings, keyed by the actual field name. :param bool partial: Allow partial data to validate. Essentially drops the required=True settings from field definitions. Default: True :param bool strict: Complain about unrecognized keys. Default: True

Expand source code
class SyncStats(Model):
    components: int = IntType()
    relations: int = IntType()
    checks: int = IntType()
    events: int = IntType()
    payloads: List[str] = ListType(StringType, default=[])

Ancestors

  • schematics.deprecated.patch_models..Model
  • schematics.deprecated.ModelCompatibilityMixin
  • schematics.models.Model

Class variables

var checks : int
var components : int
var events : int
var payloads : List[str]
var relations : int
class TopologySync (raw_data=None, trusted_data=None, deserialize_mapping=None, init=True, partial=True, strict=True, validate=False, app_data=None, lazy=False, **kwargs)

Enclosure for fields and validation. Same pattern deployed by Django models, SQLAlchemy declarative extension and other developer friendly libraries.

:param Mapping raw_data: The data to be imported into the model instance. :param Mapping deserialize_mapping: Can be used to provide alternative input names for fields. Values may be strings or lists of strings, keyed by the actual field name. :param bool partial: Allow partial data to validate. Essentially drops the required=True settings from field definitions. Default: True :param bool strict: Complain about unrecognized keys. Default: True

Expand source code
class TopologySync(Model):
    start_snapshot: bool = BooleanType(default=True)
    stop_snapshot: bool = BooleanType(default=True)
    instance: Instance = ModelType(Instance, required=True)
    delete_ids: List[str] = ListType(StringType(), default=[])
    components: List[Component] = ListType(ModelType(Component), default=[])
    relations: List[Relation] = ListType(ModelType(Relation), default=[])

    class Options:
        roles = {"public": wholelist()}

Ancestors

  • schematics.deprecated.patch_models..Model
  • schematics.deprecated.ModelCompatibilityMixin
  • schematics.models.Model

Class variables

var Options
var components : List[Component]
var delete_ids : List[str]
var instanceInstance
var relations : List[Relation]
var start_snapshot : bool
var stop_snapshot : bool