hawkular-client 2.9.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.rdoc +27 -0
- data/README.rdoc +14 -14
- data/lib/hawkular/alerts/alerts_api.rb +43 -7
- data/lib/hawkular/client_utils.rb +0 -3
- data/lib/hawkular/hawkular_client.rb +1 -1
- data/lib/hawkular/inventory/entities.rb +55 -19
- data/lib/hawkular/inventory/inventory_api.rb +313 -412
- data/lib/hawkular/metrics/metric_api.rb +5 -2
- data/lib/hawkular/operations/operations_api.rb +0 -8
- data/lib/hawkular/tokens/tokens_api.rb +0 -3
- data/lib/hawkular/version.rb +1 -1
- metadata +3 -647
- data/.coveralls.yml +0 -1
- data/.gitignore +0 -56
- data/.rubocop.yml +0 -32
- data/.travis.yml +0 -20
- data/.travis/start_hawkular_services.sh +0 -21
- data/.travis/wait_for_services.rb +0 -39
- data/.yardopts +0 -1
- data/Gemfile +0 -2
- data/Rakefile +0 -20
- data/api_breaking_changes.rdoc +0 -84
- data/docker-compose.yml +0 -17
- data/hawkularclient.gemspec +0 -43
- data/spec/README.rdoc +0 -62
- data/spec/integration/alert-resources/alerts-test-data.json +0 -40
- data/spec/integration/alert-resources/events-test-data.json +0 -78
- data/spec/integration/alert-resources/triggers-test-data.json +0 -66
- data/spec/integration/alerts_spec.rb +0 -774
- data/spec/integration/env_config_spec.rb +0 -39
- data/spec/integration/hawkular_client_spec.rb +0 -304
- data/spec/integration/hello-world-definitions.json +0 -45
- data/spec/integration/inventory_spec.rb +0 -680
- data/spec/integration/logger_spec.rb +0 -36
- data/spec/integration/metric_spec.rb +0 -953
- data/spec/integration/operations_spec.rb +0 -591
- data/spec/integration/tokens_spec.rb +0 -49
- data/spec/resources/driver.jar +0 -0
- data/spec/resources/sample.war +0 -0
- data/spec/spec_helper.rb +0 -336
- data/spec/unit/base_spec.rb +0 -256
- data/spec/unit/canonical_path_spec.rb +0 -102
- data/spec/unit/client_spec.rb +0 -55
- data/spec/unit/deprecations_spec.rb +0 -19
- data/spec/vcr/vcr_setup.rb +0 -16
- data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_acknowledge_an_alert.yml +0 -205
- data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_add_tags_to_existing_alert.yml +0 -210
- data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_fetch_single_alert.yml +0 -108
- data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_list_alerts.yml +0 -59
- data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_list_alerts_for_trigger.yml +0 -58
- data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_list_alerts_for_unknown_trigger.yml +0 -50
- data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_list_open_alerts.yml +0 -59
- data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_remove_tags_from_existing_alert.yml +0 -257
- data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_resolve_an_alert.yml +0 -207
- data/spec/vcr_cassettes/Alert/Alerts/Templates/setup.yml +0 -255
- data/spec/vcr_cassettes/Alert/Alerts/Templates/setup_cleanup.yml +0 -302
- data/spec/vcr_cassettes/Alert/EndToEnd/Templates/Should_create_and_fire_a_trigger.yml +0 -527
- data/spec/vcr_cassettes/Alert/Events/Templates/Should_create_an_event.yml +0 -101
- data/spec/vcr_cassettes/Alert/Events/Templates/Should_delete_an_event.yml +0 -148
- data/spec/vcr_cassettes/Alert/Events/Templates/Should_list_events.yml +0 -91
- data/spec/vcr_cassettes/Alert/Events/Templates/Should_list_events_using_criteria.yml +0 -60
- data/spec/vcr_cassettes/Alert/Events/Templates/Should_not_list_events_using_criteria.yml +0 -50
- data/spec/vcr_cassettes/Alert/Events/Templates/setup.yml +0 -615
- data/spec/vcr_cassettes/Alert/Events/Templates/setup_cleanup.yml +0 -567
- data/spec/vcr_cassettes/Alert/Groups/Templates/Should_operate_a_complex_group_trigger.yml +0 -1882
- data/spec/vcr_cassettes/Alert/Templates/Should_return_the_version.yml +0 -42
- data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_List_Triggers.yml +0 -55
- data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_List_Triggers_for_ID.yml +0 -56
- data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_List_Triggers_for_Tag.yml +0 -56
- data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_List_Triggers_for_Tags.yml +0 -56
- data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_bulk_load_triggers.yml +0 -243
- data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_create_a_basic_trigger_with_action.yml +0 -386
- data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_create_a_firing_ALL_ANY_trigger.yml +0 -483
- data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_create_an_action.yml +0 -146
- data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_get_a_single_Trigger_with_conditions.yml +0 -144
- data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_get_a_single_metric_Trigger.yml +0 -50
- data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_get_the_action_definitions.yml +0 -228
- data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_not_create_an_action_for_unknown_plugin.yml +0 -50
- data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_not_create_an_action_for_unknown_properties.yml +0 -100
- data/spec/vcr_cassettes/Alert/Triggers/Templates/setup.yml +0 -52
- data/spec/vcr_cassettes/Alert/Triggers/Templates/setup_cleanup.yml +0 -285
- data/spec/vcr_cassettes/HawkularClient/Should_err_on_bad_credentials.yml +0 -42
- data/spec/vcr_cassettes/HawkularClient/and_Inventory_client/Should_both_create_and_delete_feed.yml +0 -317
- data/spec/vcr_cassettes/HawkularClient/and_Inventory_client/Should_both_list_WildFlys.yml +0 -103
- data/spec/vcr_cassettes/HawkularClient/and_Inventory_client/Should_both_list_types_with_bad_feed.yml +0 -103
- data/spec/vcr_cassettes/HawkularClient/and_Inventory_client/Should_list_same_types_when_param_is_given.yml +0 -325
- data/spec/vcr_cassettes/HawkularClient/and_Inventory_client/Should_list_the_same_feeds.yml +0 -117
- data/spec/vcr_cassettes/HawkularClient/and_Inventory_client/Should_list_the_same_resource_types.yml +0 -111
- data/spec/vcr_cassettes/HawkularClient/and_Metrics_client/Should_both_create_and_retrieve_tags_for_Availability.yml +0 -155
- data/spec/vcr_cassettes/HawkularClient/and_Metrics_client/Should_both_create_and_return_Availability_using_Hash_parameter.yml +0 -155
- data/spec/vcr_cassettes/HawkularClient/and_Metrics_client/Should_both_return_the_version.yml +0 -89
- data/spec/vcr_cassettes/HawkularClient/and_Metrics_client/Should_both_work_the_same_way_when_pushing_metric_data_to_non-existing_counter.yml +0 -114
- data/spec/vcr_cassettes/HawkularClient/and_Operations_client/Should_both_work_the_same_way.yml +0 -158
- data/spec/vcr_cassettes/HawkularClient/and_Operations_client/Should_work_initializing_with_URI.yml +0 -48
- data/spec/vcr_cassettes/HawkularClient/and_Operations_client_Should_both_work_the_same_way.json +0 -44
- data/spec/vcr_cassettes/HawkularClient/and_Operations_client_Should_work_initializing_with_URI.json +0 -9
- data/spec/vcr_cassettes/HawkularClient/and_URIs_as_input/Should_work_with_URI.yml +0 -169
- data/spec/vcr_cassettes/HawkularClient/and_URIs_as_input/Should_work_with_URI_on_metrics_client.yml +0 -42
- data/spec/vcr_cassettes/Inventory/NonSecure/Connection/Templates/Should_err_on_bad_credentials.yml +0 -44
- data/spec/vcr_cassettes/Inventory/NonSecure/Tenants/Templates/Should_Get_Tenant_For_Explicit_Credentials.yml +0 -101
- data/spec/vcr_cassettes/Inventory/NonSecure/Tenants/Templates/Should_Get_Tenant_For_Implicit_Credentials.yml +0 -101
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Client_should_listen_on_various_inventory_events.json +0 -47
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Client_should_listen_on_various_inventory_events.yml +0 -207
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Helpers/create_url.yml +0 -52
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Helpers/generate_some_events_for_websocket.yml +0 -411
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Helpers/get_feeds.yml +0 -62
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_List_datasources_with_no_props.yml +0 -133
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_create_a_feed.yml +0 -59
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_create_a_feed_again.yml +0 -181
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_create_a_nested_resource_and_metric_on_it.yml +0 -664
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_create_a_resource.yml +0 -360
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_create_a_resource_with_metric.yml +0 -846
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_create_a_resourcetype.yml +0 -169
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_create_and_delete_feed.yml +0 -166
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_create_and_get_a_resource.yml +0 -420
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_get_resource_with_its_configurations.yml +0 -132
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_have_a_consistent_behaviour_when_creating_an_already_existing_resource.yml +0 -714
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_have_the_same_requested_metric_type_id.yml +0 -73
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_URLs.yml +0 -90
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_WildFlys.yml +0 -70
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_WildFlys_with_props.yml +0 -138
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_all_the_resource_types.yml +0 -59
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_children_of_WildFly.yml +0 -333
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_children_of_nested_resource.yml +0 -180
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_feeds.yml +0 -62
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_heap_metrics_for_WildFlys.yml +0 -943
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_metrics_for_WildFlys.yml +0 -361
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_metrics_of_given_metric_type.yml +0 -94
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_metrics_of_given_resource_type.yml +0 -294
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_operation_definitions_of_given_resource.yml +0 -871
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_operation_definitions_of_given_resource_type.yml +0 -740
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_recursive_children_of_WildFly.yml +0 -1117
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_relationships_of_WildFly.yml +0 -393
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_resources_for_feed.yml +0 -84
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_types_with_bad_feed.yml +0 -55
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_types_with_feed.yml +0 -166
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_not_find_an_unknown_resource.yml +0 -59
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_return_config_data_of_given_nested_resource.yml +0 -66
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_return_config_data_of_given_resource.yml +0 -71
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_return_data_from_get_entity.yml +0 -230
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_return_the_version.yml +0 -50
- data/spec/vcr_cassettes/Inventory/Secure/Connection/Templates/Should_err_on_bad_credentials.yml +0 -44
- data/spec/vcr_cassettes/Inventory/Secure/Tenants/Templates/Should_Get_Tenant_For_Explicit_Credentials.yml +0 -101
- data/spec/vcr_cassettes/Inventory/Secure/Tenants/Templates/Should_Get_Tenant_For_Implicit_Credentials.yml +0 -101
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Client_should_listen_on_various_inventory_events.json +0 -47
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Client_should_listen_on_various_inventory_events.yml +0 -207
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Helpers/create_url.yml +0 -52
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Helpers/generate_some_events_for_websocket.yml +0 -411
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Helpers/get_feeds.yml +0 -62
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_List_datasources_with_no_props.yml +0 -133
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_create_a_feed.yml +0 -59
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_create_a_feed_again.yml +0 -181
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_create_a_nested_resource_and_metric_on_it.yml +0 -664
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_create_a_resource.yml +0 -360
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_create_a_resource_with_metric.yml +0 -846
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_create_a_resourcetype.yml +0 -169
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_create_and_delete_feed.yml +0 -166
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_create_and_get_a_resource.yml +0 -420
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_get_resource_with_its_configurations.yml +0 -132
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_have_the_same_requested_metric_type_id.yml +0 -73
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_URLs.yml +0 -90
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_WildFlys.yml +0 -70
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_WildFlys_with_props.yml +0 -138
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_all_the_resource_types.yml +0 -59
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_children_of_WildFly.yml +0 -333
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_children_of_nested_resource.yml +0 -180
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_feeds.yml +0 -62
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_heap_metrics_for_WildFlys.yml +0 -943
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_metrics_for_WildFlys.yml +0 -361
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_metrics_of_given_metric_type.yml +0 -90
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_metrics_of_given_resource_type.yml +0 -294
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_operation_definitions_of_given_resource.yml +0 -871
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_operation_definitions_of_given_resource_type.yml +0 -740
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_recursive_children_of_WildFly.yml +0 -1117
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_relationships_of_WildFly.yml +0 -393
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_resources_for_feed.yml +0 -84
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_types_with_bad_feed.yml +0 -55
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_types_with_feed.yml +0 -166
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_not_find_an_unknown_resource.yml +0 -59
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_return_config_data_of_given_nested_resource.yml +0 -66
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_return_config_data_of_given_resource.yml +0 -71
- data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_return_the_version.yml +0 -50
- data/spec/vcr_cassettes/Inventory/Templates/Should_list_feeds_when_using_SSL_without_certificate.yml +0 -114
- data/spec/vcr_cassettes/Inventory/inventory_0_17/Templates/Should_get_resource_with_its_configurations.yml +0 -132
- data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Get_metric_definition_by_id.yml +0 -51
- data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Retrieve_metric_rate_points.yml +0 -92
- data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Should_create_Availability_definition.yml +0 -101
- data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Should_create_Counter_definition.yml +0 -101
- data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Should_create_gauge_definition.yml +0 -101
- data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Should_push_metric_data_to_existing_gauge.yml +0 -50
- data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Should_update_tags_for_Availability_definition.yml +0 -146
- data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Should_update_tags_for_gauge_definition.yml +0 -146
- data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/setup_client.yml +0 -44
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Availability_metrics/Should_create_Availability_definition_using_MetricDefinition_parameter.yml +0 -83
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Availability_metrics/Should_create_and_return_Availability_using_Hash_parameter.yml +0 -83
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Availability_metrics/Should_push_metric_data_to_non-existing_Availability.yml +0 -120
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Availability_metrics/Should_update_tags_for_Availability_definition.yml +0 -200
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Counter_metrics/Should_create_and_return_counter_using_Hash_parameter.yml +0 -83
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Counter_metrics/Should_create_counter_definition_using_MetricDefinition_parameter.yml +0 -83
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Counter_metrics/Should_get_metrics_as_bucketed_results.yml +0 -200
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Counter_metrics/Should_push_metric_data_to_existing_counter.yml +0 -237
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Counter_metrics/Should_push_metric_data_to_non-existing_counter.yml +0 -120
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Gauge_metrics/Should_create_gauge_definition_using_Hash.yml +0 -83
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Gauge_metrics/Should_create_gauge_definition_using_MetricDefinition.yml +0 -83
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Gauge_metrics/Should_push_metric_data_to_existing_gauge.yml +0 -237
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Gauge_metrics/Should_push_metric_data_to_non-existing_gauge.yml +0 -120
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Gauge_metrics/Should_return_periods.yml +0 -81
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Gauge_metrics/Should_update_tags_for_gauge_definition.yml +0 -200
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Mixed_metrics/Should_send_mixed_metric_request.yml +0 -270
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Mixed_metrics/Should_send_mixed_metric_request_of_a_single_type.yml +0 -237
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Simple/Should_be_Cool.yml +0 -82
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Status/Should_return_the_version.yml +0 -42
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Tenants/Should_create_and_return_tenant.yml +0 -83
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/All_Tags_for_metrics/Should_fetch_all_metric_tags_for_metrics_definitions.yml +0 -434
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/All_Tags_for_metrics/Should_fetch_all_metrics_with_some_tags.yml +0 -1251
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Availability_metrics/Should_create_Availability_definition_using_MetricDefinition_parameter.yml +0 -99
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Availability_metrics/Should_create_and_return_Availability_using_Hash_parameter.yml +0 -99
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Availability_metrics/Should_group_contiguous_values.yml +0 -138
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Availability_metrics/Should_push_metric_data_to_non-existing_Availability.yml +0 -144
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Availability_metrics/Should_update_tags_for_Availability_definition.yml +0 -240
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Availability_metrics/setup_client.yml +0 -44
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Counter_metrics/Should_create_and_return_counter_using_Hash_parameter.yml +0 -99
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Counter_metrics/Should_create_counter_definition_using_MetricDefinition_parameter.yml +0 -99
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Counter_metrics/Should_get_metrics_as_bucketed_results.yml +0 -240
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Counter_metrics/Should_get_metrics_with_limit_and_order.yml +0 -328
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Counter_metrics/Should_push_metric_data_to_existing_counter.yml +0 -281
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Counter_metrics/Should_push_metric_data_to_non-existing_counter.yml +0 -144
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Counter_metrics/setup_client.yml +0 -44
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/Should_create_gauge_definition_using_Hash.yml +0 -99
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/Should_create_gauge_definition_using_MetricDefinition.yml +0 -99
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/Should_push_metric_data_to_existing_gauge.yml +0 -281
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/Should_push_metric_data_to_non-existing_gauge.yml +0 -144
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/Should_return_periods.yml +0 -97
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/Should_return_platform_memory.yml +0 -196
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/Should_return_platform_memory_def.yml +0 -197
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/Should_update_tags_for_gauge_definition.yml +0 -240
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/setup_client.yml +0 -44
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Mixed_metrics/Should_fetch_rate_stats_for_mixed_metric.yml +0 -328
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Mixed_metrics/Should_fetch_stats_for_mixed_metric.yml +0 -363
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Mixed_metrics/Should_requests_raw_data_for_multiple_metrics.yml +0 -414
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Mixed_metrics/Should_send_mixed_metric_request.yml +0 -314
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Mixed_metrics/Should_send_mixed_metric_request_of_a_single_type.yml +0 -285
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Mixed_metrics/setup_client.yml +0 -44
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/No_Tenant/Should_fail.yml +0 -89
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Simple/Should_be_Cool.yml +0 -48
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Status/Should_return_the_version.yml +0 -85
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/String_metrics/Should_create_string_definition_using_Hash.yml +0 -99
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/String_metrics/Should_create_string_definition_using_MetricDefinition.yml +0 -99
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/String_metrics/Should_push_metric_data_to_existing_string.yml +0 -281
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/String_metrics/Should_push_metric_data_to_non-existing_string.yml +0 -144
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/String_metrics/setup_client.yml +0 -44
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Tags_Metrics/setup_client.yml +0 -44
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Tenants/Should_create_and_return_tenant.yml +0 -103
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Tenants/setup_client.yml +0 -44
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/setup_client.yml +0 -44
- data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Get_metric_definition_by_id.yml +0 -51
- data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Retrieve_metric_rate_points.yml +0 -92
- data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Should_create_Availability_definition.yml +0 -101
- data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Should_create_Counter_definition.yml +0 -101
- data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Should_create_gauge_definition.yml +0 -101
- data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Should_push_metric_data_to_existing_gauge.yml +0 -50
- data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Should_update_tags_for_Availability_definition.yml +0 -146
- data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Should_update_tags_for_gauge_definition.yml +0 -146
- data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Availability_metrics/Should_create_Availability_definition_using_MetricDefinition_parameter.yml +0 -99
- data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Availability_metrics/Should_create_and_return_Availability_using_Hash_parameter.yml +0 -99
- data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Availability_metrics/Should_group_contiguous_values.yml +0 -97
- data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Availability_metrics/Should_push_metric_data_to_non-existing_Availability.yml +0 -144
- data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Availability_metrics/Should_update_tags_for_Availability_definition.yml +0 -240
- data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Counter_metrics/Should_create_and_return_counter_using_Hash_parameter.yml +0 -99
- data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Counter_metrics/Should_create_counter_definition_using_MetricDefinition_parameter.yml +0 -99
- data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Counter_metrics/Should_get_metrics_as_bucketed_results.yml +0 -240
- data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Counter_metrics/Should_get_metrics_with_limit_and_order.yml +0 -328
- data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Counter_metrics/Should_push_metric_data_to_existing_counter.yml +0 -281
- data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Counter_metrics/Should_push_metric_data_to_non-existing_counter.yml +0 -144
- data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_create_gauge_definition_using_Hash.yml +0 -99
- data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_create_gauge_definition_using_MetricDefinition.yml +0 -99
- data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_push_metric_data_to_existing_gauge.yml +0 -281
- data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_push_metric_data_to_non-existing_gauge.yml +0 -144
- data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_return_periods.yml +0 -97
- data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_return_platform_memory.yml +0 -50
- data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_return_platform_memory_def.yml +0 -51
- data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_update_tags_for_gauge_definition.yml +0 -240
- data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Mixed_metrics/Should_fetch_stats_for_mixed_metric.yml +0 -364
- data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Mixed_metrics/Should_requests_raw_data_for_multiple_metrics.yml +0 -373
- data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Mixed_metrics/Should_send_mixed_metric_request.yml +0 -314
- data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Mixed_metrics/Should_send_mixed_metric_request_of_a_single_type.yml +0 -285
- data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/No_Tenant/Should_fail.yml +0 -50
- data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Simple/Should_be_Cool.yml +0 -48
- data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Status/Should_return_the_version.yml +0 -44
- data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Tenants/Should_create_and_return_tenant.yml +0 -99
- data/spec/vcr_cassettes/New_API_Counter_metrics/Should_get_metrics_as_bucketed_results.yml +0 -230
- data/spec/vcr_cassettes/New_API_Mixed_metrics/Should_send_mixed_metric_request.yml +0 -300
- data/spec/vcr_cassettes/Operation/NonSecure/Helpers/Templates/agent_properties.yml +0 -124
- data/spec/vcr_cassettes/Operation/NonSecure/Helpers/Templates/get_feed.yml +0 -61
- data/spec/vcr_cassettes/Operation/NonSecure/Helpers/Templates/get_tenant.yml +0 -55
- data/spec/vcr_cassettes/Operation/NonSecure/Operation/Add_JDBC_driver_should_add_the_driver.json +0 -23
- data/spec/vcr_cassettes/Operation/NonSecure/Operation/Add_XA_datasource_should_be_doable.json +0 -23
- data/spec/vcr_cassettes/Operation/NonSecure/Operation/Add_deployment_should_be_doable.json +0 -23
- data/spec/vcr_cassettes/Operation/NonSecure/Operation/Add_non-XA_datasource_should_be_doable.json +0 -23
- data/spec/vcr_cassettes/Operation/NonSecure/Operation/Disable_should_be_performed_and_eventually_respond_with_success.json +0 -23
- data/spec/vcr_cassettes/Operation/NonSecure/Operation/Remove_JDBC_driver_should_be_performed_and_eventually_respond_with_success.json +0 -23
- data/spec/vcr_cassettes/Operation/NonSecure/Operation/Remove_datasource_should_be_performed_and_eventually_respond_with_success.json +0 -23
- data/spec/vcr_cassettes/Operation/NonSecure/Operation/Restart_can_be_run_multiple_times_in_parallel.json +0 -32
- data/spec/vcr_cassettes/Operation/NonSecure/Operation/Restart_should_be_performed_and_eventually_respond_with_success.json +0 -23
- data/spec/vcr_cassettes/Operation/NonSecure/Operation/Restart_should_not_be_performed_if_resource_path_is_wrong.json +0 -23
- data/spec/vcr_cassettes/Operation/NonSecure/Operation/Undeploy_deployment_should_be_performed_and_eventually_respond_with_success.json +0 -23
- data/spec/vcr_cassettes/Operation/NonSecure/Operation/Update_collection_intervals_should_be_performed_and_eventually_respond_with_success.json +0 -23
- data/spec/vcr_cassettes/Operation/NonSecure/Operation/should_not_be_possible_to_perform_on_closed_client.json +0 -12
- data/spec/vcr_cassettes/Operation/NonSecure/Websocket_connection/should_bail_with_hash_property_error_because_no_callback_at_all.json +0 -9
- data/spec/vcr_cassettes/Operation/NonSecure/Websocket_connection/should_bail_with_hash_property_error_because_no_error-callback_.json +0 -9
- data/spec/vcr_cassettes/Operation/NonSecure/Websocket_connection/should_bail_with_no_host.json +0 -3
- data/spec/vcr_cassettes/Operation/NonSecure/Websocket_connection/should_be_established.json +0 -9
- data/spec/vcr_cassettes/Operation/NonSecure/Websocket_connection/should_be_established_via_entrypoint.json +0 -9
- data/spec/vcr_cassettes/Operation/NonSecure/Websocket_connection/should_run_into_error_callback.json +0 -18
- data/spec/vcr_cassettes/Operation/NonSecure/Websocket_connection/should_run_into_error_callback_because_bad_hash_parameters.json +0 -13
- data/spec/vcr_cassettes/Operation/Secure/Helpers/Templates/get_feed.yml +0 -61
- data/spec/vcr_cassettes/Operation/Secure/Helpers/Templates/get_tenant.yml +0 -55
- data/spec/vcr_cassettes/Operation/Secure/Operation/Add_JDBC_driver_should_add_the_driver.json +0 -23
- data/spec/vcr_cassettes/Operation/Secure/Operation/Add_datasource_should_be_doable.json +0 -23
- data/spec/vcr_cassettes/Operation/Secure/Operation/Add_deployment_should_be_doable.json +0 -23
- data/spec/vcr_cassettes/Operation/Secure/Operation/Disable_should_be_performed_and_eventually_respond_with_success.json +0 -23
- data/spec/vcr_cassettes/Operation/Secure/Operation/Remove_JDBC_driver_should_be_performed_and_eventually_respond_with_success.json +0 -23
- data/spec/vcr_cassettes/Operation/Secure/Operation/Remove_datasource_should_be_performed_and_eventually_respond_with_success.json +0 -23
- data/spec/vcr_cassettes/Operation/Secure/Operation/Restart_can_be_run_multiple_times_in_parallel.json +0 -32
- data/spec/vcr_cassettes/Operation/Secure/Operation/Restart_should_be_performed_and_eventually_respond_with_success.json +0 -23
- data/spec/vcr_cassettes/Operation/Secure/Operation/Restart_should_not_be_performed_if_resource_path_is_wrong.json +0 -23
- data/spec/vcr_cassettes/Operation/Secure/Operation/Undeploy_deployment_should_be_performed_and_eventually_respond_with_success.json +0 -23
- data/spec/vcr_cassettes/Operation/Secure/Operation/should_not_be_possible_to_perform_on_closed_client.json +0 -12
- data/spec/vcr_cassettes/Operation/Secure/Websocket_connection/should_bail_with_hash_property_error_because_no_callback_at_all.json +0 -9
- data/spec/vcr_cassettes/Operation/Secure/Websocket_connection/should_bail_with_hash_property_error_because_no_error-callback_.json +0 -9
- data/spec/vcr_cassettes/Operation/Secure/Websocket_connection/should_bail_with_no_host.json +0 -3
- data/spec/vcr_cassettes/Operation/Secure/Websocket_connection/should_be_established.json +0 -9
- data/spec/vcr_cassettes/Operation/Secure/Websocket_connection/should_be_established_via_entrypoint.json +0 -9
- data/spec/vcr_cassettes/Operation/Secure/Websocket_connection/should_run_into_error_callback.json +0 -18
- data/spec/vcr_cassettes/Operation/Secure/Websocket_connection/should_run_into_error_callback_because_bad_hash_parameters.json +0 -13
- data/spec/vcr_cassettes/Tokens/Should_be_able_to_create_a_new_token_for_an_actual_user.yml +0 -57
- data/spec/vcr_cassettes/Tokens/Should_be_able_to_list_the_available_tokens.yml +0 -49
- data/spec/vcr_cassettes/Tokens/Should_get_a_401_when_attempting_to_create_a_token_with_a_wrong_password.yml +0 -56
- data/spec/vcr_cassettes/Tokens/Should_get_a_401_when_attempting_to_create_a_token_without_a_password.yml +0 -55
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e76b799552626ef0cdf91e857c5d3adaf87eb895
|
4
|
+
data.tar.gz: 60e0412e27855f6938372e48cf4b5a891636558f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58308a3a777a01ee4d24def939d59a79b520e23632d78103f198af1b38812561699d749ccfd242fdcf64ebb25453cd8b0060f1976c123c8f4b3d46a3dc1487b2
|
7
|
+
data.tar.gz: c2321e151cf25093156ccf8c070041ac7759d2c6ed1e824af9bf631546078324206bf0e46465a4e9a39fc4b2e7fadea1673a20e1479e47b4520bcbf2a3587c48
|
data/CHANGES.rdoc
CHANGED
@@ -3,6 +3,33 @@
|
|
3
3
|
This document describes the relevant changes between releases of the
|
4
4
|
_hawkular-client_ project.
|
5
5
|
|
6
|
+
|
7
|
+
=== V 3.0.0
|
8
|
+
* Starting this version the older Hawkular Services (prior version 0.36.0.Final, excluding) are not compatible
|
9
|
+
* We added support for multitenancy
|
10
|
+
* We removed the deprecated API mentioned in the previous release notes
|
11
|
+
* A lot of methods in the inventory client have been changed or removed, here is the list:
|
12
|
+
1. <code>get_tenant</code> - removed
|
13
|
+
2. <code>list_relationships</code> - removed
|
14
|
+
3. <code>list_relationships_for_feed</code> - removed
|
15
|
+
4. <code>get_entity</code> - removed
|
16
|
+
5. <code>delete_feed</code> - removed
|
17
|
+
6. <code>create_feed</code> - removed
|
18
|
+
7. <code>create_resource_type</code> - removed
|
19
|
+
8. <code>create_resource</code> - removed
|
20
|
+
9. <code>create_resource_under_resource</code> - removed
|
21
|
+
10. <code>create_metric_type</code> - removed
|
22
|
+
11. <code>create_metric_for_resource</code> - removed
|
23
|
+
12. <code>events</code> - removed
|
24
|
+
13. <code>no_more_events!</code> - removed
|
25
|
+
14. <code>list_metrics_for_resource_type
|
26
|
+
15. <code>list_resource_types(feed_id)</code> - now the feed_id parameter is mandatory
|
27
|
+
|
28
|
+
Also the payload/parameters are now different:
|
29
|
+
* Metric ids follow this pattern <code>inventory.#{feedid}.#{type}.#{id}</code>
|
30
|
+
* Each metric is tagged with following tag <code>{module: 'inventory', feed: #{feedid}, type: #{type}, id: #{id}}</code>
|
31
|
+
* more details in the PR description (https://github.com/hawkular/hawkular-client-ruby/pull/196#issue-214961468)
|
32
|
+
|
6
33
|
=== V 2.9.0
|
7
34
|
* Adding a way to update collection interval on the agent
|
8
35
|
* Fixed <code>get_entity</code> method in the inventory client
|
data/README.rdoc
CHANGED
@@ -6,12 +6,12 @@
|
|
6
6
|
|
7
7
|
A Ruby Hawkular Client.
|
8
8
|
|
9
|
-
Documentation[http://www.hawkular.org/hawkular-client-ruby/]
|
9
|
+
Documentation[http://www.hawkular.org/hawkular-client-ruby/docs/]
|
10
10
|
|
11
11
|
== Changelog
|
12
12
|
|
13
|
-
See {CHANGELOG}[
|
14
|
-
{API-Breaking-Changes}[link:file.api_breaking_changes.html] for a list of api-breaking changes.
|
13
|
+
See {CHANGELOG}[http://www.hawkular.org/hawkular-client-ruby/docs/latest/file.CHANGES.html] for a list of changes and
|
14
|
+
{API-Breaking-Changes}[link:http://www.hawkular.org/hawkular-client-ruby/docs/latest/file.api_breaking_changes.html] for a list of api-breaking changes.
|
15
15
|
|
16
16
|
== Overview
|
17
17
|
|
@@ -49,7 +49,7 @@ Metrics API is also subdivided to: Mixed, Availability, Counters, Gauges and Ten
|
|
49
49
|
client.metrics.tenants # Tenants
|
50
50
|
|
51
51
|
The Mixed API is capable of handling multiple types of metrics, like the
|
52
|
-
push_data[Hawkular/Metrics/Client.html#push_data-instance_method] method, which pushes data
|
52
|
+
push_data[http://www.hawkular.org/hawkular-client-ruby/docs/latest/Hawkular/Metrics/Client.html#push_data-instance_method] method, which pushes data
|
53
53
|
for multiple metrics of all supported data.
|
54
54
|
|
55
55
|
You can also access each subproject's API individually, if you would like to use only the metrics API you could do
|
@@ -102,20 +102,20 @@ Each network01_avail will be an array like:
|
|
102
102
|
# ...
|
103
103
|
]
|
104
104
|
|
105
|
-
You can get more info on the other parameters by checking the metrics API get_data[Hawkular/Metrics/Client/Metrics#get_data-instance_method]
|
105
|
+
You can get more info on the other parameters by checking the metrics API get_data[http://www.hawkular.org/hawkular-client-ruby/docs/latest/Hawkular/Metrics/Client/Metrics#get_data-instance_method]
|
106
106
|
|
107
107
|
=== More info
|
108
108
|
|
109
109
|
Check each resource API for a detailed description of what methods are available.
|
110
|
-
* Alerts[Hawkular/Alerts/AlertsClient.html]
|
111
|
-
* Inventory[Hawkular/Inventory/InventoryClient.html]
|
110
|
+
* Alerts[http://www.hawkular.org/hawkular-client-ruby/docs/latest/Hawkular/Alerts/AlertsClient.html]
|
111
|
+
* Inventory[http://www.hawkular.org/hawkular-client-ruby/docs/latest/Hawkular/Inventory/InventoryClient.html]
|
112
112
|
* Metrics:
|
113
|
-
* Mixed[Hawkular/Metrics/Client.html]
|
114
|
-
* Availability[Hawkular/Metrics/Client/Availability.html]
|
115
|
-
* Counters[Hawkular/Metrics/Client/Counters.html]
|
116
|
-
* Gauges[Hawkular/Metrics/Client/Gauges.html]
|
117
|
-
* Tenants[Hawkular/Metrics/Client/Tenants.html]
|
118
|
-
* Operations[Hawkular/Operations/OperationsClient.html]
|
113
|
+
* Mixed[http://www.hawkular.org/hawkular-client-ruby/docs/latest/Hawkular/Metrics/Client.html]
|
114
|
+
* Availability[http://www.hawkular.org/hawkular-client-ruby/docs/latest/Hawkular/Metrics/Client/Availability.html]
|
115
|
+
* Counters[http://www.hawkular.org/hawkular-client-ruby/docs/latest/Hawkular/Metrics/Client/Counters.html]
|
116
|
+
* Gauges[http://www.hawkular.org/hawkular-client-ruby/docs/latest/Hawkular/Metrics/Client/Gauges.html]
|
117
|
+
* Tenants[http://www.hawkular.org/hawkular-client-ruby/docs/latest/Hawkular/Metrics/Client/Tenants.html]
|
118
|
+
* Operations[http://www.hawkular.org/hawkular-client-ruby/docs/latest/Hawkular/Operations/OperationsClient.html]
|
119
119
|
|
120
120
|
== Contributing to hawkular-client-ruby
|
121
121
|
|
@@ -145,7 +145,7 @@ Integration tests are recorded and played against cassettes recorded with VCR
|
|
145
145
|
* Currently, we support two posible metrics contexts: <code>hawkular-metrics 0.8.0.Final</code> and <code>hawkular-services</code> that contain metrics. If you want to run/re-record the tests only for services, you can skip the other context by <code>SKIP_V8_METRICS=1</code>, or similarly <code>SKIP_SERVICES_METRICS=1</code>. So for instance updating the VCR templates only for hawkular-services would require command:
|
146
146
|
VCR_UPDATE=1 SKIP_V8_METRICS=1 rspec ./spec/integration/metric_spec.rb
|
147
147
|
|
148
|
-
For more details consult the {spec readme}[link:
|
148
|
+
For more details consult the {spec readme}[link:http://www.hawkular.org/hawkular-client-ruby/docs/latest/file.README.html].
|
149
149
|
|
150
150
|
== Logging
|
151
151
|
|
@@ -246,8 +246,18 @@ module Hawkular::Alerts
|
|
246
246
|
# @param [Hash]criteria optional query criteria
|
247
247
|
# @return [Array<Alert>] List of alerts in the system. Can be empty
|
248
248
|
def list_alerts(criteria = {})
|
249
|
+
alerts(criteria: criteria)
|
250
|
+
end
|
251
|
+
|
252
|
+
# List fired alerts
|
253
|
+
# @param [Hash] criteria optional query criteria
|
254
|
+
# @param [Array] tenants optional list of tenants. The elements of the array can be any object
|
255
|
+
# convertible to a string
|
256
|
+
# @return [Array<Alert>] List of alerts in the system. Can be empty
|
257
|
+
def alerts(criteria: {}, tenants:nil)
|
249
258
|
query = generate_query_params(criteria)
|
250
|
-
|
259
|
+
uri = tenants ? '/admin/alerts/' : '/'
|
260
|
+
ret = http_get(uri + query, multi_tenants_header(tenants))
|
251
261
|
val = []
|
252
262
|
ret.each { |a| val.push(Alert.new(a)) }
|
253
263
|
val
|
@@ -298,9 +308,26 @@ module Hawkular::Alerts
|
|
298
308
|
# thin boolean, return lighter events (omits triggering data for trigger-generated events)
|
299
309
|
# @param [Hash] criteria optional query criteria
|
300
310
|
# @return [Array<Event>] List of events. Can be empty
|
301
|
-
def list_events(
|
302
|
-
|
303
|
-
|
311
|
+
def list_events(criteria = {})
|
312
|
+
events(criteria: criteria)
|
313
|
+
end
|
314
|
+
|
315
|
+
# List Events given optional criteria. Criteria keys are strings (not symbols):
|
316
|
+
# startTime numeric, milliseconds from epoch
|
317
|
+
# endTime numeric, milliseconds from epoch
|
318
|
+
# eventIds array of strings
|
319
|
+
# triggerIds array of strings
|
320
|
+
# categories array of strings
|
321
|
+
# tags array of strings, each tag of format 'name|value'. Specify '*' for value to match all values
|
322
|
+
# thin boolean, return lighter events (omits triggering data for trigger-generated events)
|
323
|
+
# @param [Hash] criteria optional query criteria
|
324
|
+
# @param [Array] tenants optional list of tenants. The elements of the array can be any object
|
325
|
+
# convertible to a string
|
326
|
+
# @return [Array<Event>] List of events. Can be empty
|
327
|
+
def events(criteria: {}, tenants: nil)
|
328
|
+
query = generate_query_params(criteria)
|
329
|
+
uri = tenants ? '/admin/events' : '/events'
|
330
|
+
http_get(uri + query, multi_tenants_header(tenants)).map { |e| Event.new(e) }
|
304
331
|
end
|
305
332
|
|
306
333
|
# Inject an event into Hawkular-alerts
|
@@ -338,6 +365,18 @@ module Hawkular::Alerts
|
|
338
365
|
query = generate_query_params(alertIds: alert_ids, tagNames: tag_names)
|
339
366
|
http_delete('/tags' + query)
|
340
367
|
end
|
368
|
+
|
369
|
+
private
|
370
|
+
|
371
|
+
# Builds the tenant HTTP header for multi-tenant operations
|
372
|
+
# @param [Array] tenants an array of tenant names. The elements of the array can
|
373
|
+
# be any object convertible to a string. Can be nil
|
374
|
+
# @return [Hash] The HTTP header for multi-tenant operations. An empty hash is returned
|
375
|
+
# if tenants parameter is nil
|
376
|
+
def multi_tenants_header(tenants)
|
377
|
+
tenants = tenants.join(',') if tenants.respond_to?(:join)
|
378
|
+
tenants ? { 'Hawkular-Tenant': tenants } : {}
|
379
|
+
end
|
341
380
|
end
|
342
381
|
|
343
382
|
# Representation of one Trigger
|
@@ -575,7 +614,4 @@ module Hawkular::Alerts
|
|
575
614
|
super(event_hash)
|
576
615
|
end
|
577
616
|
end
|
578
|
-
|
579
|
-
AlertsClient = Client
|
580
|
-
deprecate_constant :AlertsClient if self.respond_to? :deprecate_constant
|
581
617
|
end
|
@@ -32,7 +32,7 @@ module Hawkular
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def inventory
|
35
|
-
@inventory ||= Inventory::Client.new("#{@state[:entrypoint]}/hawkular/
|
35
|
+
@inventory ||= Inventory::Client.new("#{@state[:entrypoint]}/hawkular/metrics",
|
36
36
|
@state[:credentials],
|
37
37
|
@state[:options])
|
38
38
|
end
|
@@ -66,6 +66,8 @@ module Hawkular::Inventory
|
|
66
66
|
super(res_hash)
|
67
67
|
if res_hash.key? :resourceTypePath
|
68
68
|
@type_path = res_hash[:resourceTypePath]
|
69
|
+
elsif res_hash.key? 'resourceTypePath'
|
70
|
+
@type_path = res_hash['resourceTypePath']
|
69
71
|
else
|
70
72
|
@type = res_hash['type']
|
71
73
|
@type_path = res_hash['type']['path']
|
@@ -105,13 +107,13 @@ module Hawkular::Inventory
|
|
105
107
|
# @return [String] metric id used in Hawkular Metrics
|
106
108
|
attr_reader :hawkular_metric_id
|
107
109
|
|
108
|
-
def initialize(metric_hash)
|
110
|
+
def initialize(metric_hash, metric_type)
|
109
111
|
super(metric_hash)
|
110
|
-
@type =
|
111
|
-
@type_path = metric_hash['
|
112
|
-
@type_id =
|
113
|
-
@unit =
|
114
|
-
@collection_interval = metric_hash['
|
112
|
+
@type = metric_type.type
|
113
|
+
@type_path = metric_hash['metricTypePath']
|
114
|
+
@type_id = metric_type.id
|
115
|
+
@unit = metric_type.unit
|
116
|
+
@collection_interval = metric_hash['collectionInterval'] || metric_type.collection_interval
|
115
117
|
@hawkular_metric_id = @properties.key?('hawkular-metric-id') ? @properties['hawkular-metric-id'] : @id
|
116
118
|
end
|
117
119
|
end
|
@@ -158,6 +160,8 @@ module Hawkular::Inventory
|
|
158
160
|
end
|
159
161
|
|
160
162
|
class CanonicalPath
|
163
|
+
include Hawkular::ClientUtils
|
164
|
+
|
161
165
|
attr_reader :tenant_id
|
162
166
|
attr_reader :feed_id
|
163
167
|
attr_reader :environment_id
|
@@ -181,24 +185,47 @@ module Hawkular::Inventory
|
|
181
185
|
CanonicalPath.new(path_to_h path)
|
182
186
|
end
|
183
187
|
|
188
|
+
def self.parse_if_string(path)
|
189
|
+
path.is_a?(CanonicalPath) ? path : CanonicalPath.parse(path)
|
190
|
+
end
|
191
|
+
|
192
|
+
def copy_hash
|
193
|
+
hash = to_h
|
194
|
+
hash[:resource_ids] = hash[:resource_ids].clone unless hash[:resource_ids].nil?
|
195
|
+
hash
|
196
|
+
end
|
197
|
+
|
184
198
|
# Move up to the parent path of the resource. resource_ids set to empty array when there is no parent.
|
185
199
|
# @return CanonicalPath corresponding to the direct ancestor of the resource represented by this path object.
|
186
200
|
def up
|
187
|
-
hash =
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
hash[:resource_ids].pop
|
192
|
-
end
|
201
|
+
hash = copy_hash
|
202
|
+
res = hash[:resource_ids] || []
|
203
|
+
res = res.take(res.length - 1) unless res.empty?
|
204
|
+
hash[:resource_ids] = res
|
193
205
|
CanonicalPath.new(hash)
|
194
206
|
end
|
195
207
|
|
196
|
-
#
|
197
|
-
# @return CanonicalPath
|
198
|
-
def
|
199
|
-
hash =
|
200
|
-
hash[:resource_ids] = []
|
201
|
-
hash
|
208
|
+
# Add resource down to the current path
|
209
|
+
# @return a new CanonicalPath based on the current one
|
210
|
+
def down(resource)
|
211
|
+
hash = copy_hash
|
212
|
+
hash[:resource_ids] = (hash[:resource_ids] || []) << hawk_escape_id(resource)
|
213
|
+
CanonicalPath.new(hash)
|
214
|
+
end
|
215
|
+
|
216
|
+
# Set resource type to the current path
|
217
|
+
# @return a new CanonicalPath based on the current one
|
218
|
+
def resource_type(resource_type)
|
219
|
+
hash = copy_hash
|
220
|
+
hash[:resource_type_id] = hawk_escape_id(resource_type)
|
221
|
+
CanonicalPath.new(hash)
|
222
|
+
end
|
223
|
+
|
224
|
+
# Set metric type to the current path
|
225
|
+
# @return a new CanonicalPath based on the current one
|
226
|
+
def metric_type(metric_type)
|
227
|
+
hash = copy_hash
|
228
|
+
hash[:metric_type_id] = hawk_escape_id(metric_type)
|
202
229
|
CanonicalPath.new(hash)
|
203
230
|
end
|
204
231
|
|
@@ -224,11 +251,20 @@ module Hawkular::Inventory
|
|
224
251
|
ret += "/e;#{@environment_id}" unless @environment_id.nil?
|
225
252
|
ret += "/rt;#{@resource_type_id}" unless @resource_type_id.nil?
|
226
253
|
ret += "/mt;#{@metric_type_id}" unless @metric_type_id.nil?
|
227
|
-
ret += "/m;#{@metric_id}" unless @metric_id.nil?
|
228
254
|
ret += resources_chunk.to_s
|
255
|
+
ret += "/m;#{@metric_id}" unless @metric_id.nil?
|
229
256
|
ret
|
230
257
|
end
|
231
258
|
|
259
|
+
def to_tags
|
260
|
+
fail 'Missing feed_id' if @feed_id.nil?
|
261
|
+
tags = "module:inventory,feed:#{Regexp.quote(@feed_id)}"
|
262
|
+
tags += ",type:rt,id:#{Regexp.quote(@resource_type_id)}" if @resource_type_id
|
263
|
+
tags += ",type:mt,id:#{Regexp.quote(@metric_type_id)}" if @metric_type_id
|
264
|
+
tags += ",type:r,id:#{Regexp.quote(@resource_ids[0])}" if @resource_ids && (!@resource_ids.empty?)
|
265
|
+
tags
|
266
|
+
end
|
267
|
+
|
232
268
|
protected
|
233
269
|
|
234
270
|
def state
|
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'hawkular/base_client'
|
2
2
|
require 'websocket-client-simple'
|
3
3
|
require 'json'
|
4
|
+
require 'zlib'
|
5
|
+
require 'stringio'
|
4
6
|
|
5
7
|
require 'hawkular/inventory/entities'
|
6
8
|
|
@@ -20,7 +22,7 @@ module Hawkular::Inventory
|
|
20
22
|
# @param credentials [Hash{String=>String}] Hash of username, password, token(optional)
|
21
23
|
# @param options [Hash{String=>String}] Additional rest client options
|
22
24
|
def initialize(entrypoint = nil, credentials = {}, options = {})
|
23
|
-
entrypoint = normalize_entrypoint_url entrypoint, 'hawkular/
|
25
|
+
entrypoint = normalize_entrypoint_url entrypoint, 'hawkular/metrics'
|
24
26
|
@entrypoint = entrypoint
|
25
27
|
super(entrypoint, credentials, options)
|
26
28
|
version = fetch_version_and_status['Implementation-Version']
|
@@ -32,45 +34,54 @@ module Hawkular::Inventory
|
|
32
34
|
# entrypoint: http://localhost:8080/hawkular/inventory
|
33
35
|
# and another sub-hash containing the hash with username[String], password[String], token(optional)
|
34
36
|
def self.create(hash)
|
35
|
-
fail 'no parameter ":entrypoint" given'
|
37
|
+
fail 'no parameter ":entrypoint" given' unless hash[:entrypoint]
|
36
38
|
hash[:credentials] ||= {}
|
37
39
|
hash[:options] ||= {}
|
38
40
|
Client.new(hash[:entrypoint], hash[:credentials], hash[:options])
|
39
41
|
end
|
40
42
|
|
41
|
-
# Retrieve the tenant id for the passed credentials.
|
42
|
-
# If no credentials are passed, the ones from the constructor are used
|
43
|
-
# @param credentials [Hash{String=>String}] Hash of username, password, token(optional)
|
44
|
-
# @return [String] tenant id
|
45
|
-
# @deprecated this doesn't provide any value, because it merely returns the tenant ID which is known before the
|
46
|
-
# call anyway.
|
47
|
-
def get_tenant(credentials = {})
|
48
|
-
creds = credentials.empty? ? @credentials : credentials
|
49
|
-
auth_header = { Authorization: base_64_credentials(creds) }
|
50
|
-
|
51
|
-
ret = http_get('/tenant', auth_header)
|
52
|
-
|
53
|
-
ret['id']
|
54
|
-
end
|
55
|
-
|
56
43
|
# List feeds in the system
|
57
44
|
# @return [Array<String>] List of feed ids
|
58
45
|
def list_feeds
|
59
|
-
ret = http_get('/
|
60
|
-
ret.
|
46
|
+
ret = http_get('/strings/tags/module:inventory,feed:*')
|
47
|
+
return [] unless ret.key? 'feed'
|
48
|
+
ret['feed']
|
61
49
|
end
|
62
50
|
|
63
|
-
# List resource types
|
64
|
-
# @param [String] feed_id The id of the feed the type lives under
|
51
|
+
# List resource types for the given feed
|
52
|
+
# @param [String] feed_id The id of the feed the type lives under
|
65
53
|
# @return [Array<ResourceType>] List of types, that can be empty
|
66
|
-
def list_resource_types(feed_id
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
54
|
+
def list_resource_types(feed_id)
|
55
|
+
fail 'Feed id must be given' unless feed_id
|
56
|
+
feed_path = feed_cp(feed_id)
|
57
|
+
response = http_post(
|
58
|
+
'/strings/raw/query',
|
59
|
+
fromEarliest: true,
|
60
|
+
order: 'DESC',
|
61
|
+
tags: "#{feed_path.to_tags},type:rt")
|
62
|
+
structures = extract_structures_from_body(response)
|
63
|
+
structures.map do |rt|
|
64
|
+
root_hash = entity_json_to_hash(-> (id) { feed_path.resource_type(id) }, rt['inventoryStructure'], false)
|
65
|
+
ResourceType.new(root_hash)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# List metric types for the given feed
|
70
|
+
# @param [String] feed_id The id of the feed the type lives under
|
71
|
+
# @return [Array<MetricType>] List of types, that can be empty
|
72
|
+
def list_metric_types(feed_id)
|
73
|
+
fail 'Feed id must be given' unless feed_id
|
74
|
+
feed_path = feed_cp(feed_id)
|
75
|
+
response = http_post(
|
76
|
+
'/strings/raw/query',
|
77
|
+
fromEarliest: true,
|
78
|
+
order: 'DESC',
|
79
|
+
tags: "#{feed_path.to_tags},type:mt")
|
80
|
+
structures = extract_structures_from_body(response)
|
81
|
+
structures.map do |mt|
|
82
|
+
root_hash = entity_json_to_hash(-> (id) { feed_path.metric_type(id) }, mt['inventoryStructure'], false)
|
83
|
+
MetricType.new(root_hash)
|
72
84
|
end
|
73
|
-
ret.map { |rt| ResourceType.new(rt) }
|
74
85
|
end
|
75
86
|
|
76
87
|
# Return all resources for a feed
|
@@ -79,14 +90,16 @@ module Hawkular::Inventory
|
|
79
90
|
# @return [Array<Resource>] List of resources, which can be empty.
|
80
91
|
def list_resources_for_feed(feed_id, fetch_properties = false, filter = {})
|
81
92
|
fail 'Feed id must be given' unless feed_id
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
93
|
+
feed_path = feed_cp(feed_id)
|
94
|
+
response = http_post(
|
95
|
+
'/strings/raw/query',
|
96
|
+
fromEarliest: true,
|
97
|
+
order: 'DESC',
|
98
|
+
tags: "#{feed_path.to_tags},type:r")
|
99
|
+
structures = extract_structures_from_body(response)
|
100
|
+
to_filter = structures.map do |r|
|
101
|
+
root_hash = entity_json_to_hash(-> (id) { feed_path.down(id) }, r['inventoryStructure'], fetch_properties)
|
102
|
+
Resource.new(root_hash)
|
90
103
|
end
|
91
104
|
filter_entities(to_filter, filter)
|
92
105
|
end
|
@@ -99,33 +112,34 @@ module Hawkular::Inventory
|
|
99
112
|
# @param [Boolean] fetch_properties Shall additional runtime properties be fetched?
|
100
113
|
# @return [Array<Resource>] List of resources. Can be empty
|
101
114
|
def list_resources_for_type(resource_type_path, fetch_properties = false)
|
102
|
-
path =
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
115
|
+
path = CanonicalPath.parse_if_string(resource_type_path)
|
116
|
+
fail 'Feed id must be given' unless path.feed_id
|
117
|
+
fail 'Resource type must be given' unless path.resource_type_id
|
118
|
+
|
119
|
+
# Fetch metrics by tag
|
120
|
+
feed_path = feed_cp(URI.unescape(path.feed_id))
|
121
|
+
resource_type_id = URI.unescape(path.resource_type_id)
|
122
|
+
escaped_for_regex = Regexp.quote("|#{resource_type_id}|")
|
123
|
+
response = http_post(
|
124
|
+
'/strings/raw/query',
|
125
|
+
fromEarliest: true,
|
126
|
+
order: 'DESC',
|
127
|
+
tags: "#{feed_path.to_tags},type:r,restypes:.*#{escaped_for_regex}.*")
|
128
|
+
structures = extract_structures_from_body(response)
|
129
|
+
return [] if structures.empty?
|
130
|
+
|
131
|
+
# Now find each collected resource path in their belonging InventoryStructure
|
132
|
+
extract_resources_for_type(structures, feed_path, resource_type_id, fetch_properties)
|
117
133
|
end
|
118
134
|
|
119
135
|
# Retrieve runtime properties for the passed resource
|
120
136
|
# @param [String] resource_path Canonical path of the resource to read properties from.
|
121
137
|
# @return [Hash<String,Object] Hash with additional data
|
122
138
|
def get_config_data_for_resource(resource_path)
|
123
|
-
path =
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
rescue
|
128
|
-
{}
|
139
|
+
path = CanonicalPath.parse_if_string(resource_path)
|
140
|
+
raw_hash = get_raw_entity_hash(path)
|
141
|
+
return {} unless raw_hash
|
142
|
+
{ 'value' => fetch_properties(raw_hash) }
|
129
143
|
end
|
130
144
|
|
131
145
|
# Obtain the child resources of the passed resource. In case of a WildFly server,
|
@@ -135,108 +149,38 @@ module Hawkular::Inventory
|
|
135
149
|
# @return [Array<Resource>] List of resources that are children of the given parent resource.
|
136
150
|
# Can be empty
|
137
151
|
def list_child_resources(parent_res_path, recursive = false)
|
138
|
-
path =
|
139
|
-
parent_resource_path = 'r;' + path.resource_ids.join('/r;')
|
152
|
+
path = CanonicalPath.parse_if_string(parent_res_path)
|
140
153
|
feed_id = path.feed_id
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
else
|
145
|
-
ret = http_get("/traversal/f;#{feed_id}/#{parent_resource_path}/type=r")
|
146
|
-
end
|
147
|
-
ret.map { |r| Resource.new(r) }
|
148
|
-
end
|
149
|
-
|
150
|
-
# Obtain a list of relationships starting at the passed resource
|
151
|
-
# @param [String] entity_path Canonical path of the entity that forms the one end of the relationship
|
152
|
-
# @param [String] named Name of the relationship
|
153
|
-
# @return [Array<Relationship>] List of relationships
|
154
|
-
def list_relationships(entity_path, named = nil)
|
155
|
-
path = entity_path.is_a?(CanonicalPath) ? entity_path : CanonicalPath.parse(entity_path)
|
156
|
-
query_params = {
|
157
|
-
sort: '__targetCp'
|
158
|
-
}
|
159
|
-
|
160
|
-
query = generate_query_params query_params
|
161
|
-
if named.nil?
|
162
|
-
ret = http_get("/traversal#{path}/relationships#{query}")
|
163
|
-
else
|
164
|
-
ret = http_get("/traversal#{path}/relationships;name=#{named}#{query}")
|
165
|
-
end
|
166
|
-
|
167
|
-
ret.map { |r| Relationship.new(r) }
|
168
|
-
end
|
169
|
-
|
170
|
-
# Obtain a list of relationships for the passed feed
|
171
|
-
# @param [String] feed_id Id of the feed
|
172
|
-
# @param [String] named Name of the relationship
|
173
|
-
# @return [Array<Relationship>] List of relationships
|
174
|
-
def list_relationships_for_feed(feed_id, named = nil)
|
175
|
-
the_feed = hawk_escape_id feed_id
|
176
|
-
query_params = {
|
177
|
-
sort: '__targetCp'
|
178
|
-
}
|
179
|
-
|
180
|
-
query = generate_query_params query_params
|
181
|
-
if named.nil?
|
182
|
-
ret = http_get("/traversal/f;#{the_feed}/relationships#{query}")
|
183
|
-
else
|
184
|
-
ret = http_get("/traversal;/f;#{the_feed}/relationships;named=#{named}#{query}")
|
185
|
-
end
|
186
|
-
|
187
|
-
ret.map { |r| Relationship.new(r) }
|
188
|
-
rescue
|
189
|
-
[]
|
190
|
-
end
|
191
|
-
|
192
|
-
# Retrieve a single entity from inventory by its canonical path
|
193
|
-
# @param [String] path canonical path of the entity
|
194
|
-
# @return inventory entity
|
195
|
-
def get_entity(path)
|
196
|
-
c_path = path.is_a?(CanonicalPath) ? path : CanonicalPath.parse(path)
|
197
|
-
http_get("/entity#{c_path}")
|
154
|
+
fail 'Feed id must be given' unless feed_id
|
155
|
+
entity_hash = get_raw_entity_hash(path)
|
156
|
+
extract_child_resources([], path.to_s, entity_hash, recursive) if entity_hash
|
198
157
|
end
|
199
158
|
|
200
159
|
# List the metrics for the passed metric type. If feed is not passed in the path,
|
201
160
|
# all the metrics across all the feeds of a given type will be retrieved
|
202
|
-
# This method may perform multiple REST calls.
|
203
161
|
# @param [String] metric_type_path Canonical path of the resource type to look for. Can be obtained from
|
204
162
|
# {MetricType}.path. Must not be nil. The tenant_id in the canonical path doesn't have to be there.
|
205
163
|
# @return [Array<Metric>] List of metrics. Can be empty
|
206
164
|
def list_metrics_for_metric_type(metric_type_path)
|
207
|
-
path =
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
# @return [Array<Metric>] List of metrics. Can be empty
|
227
|
-
def list_metrics_for_resource_type(resource_type_path)
|
228
|
-
path = resource_type_path.is_a?(CanonicalPath) ? resource_type_path : CanonicalPath.parse(resource_type_path)
|
229
|
-
resource_type_id = path.resource_type_id
|
230
|
-
feed_id = path.feed_id
|
231
|
-
|
232
|
-
query = generate_query_params sort: 'id'
|
233
|
-
if feed_id.nil?
|
234
|
-
ret = http_get("/traversal/rt;#{resource_type_id}/rl;defines/type=r/rl;incorporates/type=m#{query}")
|
235
|
-
else
|
236
|
-
ret = http_get(
|
237
|
-
"/traversal/f;#{feed_id}/rt;#{resource_type_id}/rl;defines/type=r/rl;incorporates/type=m#{query}")
|
238
|
-
end
|
239
|
-
ret.map { |m| Metric.new(m) }
|
165
|
+
path = CanonicalPath.parse_if_string(metric_type_path)
|
166
|
+
fail 'Feed id must be given' unless path.feed_id
|
167
|
+
fail 'Metric type id must be given' unless path.metric_type_id
|
168
|
+
feed_id = URI.unescape(path.feed_id)
|
169
|
+
metric_type_id = URI.unescape(path.metric_type_id)
|
170
|
+
|
171
|
+
feed_path = feed_cp(feed_id)
|
172
|
+
escaped_for_regex = Regexp.quote("|#{metric_type_id}|")
|
173
|
+
response = http_post(
|
174
|
+
'/strings/raw/query',
|
175
|
+
fromEarliest: true,
|
176
|
+
order: 'DESC',
|
177
|
+
tags: "#{feed_path.to_tags},type:r,mtypes:.*#{escaped_for_regex}.*")
|
178
|
+
structures = extract_structures_from_body(response)
|
179
|
+
return [] if structures.empty?
|
180
|
+
|
181
|
+
# Now find each collected resource path in their belonging InventoryStructure
|
182
|
+
metric_type = get_metric_type(path)
|
183
|
+
extract_metrics_for_type(structures, feed_path, metric_type)
|
240
184
|
end
|
241
185
|
|
242
186
|
# List metric (definitions) for the passed resource. It is possible to filter down the
|
@@ -254,179 +198,87 @@ module Hawkular::Inventory
|
|
254
198
|
# # Don't filter, return all metric definitions
|
255
199
|
# client.list_metrics_for_resource(wild_fly)
|
256
200
|
def list_metrics_for_resource(resource_path, filter = {})
|
257
|
-
path =
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
def create_feed(feed_id, feed_name = nil)
|
272
|
-
feed = create_blueprint
|
273
|
-
feed[:id] = feed_id
|
274
|
-
feed[:name] = feed_name
|
275
|
-
|
276
|
-
begin
|
277
|
-
return http_post('/entity/feed', feed)
|
278
|
-
rescue HawkularException => error
|
279
|
-
# 409 We already exist -> that is ok
|
280
|
-
if error.status_code == 409
|
281
|
-
the_feed = hawk_escape_id feed_id
|
282
|
-
http_get("/entity/f;#{the_feed}")
|
283
|
-
else
|
284
|
-
raise
|
285
|
-
end
|
286
|
-
end
|
287
|
-
end
|
288
|
-
|
289
|
-
# Delete the feed with the passed feed id.
|
290
|
-
# @param feed_id Id of the feed to be deleted.
|
291
|
-
def delete_feed(feed_id)
|
292
|
-
the_feed = hawk_escape_id feed_id
|
293
|
-
http_delete("/entity/f;#{the_feed}")
|
294
|
-
end
|
295
|
-
|
296
|
-
# Create a new resource type
|
297
|
-
# @param [String] feed_id Id of the feed to add the type to
|
298
|
-
# @param [String] type_id Id of the new type
|
299
|
-
# @param [String] type_name Name of the type
|
300
|
-
# @return [ResourceType] ResourceType object just created
|
301
|
-
def create_resource_type(feed_id, type_id, type_name)
|
302
|
-
the_feed = hawk_escape_id feed_id
|
303
|
-
|
304
|
-
type = create_blueprint
|
305
|
-
type[:id] = type_id
|
306
|
-
type[:name] = type_name
|
307
|
-
|
308
|
-
begin
|
309
|
-
http_post("/entity/f;#{the_feed}/resourceType", type)
|
310
|
-
rescue HawkularException => error
|
311
|
-
# 409 We already exist -> that is ok
|
312
|
-
raise unless error.status_code == 409
|
313
|
-
ensure
|
314
|
-
the_type = hawk_escape_id type_id
|
315
|
-
res = http_get("/entity/f;#{the_feed}/rt;#{the_type}")
|
316
|
-
end
|
317
|
-
ResourceType.new(res)
|
318
|
-
end
|
319
|
-
|
320
|
-
# Create a resource of a given type. To retrieve that resource
|
321
|
-
# you need to call {#get_resource}
|
322
|
-
# @param [String] resource_type_path Canonical path of the new resource's type.
|
323
|
-
# @param [String] resource_id Id of the new resource
|
324
|
-
# @param [String] resource_name Name of the new resource
|
325
|
-
# @param [Hash<String,Object>] properties Additional properties. Those are not the config-properties
|
326
|
-
def create_resource(resource_type_path, resource_id, resource_name = nil, properties = {})
|
327
|
-
create_resource_under_resource(resource_type_path, nil, resource_id, resource_name, properties)
|
328
|
-
end
|
329
|
-
|
330
|
-
# Create a resource of a given type under a given resource. To retrieve that resource
|
331
|
-
# you need to call {#get_resource}
|
332
|
-
# @param [String] res_type_path Canonical path of the new resource's type.
|
333
|
-
# @param [String] parent_res_path Canonical path of the resource under which we create this resource.
|
334
|
-
# If nil, the top-lvl resource will be created.
|
335
|
-
# @param [String] resource_id Id of the resource
|
336
|
-
# @param [String] resource_name Name of the resource
|
337
|
-
# @param [Hash<String,Object>] properties Additional properties. Those are not the config-properties
|
338
|
-
def create_resource_under_resource(res_type_path, parent_res_path, resource_id, resource_name = nil,
|
339
|
-
properties = {})
|
340
|
-
type_path = res_type_path.is_a?(CanonicalPath) ? res_type_path : CanonicalPath.parse(res_type_path)
|
341
|
-
feed_id = type_path.feed_id
|
342
|
-
|
343
|
-
res = create_blueprint
|
344
|
-
res[:properties] = properties
|
345
|
-
res[:id] = resource_id
|
346
|
-
res[:name] = resource_name
|
347
|
-
res[:resourceTypePath] = type_path.to_s
|
348
|
-
|
349
|
-
begin
|
350
|
-
if parent_res_path.nil?
|
351
|
-
res = http_post("/entity/f;#{feed_id}/resource", res)
|
352
|
-
else
|
353
|
-
path = parent_res_path.is_a?(CanonicalPath) ? parent_res_path : CanonicalPath.parse(parent_res_path)
|
354
|
-
resource_path = 'r;' + path.resource_ids.join('/r;')
|
355
|
-
res = http_post("/entity/f;#{feed_id}/#{resource_path}/resource", res)
|
356
|
-
end
|
357
|
-
rescue HawkularException => error
|
358
|
-
# 409 We already exist -> that is ok
|
359
|
-
raise unless error.status_code == 409
|
360
|
-
# Ensure we have a consistent behaviour if resource already exists Issue#180
|
361
|
-
if parent_res_path.nil?
|
362
|
-
hash = type_path.to_h
|
363
|
-
hash.delete(:metric_type_id)
|
364
|
-
path = CanonicalPath.new(hash)
|
201
|
+
path = CanonicalPath.parse_if_string(resource_path)
|
202
|
+
raw_hash = get_raw_entity_hash(path)
|
203
|
+
return [] unless raw_hash
|
204
|
+
to_filter = []
|
205
|
+
if (raw_hash.key? 'children') && (raw_hash['children'].key? 'metric') && !raw_hash['children']['metric'].empty?
|
206
|
+
# Need to merge metric type info that we must grab from another place
|
207
|
+
metric_types = list_metric_types(path.feed_id)
|
208
|
+
metric_types_index = {}
|
209
|
+
metric_types.each { |mt| metric_types_index[mt.path] = mt }
|
210
|
+
to_filter = raw_hash['children']['metric'].map do |m|
|
211
|
+
metric_data = m['data']
|
212
|
+
metric_data['path'] = "#{path}/m;#{metric_data['id']}"
|
213
|
+
metric_type = metric_types_index[metric_data['metricTypePath']]
|
214
|
+
Metric.new(metric_data, metric_type) if metric_type
|
365
215
|
end
|
366
|
-
|
216
|
+
to_filter = to_filter.select { |m| m }
|
367
217
|
end
|
368
|
-
|
218
|
+
filter_entities(to_filter, filter)
|
369
219
|
end
|
370
220
|
|
371
221
|
# Return the resource object for the passed path
|
372
222
|
# @param [String] resource_path Canonical path of the resource to fetch.
|
373
|
-
# @param [Boolean]
|
374
|
-
def get_resource(resource_path,
|
375
|
-
path =
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
if fetch_resource_config
|
381
|
-
p = get_config_data_for_resource(resource_path)
|
382
|
-
res['properties'] ||= {}
|
383
|
-
res['properties'].merge! p['value'] unless p['value'].nil?
|
223
|
+
# @param [Boolean] fetch_properties Should the resource config data be fetched?
|
224
|
+
def get_resource(resource_path, fetch_properties = true)
|
225
|
+
path = CanonicalPath.parse_if_string(resource_path)
|
226
|
+
raw_hash = get_raw_entity_hash(path)
|
227
|
+
unless raw_hash
|
228
|
+
exception = HawkularException.new("Resource not found: #{resource_path}")
|
229
|
+
fail exception
|
384
230
|
end
|
385
|
-
|
231
|
+
entity_hash = entity_json_to_hash(-> (_) { path }, raw_hash, fetch_properties)
|
232
|
+
Resource.new(entity_hash)
|
386
233
|
end
|
387
234
|
|
388
|
-
#
|
389
|
-
# @param [String]
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
the_feed = hawk_escape_id feed_id
|
397
|
-
|
398
|
-
metric_kind = type.nil? ? 'GAUGE' : type.upcase
|
399
|
-
fail "Unknown type #{metric_kind}" unless %w(GAUGE COUNTER AVAILABILITY').include?(metric_kind)
|
400
|
-
|
401
|
-
mt = build_metric_type_hash(collection_interval, metric_kind, metric_type_id, unit)
|
402
|
-
|
403
|
-
begin
|
404
|
-
http_post("/entity/f;#{the_feed}/metricType", mt)
|
405
|
-
rescue HawkularException => error
|
406
|
-
# 409 We already exist -> that is ok
|
407
|
-
raise unless error.status_code == 409
|
235
|
+
# Return the resource type object for the passed path
|
236
|
+
# @param [String] resource_type_path Canonical path of the resource type to fetch.
|
237
|
+
def get_resource_type(resource_type_path)
|
238
|
+
path = CanonicalPath.parse_if_string(resource_type_path)
|
239
|
+
raw_hash = get_raw_entity_hash(path)
|
240
|
+
unless raw_hash
|
241
|
+
exception = HawkularException.new("Resource type not found: #{resource_type_path}")
|
242
|
+
fail exception
|
408
243
|
end
|
244
|
+
entity_hash = entity_json_to_hash(-> (_) { path }, raw_hash, false)
|
245
|
+
ResourceType.new(entity_hash)
|
246
|
+
end
|
409
247
|
|
410
|
-
|
411
|
-
|
412
|
-
|
248
|
+
# Return the metric type object for the passed path
|
249
|
+
# @param [String] metric_type_path Canonical path of the metric type to fetch.
|
250
|
+
def get_metric_type(metric_type_path)
|
251
|
+
path = CanonicalPath.parse_if_string(metric_type_path)
|
252
|
+
raw_hash = get_raw_entity_hash(path)
|
253
|
+
unless raw_hash
|
254
|
+
exception = HawkularException.new("Metric type not found: #{metric_type_path}")
|
255
|
+
fail exception
|
256
|
+
end
|
257
|
+
entity_hash = entity_json_to_hash(-> (_) { path }, raw_hash, false)
|
258
|
+
MetricType.new(entity_hash)
|
413
259
|
end
|
414
260
|
|
415
261
|
# List operation definitions (types) for a given resource type
|
416
262
|
# @param [String] resource_type_path canonical path of the resource type entity
|
417
263
|
# @return [Array<String>] List of operation type ids
|
418
264
|
def list_operation_definitions(resource_type_path)
|
419
|
-
|
420
|
-
feed_id
|
421
|
-
resource_type_id
|
422
|
-
|
265
|
+
path = CanonicalPath.parse_if_string(resource_type_path)
|
266
|
+
fail 'Missing feed_id in resource_type_path' unless path.feed_id
|
267
|
+
fail 'Missing resource_type_id in resource_type_path' unless path.resource_type_id
|
268
|
+
response = http_post(
|
269
|
+
'/strings/raw/query',
|
270
|
+
fromEarliest: true,
|
271
|
+
order: 'DESC',
|
272
|
+
tags: path.to_tags)
|
273
|
+
structures = extract_structures_from_body(response)
|
423
274
|
res = {}
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
275
|
+
structures.map { |rt| rt['inventoryStructure'] }
|
276
|
+
.select { |rt| rt['children'] && rt['children']['operationType'] }
|
277
|
+
.flat_map { |rt| rt['children']['operationType'] }
|
278
|
+
.each do |ot|
|
279
|
+
hash = optype_json_to_hash(ot)
|
280
|
+
od = OperationDefinition.new hash
|
281
|
+
res[od.name] = od
|
430
282
|
end
|
431
283
|
res
|
432
284
|
end
|
@@ -435,94 +287,10 @@ module Hawkular::Inventory
|
|
435
287
|
# @param [String] resource_path canonical path of the resource entity
|
436
288
|
# @return [Array<String>] List of operation type ids
|
437
289
|
def list_operation_definitions_for_resource(resource_path)
|
438
|
-
resource = get_resource(resource_path
|
290
|
+
resource = get_resource(resource_path, false)
|
439
291
|
list_operation_definitions(resource.type_path)
|
440
292
|
end
|
441
293
|
|
442
|
-
# Create a Metric and associate it with a resource.
|
443
|
-
# @param [String] metric_type_path Canonical path of the metric type of the new metric.
|
444
|
-
# @param [String] resource_path Canonical path of the resource to which we want to associate the metric.
|
445
|
-
# @param [String] metric_id Id of the metric
|
446
|
-
# @param [String] metric_name a (display) name for the metric. If nil, #metric_id is used.
|
447
|
-
# @return [Metric] The metric created or if it already existed the version from the server
|
448
|
-
def create_metric_for_resource(metric_type_path, resource_path, metric_id, metric_name = nil)
|
449
|
-
type_path = metric_type_path.is_a?(CanonicalPath) ? metric_type_path : CanonicalPath.parse(metric_type_path)
|
450
|
-
feed_id = type_path.feed_id
|
451
|
-
res_path = resource_path.is_a?(CanonicalPath) ? resource_path : CanonicalPath.parse(resource_path)
|
452
|
-
res_path_str = 'r;' + res_path.resource_ids.join('/r;')
|
453
|
-
|
454
|
-
m = {}
|
455
|
-
m['id'] = metric_id
|
456
|
-
m['name'] = metric_name || metric_id
|
457
|
-
m['metricTypePath'] = type_path.to_s
|
458
|
-
|
459
|
-
begin
|
460
|
-
http_post("/entity/f;#{feed_id}/metric", m)
|
461
|
-
rescue HawkularException => error
|
462
|
-
# 409 We already exist -> that is ok
|
463
|
-
raise unless error.status_code == 409
|
464
|
-
end
|
465
|
-
|
466
|
-
ret = http_get("/entity/f;#{feed_id}/m;#{metric_id}")
|
467
|
-
the_metric = Metric.new(ret)
|
468
|
-
|
469
|
-
begin
|
470
|
-
rl = {}
|
471
|
-
rl['otherEnd'] = the_metric.path.to_s
|
472
|
-
rl['name'] = 'incorporates'
|
473
|
-
http_post("/entity/f;#{feed_id}/#{res_path_str}/relationship", [rl])
|
474
|
-
rescue HawkularException => error
|
475
|
-
# 409 We already exist -> that is ok
|
476
|
-
raise unless error.status_code == 409
|
477
|
-
end
|
478
|
-
the_metric
|
479
|
-
end
|
480
|
-
|
481
|
-
# Listen on inventory changes
|
482
|
-
# @param [String] type Type of entity for which we want the events.
|
483
|
-
# Allowed values: resource, metric, resourcetype, metrictype, feed, environment, operationtype, metadatapack
|
484
|
-
# @param [String] action What types of events are we interested in.
|
485
|
-
# Allowed values: created, updated, deleted, copied, registered
|
486
|
-
def events(type = 'resource', action = 'created')
|
487
|
-
tenant_id = get_tenant
|
488
|
-
|
489
|
-
base64_creds = ["#{@credentials[:username]}:#{@credentials[:password]}"].pack('m').delete("\r\n")
|
490
|
-
ws_options = {
|
491
|
-
headers: {
|
492
|
-
Authorization: 'Basic ' + base64_creds,
|
493
|
-
Accept: 'application/json'
|
494
|
-
}
|
495
|
-
}
|
496
|
-
ws_options[:headers][:'Hawkular-Tenant'] = tenant_id
|
497
|
-
|
498
|
-
url = normalize_entrypoint_url(@entrypoint, "ws/events?tenantId=#{tenant_id}&type=#{type}&action=#{action}")
|
499
|
-
url = url_with_websocket_scheme(url)
|
500
|
-
@ws = WebSocket::Client::Simple.connect url, ws_options do |client|
|
501
|
-
client.on :message do |msg|
|
502
|
-
parsed_message = JSON.parse(msg.data)
|
503
|
-
entity = case type
|
504
|
-
when 'resource'
|
505
|
-
Resource.new(parsed_message)
|
506
|
-
when 'resourcetype'
|
507
|
-
ResourceType.new(parsed_message)
|
508
|
-
when 'metric'
|
509
|
-
Metric.new(parsed_message)
|
510
|
-
when 'metrictype'
|
511
|
-
MetricType.new(parsed_message)
|
512
|
-
else
|
513
|
-
BaseEntity.new(parsed_message)
|
514
|
-
end
|
515
|
-
yield entity
|
516
|
-
end
|
517
|
-
end
|
518
|
-
end
|
519
|
-
|
520
|
-
# Stop listening on inventory events.
|
521
|
-
# this method closes the web socket connection
|
522
|
-
def no_more_events!
|
523
|
-
@ws.close
|
524
|
-
end
|
525
|
-
|
526
294
|
# Return version and status information for the used version of Hawkular-Inventory
|
527
295
|
# @return [Hash{String=>String}]
|
528
296
|
# ('Implementation-Version', 'Built-From-Git-SHA1', 'Status')
|
@@ -530,27 +298,11 @@ module Hawkular::Inventory
|
|
530
298
|
http_get('/status')
|
531
299
|
end
|
532
300
|
|
533
|
-
|
534
|
-
|
535
|
-
# Creates a hash with the fields required by the Blueprint api in Hawkular-Inventory
|
536
|
-
def create_blueprint
|
537
|
-
res = {}
|
538
|
-
res[:properties] = {}
|
539
|
-
res[:id] = nil
|
540
|
-
res[:name] = nil
|
541
|
-
res[:outgoing] = {}
|
542
|
-
res[:incoming] = {}
|
543
|
-
res
|
301
|
+
def feed_cp(feed_id)
|
302
|
+
CanonicalPath.new(tenant_id: @tenant, feed_id: hawk_escape_id(feed_id))
|
544
303
|
end
|
545
304
|
|
546
|
-
|
547
|
-
mt = {}
|
548
|
-
mt['id'] = metric_type_id
|
549
|
-
mt['type'] = metric_kind
|
550
|
-
mt['unit'] = unit.nil? ? 'NONE' : unit.upcase
|
551
|
-
mt['collectionInterval'] = collection_interval.nil? ? 60 : collection_interval
|
552
|
-
mt
|
553
|
-
end
|
305
|
+
private
|
554
306
|
|
555
307
|
def filter_entities(entities, filter)
|
556
308
|
entities.select do |entity|
|
@@ -564,8 +316,157 @@ module Hawkular::Inventory
|
|
564
316
|
found
|
565
317
|
end
|
566
318
|
end
|
567
|
-
end
|
568
319
|
|
569
|
-
|
570
|
-
|
320
|
+
def entity_json_to_hash(path_getter, json, fetch_properties)
|
321
|
+
data = json['data']
|
322
|
+
data['path'] = path_getter.call(data['id']).to_s
|
323
|
+
if fetch_properties
|
324
|
+
props = fetch_properties(json)
|
325
|
+
data['properties'].merge! props if props
|
326
|
+
end
|
327
|
+
data
|
328
|
+
end
|
329
|
+
|
330
|
+
def fetch_properties(json)
|
331
|
+
return unless (json.key? 'children') && (json['children'].key? 'dataEntity')
|
332
|
+
config = json['children']['dataEntity'].find { |d| d['data']['id'] == 'configuration' }
|
333
|
+
config['data']['value'] if config
|
334
|
+
end
|
335
|
+
|
336
|
+
def optype_json_to_hash(json)
|
337
|
+
data = json['data']
|
338
|
+
# Fetch parameterTypes
|
339
|
+
if (json.key? 'children') && (json['children'].key? 'dataEntity')
|
340
|
+
param_types = json['children']['dataEntity'].find { |d| d['data']['id'] == 'parameterTypes' }
|
341
|
+
data['parameters'] = param_types['data']['value'] if param_types
|
342
|
+
end
|
343
|
+
data
|
344
|
+
end
|
345
|
+
|
346
|
+
def get_raw_entity_hash(path)
|
347
|
+
c_path = CanonicalPath.parse_if_string(path)
|
348
|
+
raw = http_post(
|
349
|
+
'/strings/raw/query',
|
350
|
+
fromEarliest: true,
|
351
|
+
order: 'DESC',
|
352
|
+
tags: c_path.to_tags
|
353
|
+
)
|
354
|
+
structure = extract_structure_from_body(raw)
|
355
|
+
find_entity_in_tree(c_path, structure)
|
356
|
+
end
|
357
|
+
|
358
|
+
def find_entity_in_tree(fullpath, inventory_structure)
|
359
|
+
entity = inventory_structure
|
360
|
+
if fullpath.resource_ids
|
361
|
+
relative = fullpath.resource_ids.drop(1)
|
362
|
+
relative.each do |child|
|
363
|
+
if (entity.key? 'children') && (entity['children'].key? 'resource')
|
364
|
+
unescaped = URI.unescape(child)
|
365
|
+
entity = entity['children']['resource'].find { |r| r['data']['id'] == unescaped }
|
366
|
+
else
|
367
|
+
entity = nil
|
368
|
+
break
|
369
|
+
end
|
370
|
+
end
|
371
|
+
end
|
372
|
+
if fullpath.metric_id
|
373
|
+
if (entity.key? 'children') && (entity['children'].key? 'metric')
|
374
|
+
unescaped = URI.unescape(fullpath.metric_id)
|
375
|
+
entity = entity['children']['metric'].find { |r| r['data']['id'] == unescaped }
|
376
|
+
else
|
377
|
+
entity = nil
|
378
|
+
end
|
379
|
+
end
|
380
|
+
entity
|
381
|
+
end
|
382
|
+
|
383
|
+
def extract_child_resources(arr, path, parent_hash, recursive)
|
384
|
+
c_path = CanonicalPath.parse_if_string(path)
|
385
|
+
if (parent_hash.key? 'children') && (parent_hash['children'].key? 'resource')
|
386
|
+
parent_hash['children']['resource'].each do |r|
|
387
|
+
entity = entity_json_to_hash(-> (id) { c_path.down(id) }, r, false)
|
388
|
+
arr.push(Resource.new(entity))
|
389
|
+
extract_child_resources(arr, entity['path'], r, true) if recursive
|
390
|
+
end
|
391
|
+
end
|
392
|
+
arr
|
393
|
+
end
|
394
|
+
|
395
|
+
def extract_resources_for_type(structures, feed_path, resource_type_id, fetch_properties)
|
396
|
+
matching_resources = []
|
397
|
+
structures.each do |full_struct|
|
398
|
+
next unless full_struct.key? 'typesIndex'
|
399
|
+
next unless full_struct['typesIndex'].key? resource_type_id
|
400
|
+
inventory_structure = full_struct['inventoryStructure']
|
401
|
+
root_path = feed_path.down(inventory_structure['data']['id'])
|
402
|
+
full_struct['typesIndex'][resource_type_id].each do |relative_path|
|
403
|
+
if relative_path.empty?
|
404
|
+
# Root resource
|
405
|
+
resource = entity_json_to_hash(-> (id) { feed_path.down(id) }, inventory_structure, fetch_properties)
|
406
|
+
matching_resources.push(Resource.new(resource))
|
407
|
+
else
|
408
|
+
# Search for child
|
409
|
+
fullpath = CanonicalPath.parse("#{root_path}/#{relative_path}")
|
410
|
+
resource_json = find_entity_in_tree(fullpath, inventory_structure)
|
411
|
+
if resource_json
|
412
|
+
resource = entity_json_to_hash(-> (_) { fullpath }, resource_json, fetch_properties)
|
413
|
+
matching_resources.push(Resource.new(resource))
|
414
|
+
end
|
415
|
+
end
|
416
|
+
end
|
417
|
+
end
|
418
|
+
matching_resources
|
419
|
+
end
|
420
|
+
|
421
|
+
def extract_metrics_for_type(structures, feed_path, metric_type)
|
422
|
+
matching_metrics = []
|
423
|
+
structures.each do |full_struct|
|
424
|
+
next unless full_struct.key? 'metricTypesIndex'
|
425
|
+
next unless full_struct['metricTypesIndex'].key? metric_type.id
|
426
|
+
inventory_structure = full_struct['inventoryStructure']
|
427
|
+
root_path = feed_path.down(inventory_structure['data']['id'])
|
428
|
+
full_struct['metricTypesIndex'][metric_type.id].each do |relative_path|
|
429
|
+
# Search for child
|
430
|
+
fullpath = CanonicalPath.parse("#{root_path}/#{relative_path}")
|
431
|
+
metric_json = find_entity_in_tree(fullpath, inventory_structure)
|
432
|
+
if metric_json
|
433
|
+
metric_hash = entity_json_to_hash(-> (_) { fullpath }, metric_json, false)
|
434
|
+
matching_metrics.push(Metric.new(metric_hash, metric_type))
|
435
|
+
end
|
436
|
+
end
|
437
|
+
end
|
438
|
+
matching_metrics
|
439
|
+
end
|
440
|
+
|
441
|
+
def extract_structure_from_body(response_body_array)
|
442
|
+
# Expecting only 1 structure (but may have several chunks)
|
443
|
+
structures = extract_structures_from_body(response_body_array)
|
444
|
+
structures[0]['inventoryStructure'] unless structures.empty?
|
445
|
+
end
|
446
|
+
|
447
|
+
def extract_structures_from_body(response_body_array)
|
448
|
+
response_body_array.map { |element| rebuild_from_chunks(element['data']) }
|
449
|
+
.select { |full| full } # evict nil
|
450
|
+
.map { |full| decompress(full) }
|
451
|
+
end
|
452
|
+
|
453
|
+
def rebuild_from_chunks(data_node)
|
454
|
+
return if data_node.empty?
|
455
|
+
master_data = data_node[0]
|
456
|
+
return Base64.decode64(master_data['value']) unless (master_data.key? 'tags') &&
|
457
|
+
(master_data['tags'].key? 'chunks')
|
458
|
+
last_chunk = master_data['tags']['chunks'].to_i - 1
|
459
|
+
all = Base64.decode64(master_data['value'])
|
460
|
+
return if all.empty?
|
461
|
+
(1..last_chunk).inject(all) do |full, chunk_id|
|
462
|
+
slave_data = data_node[chunk_id]
|
463
|
+
full.concat(Base64.decode64(slave_data['value']))
|
464
|
+
end
|
465
|
+
end
|
466
|
+
|
467
|
+
def decompress(raw)
|
468
|
+
gz = Zlib::GzipReader.new(StringIO.new(raw))
|
469
|
+
JSON.parse(gz.read)
|
470
|
+
end
|
471
|
+
end
|
571
472
|
end
|