Created
April 5, 2018 07:49
-
-
Save pfcoperez/08c55c5a49625838894aa10cd47f8c3b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val jsonString = | |
""" | |
|{ | |
| "cluster_id": "47b0f5e332b5456a9f08ef7f9ca44f55", | |
| "cluster_name": "admin-console-elasticsearch", | |
| "healthy": true, | |
| "status": "initializing", | |
| "plan_info": { | |
| "healthy": true, | |
| "pending": { | |
| "plan_attempt_id": "42e7ffb9-0c17-4ad3-bdf4-a9d70a64119f", | |
| "healthy": true, | |
| "attempt_start_time": "2018-04-04T18:48:22.657Z", | |
| "plan": { | |
| "zone_count": 1, | |
| "cluster_topology": [ | |
| { | |
| "node_type": { | |
| "master": true, | |
| "data": true, | |
| "ingest": true, | |
| "ml": false | |
| }, | |
| "memory_per_node": 1024, | |
| "node_count_per_zone": 1, | |
| "node_configuration": "default" | |
| } | |
| ], | |
| "elasticsearch": { | |
| "version": "5.6.8", | |
| "system_settings": { | |
| "scripting": { | |
| "stored": { | |
| "enabled": false | |
| }, | |
| "file": { | |
| "enabled": false | |
| }, | |
| "inline": { | |
| "enabled": false | |
| } | |
| }, | |
| "http": { | |
| "compression": true, | |
| "cors_enabled": false, | |
| "cors_max_age": 1728000, | |
| "cors_allow_credentials": false | |
| }, | |
| "reindex_whitelist": [], | |
| "use_disk_threshold": false, | |
| "auto_create_index": true, | |
| "enable_close_index": false, | |
| "destructive_requires_name": false, | |
| "watcher_trigger_engine": "scheduler", | |
| "monitoring_collection_interval": -1, | |
| "monitoring_history_duration": "7d" | |
| }, | |
| "enabled_built_in_plugins": [], | |
| "user_plugins": [], | |
| "user_bundles": [] | |
| }, | |
| "transient": { | |
| "plan_configuration": { | |
| "timeout": 4096, | |
| "move_instances": [], | |
| "move_allocators": [], | |
| "reallocate_instances": false, | |
| "preferred_allocators": [], | |
| "skip_snapshot": false, | |
| "max_snapshot_attempts": 3, | |
| "extended_maintenance": false, | |
| "override_failsafe": false, | |
| "skip_data_migration": false, | |
| "skip_upgrade_checker": false, | |
| "skip_post_upgrade_steps": false | |
| } | |
| } | |
| }, | |
| "plan_attempt_log": [], | |
| "source": { | |
| "facilitator": "bootstrap", | |
| "action": "create-admin-console-backend", | |
| "date": "2018-04-04T18:47:42.784Z", | |
| "user_id": {}, | |
| "remote_addresses": {} | |
| } | |
| }, | |
| "history": [] | |
| }, | |
| "elasticsearch": { | |
| "healthy": true, | |
| "shard_info": { | |
| "healthy": true, | |
| "available_shards": [ | |
| { | |
| "instance_name": "instance-0000000000", | |
| "shard_count": 0 | |
| } | |
| ], | |
| "unavailable_shards": [ | |
| { | |
| "instance_name": "instance-0000000000", | |
| "shard_count": 0 | |
| } | |
| ], | |
| "unavailable_replicas": [ | |
| { | |
| "instance_name": "instance-0000000000", | |
| "replica_count": 0 | |
| } | |
| ] | |
| }, | |
| "master_info": { | |
| "healthy": true, | |
| "masters": [ | |
| { | |
| "master_node_id": "jtUD4mUCTtaLZ0VktmHF0Q", | |
| "master_instance_name": "instance-0000000000", | |
| "instances": [ | |
| "instance-0000000000" | |
| ] | |
| } | |
| ], | |
| "instances_with_no_master": [] | |
| }, | |
| "blocking_issues": { | |
| "healthy": true, | |
| "cluster_level": [], | |
| "index_level": [] | |
| } | |
| }, | |
| "metadata": { | |
| "version": 3, | |
| "last_modified": "2018-04-04T18:48:25.997Z" | |
| }, | |
| "topology": { | |
| "healthy": true, | |
| "instances": [ | |
| { | |
| "instance_name": "instance-0000000000", | |
| "instance_configuration": { | |
| "id": "default-elasticsearch", | |
| "name": "default-elasticsearch" | |
| }, | |
| "service_version": "5.6.8", | |
| "service_id": "jtUD4mUCTtaLZ0VktmHF0Q", | |
| "healthy": true, | |
| "container_started": true, | |
| "service_running": true, | |
| "maintenance_mode": true, | |
| "zone": "ece-zone-0", | |
| "allocator_id": "192.168.44.10", | |
| "memory": { | |
| "instance_capacity": 1024 | |
| }, | |
| "disk": { | |
| "disk_space_available": 24576, | |
| "disk_space_used": 0 | |
| }, | |
| "service_roles": [ | |
| "master", | |
| "data", | |
| "ingest" | |
| ] | |
| } | |
| ] | |
| }, | |
| "system_alerts": [], | |
| "associated_kibana_clusters": [], | |
| "security": { | |
| "version": 1, | |
| "last_modified": "2018-04-04T18:47:44.022Z", | |
| "users": [], | |
| "roles": {}, | |
| "users_roles": [] | |
| }, | |
| "snapshots": { | |
| "healthy": true, | |
| "count": 0 | |
| }, | |
| "external_links": [], | |
| "links": {}, | |
| "settings": { | |
| "snapshot": { | |
| "repository": { | |
| "default": {} | |
| }, | |
| "enabled": false, | |
| "suspended": [ | |
| "constructor" | |
| ] | |
| }, | |
| "metadata": { | |
| "name": "admin-console-elasticsearch", | |
| "owner_id": "root", | |
| "system_owned": true | |
| } | |
| } | |
|} | |
""".stripMargin | |
import spray.json._ | |
import ElasticsearchClusterInfoJsonProtocol._ | |
val res = elasticsearchClusterInfoFormat.read(jsonString.parseJson) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment