summaryrefslogtreecommitdiffstats
path: root/kubernetes/consul/resources/config/consul-agent-config/msb-health.json
blob: ad4e422be1696c834ae654032695ec30ffc7bd6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{
  "service": {
    "name": "Health Check: MSB",
    "checks": [
      {
        "id": "msb-eag",
        "name": "MSB eag Health Check",
        "http": "http://msb-eag:80/iui/microservices/default.html",
        "method": "HEAD",
        "tls_skip_verify": true,
        "interval": "15s",
        "timeout": "1s"
      },
      {
        "id": "msb-iag",
        "name": "MSB iag Health Check",
        "http": "http://msb-iag:80/iui/microservices/default.html",
        "method": "HEAD",
        "tls_skip_verify": true,
        "interval": "15s",
        "timeout": "1s"
      },
      {
        "id": "msb-consul",
        "name": "MSB consul Health Check",
        "tcp": "msb-consul:8500",
        "interval": "15s",
        "timeout": "1s"
      },
      {
        "id": "msb-discovery",
        "name": "MSB discovery Health Check",
        "tcp": "msb-discovery:10081",
        "interval": "15s",
        "timeout": "1s"
      }
    ]
  }
}
ersal.P; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.onap.aai.db.props.AAIProperties; import org.onap.aai.serialization.engines.TransactionalGraphEngine; import com.thinkaurelius.titan.core.Cardinality; import com.thinkaurelius.titan.core.PropertyKey; import com.thinkaurelius.titan.core.schema.TitanManagement; /** * A migration template for migrating a property from one name to another */ @MigrationPriority(0) @MigrationDangerRating(1) public abstract class PropertyMigrator extends Migrator { protected final String OLD_FIELD; protected final String NEW_FIELD; protected final Class<?> fieldType; protected final Cardinality cardinality; protected final TitanManagement graphMgmt; public PropertyMigrator(TransactionalGraphEngine engine, String oldName, String newName, Class<?> type, Cardinality cardinality) { super(engine); this.OLD_FIELD = oldName; this.NEW_FIELD = newName; this.fieldType = type; this.cardinality = cardinality; this.graphMgmt = engine.asAdmin().getManagementSystem(); } /** * Do not override this method as an inheritor of this class */ @Override public void run() { modifySchema(); executeModifyOperation(); } protected void modifySchema() { this.addIndex(this.addProperty()); graphMgmt.commit(); } /** * This is where inheritors should add their logic */ protected void executeModifyOperation() { changePropertyName(); } protected void changePropertyName() { GraphTraversal<Vertex, Vertex> g = this.engine.asAdmin().getTraversalSource().V(); if (this.getAffectedNodeTypes().isPresent()) { g.has(AAIProperties.NODE_TYPE, P.within(this.getAffectedNodeTypes().get())); } g.has(OLD_FIELD).sideEffect(t -> { final Vertex v = t.get(); final String value = v.value(OLD_FIELD); v.property(OLD_FIELD).remove(); v.property(NEW_FIELD, value); this.touchVertexProperties(v, false); }).iterate(); } @Override public Status getStatus() { GraphTraversal<Vertex, Vertex> g = this.engine.asAdmin().getTraversalSource().V(); if (this.getAffectedNodeTypes().isPresent()) { g.has(AAIProperties.NODE_TYPE, P.within(this.getAffectedNodeTypes().get())); } long result = g.has(OLD_FIELD).count().next(); if (result == 0) { return Status.SUCCESS; } else { return Status.FAILURE; } } protected Optional<PropertyKey> addProperty() { if (!graphMgmt.containsPropertyKey(this.NEW_FIELD)) { logger.info(" PropertyKey [" + this.NEW_FIELD + "] created in the DB. "); return Optional.of(graphMgmt.makePropertyKey(this.NEW_FIELD).dataType(this.fieldType).cardinality(this.cardinality) .make()); } else { logger.info(" PropertyKey [" + this.NEW_FIELD + "] already existed in the DB. "); return Optional.empty(); } } protected void addIndex(Optional<PropertyKey> key) { if (isIndexed() && key.isPresent()) { if (graphMgmt.containsGraphIndex(key.get().name())) { logger.debug(" Index [" + key.get().name() + "] already existed in the DB. "); } else { logger.info("Add index for PropertyKey: [" + key.get().name() + "]"); graphMgmt.buildIndex(key.get().name(), Vertex.class).addKey(key.get()).buildCompositeIndex(); } } } public abstract boolean isIndexed(); }