topological_inventory-providers-common 1.0.9 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +31 -0
  3. data/.rubocop.yml +1 -1
  4. data/.yamllint +8 -0
  5. data/CHANGELOG.md +25 -2
  6. data/lib/topological_inventory/providers/common.rb +2 -2
  7. data/lib/topological_inventory/providers/common/collectors_pool.rb +2 -1
  8. data/lib/topological_inventory/providers/common/logging.rb +10 -4
  9. data/lib/topological_inventory/providers/common/messaging_client.rb +40 -0
  10. data/lib/topological_inventory/providers/common/metrics.rb +84 -0
  11. data/lib/topological_inventory/providers/common/mixins/sources_api.rb +61 -0
  12. data/lib/topological_inventory/providers/common/mixins/statuses.rb +19 -0
  13. data/lib/topological_inventory/providers/common/mixins/topology_api.rb +26 -0
  14. data/lib/topological_inventory/providers/common/mixins/x_rh_headers.rb +24 -0
  15. data/lib/topological_inventory/providers/common/operations/async_worker.rb +56 -0
  16. data/lib/topological_inventory/providers/common/operations/health_check.rb +15 -0
  17. data/lib/topological_inventory/providers/common/operations/processor.rb +46 -104
  18. data/lib/topological_inventory/providers/common/operations/source.rb +183 -144
  19. data/lib/topological_inventory/providers/common/sources_api_client.rb +92 -0
  20. data/lib/topological_inventory/providers/common/topology_api_client.rb +43 -0
  21. data/lib/topological_inventory/providers/common/version.rb +1 -1
  22. data/spec/support/shared/availability_check.rb +254 -90
  23. data/spec/topological_inventory/providers/common/operations/async_worker_spec.rb +36 -0
  24. data/spec/topological_inventory/providers/common/operations/processor_spec.rb +52 -83
  25. data/topological_inventory-providers-common.gemspec +14 -10
  26. metadata +75 -9
  27. data/lib/topological_inventory/providers/common/operations/endpoint_client.rb +0 -65
  28. data/lib/topological_inventory/providers/common/operations/sources_api_client.rb +0 -94
  29. data/lib/topological_inventory/providers/common/operations/topology_api_client.rb +0 -28
@@ -1,28 +0,0 @@
1
- module TopologicalInventory
2
- module Providers
3
- module Common
4
- module Operations
5
- module TopologyApiClient
6
- def topology_api_client
7
- @topology_api_client ||=
8
- begin
9
- api_client = TopologicalInventoryApiClient::ApiClient.new
10
- api_client.default_headers.merge!(identity) if identity.present?
11
- TopologicalInventoryApiClient::DefaultApi.new(api_client)
12
- end
13
- end
14
-
15
- def update_task(task_id, state:, status:, context:)
16
- task = TopologicalInventoryApiClient::Task.new("state" => state, "status" => status, "context" => context)
17
- topology_api_client.update_task(task_id, task)
18
- end
19
-
20
- def svc_instance_url(service_instance)
21
- rest_api_path = '/service_instances/{id}'.sub('{' + 'id' + '}', service_instance&.id.to_s)
22
- topology_api_client.api_client.build_request(:GET, rest_api_path).url
23
- end
24
- end
25
- end
26
- end
27
- end
28
- end