services:
  - type: org.apache.brooklyn.entity.stock.BasicApplication
    name: ServiceNow Incident Manager
    brooklyn.policies:
      - type: cmdb-exporter-policy
        brooklyn.config:
          period: 10s
          command: cat - > $PUBLISH_FILE && amp-cmdb snow --profile amp-snow  --publish --input $PUBLISH_FILE
          env:
            PUBLISH_FILE: /tmp/snow.publish.json
      - type: itsm-incidents-policy
        brooklyn.config:
          sensor: service.isUp # sensor to watch
          # 'sensor.valueFilter' defaults to Strings::isNonEmpty - opens an incident if sensor value is not empty
          details.sensor: service.problems
          command: cat - > $INCIDENT_FILE && amp-cmdb snow --profile amp-snow  --publish_incident --input $INCIDENT_FILE
          env:
            INCIDENT_FILE: /tmp/snow.incident.json


