topological_inventory-providers-common 1.0.10 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) 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 -3
  6. data/lib/topological_inventory/providers/common.rb +1 -2
  7. data/lib/topological_inventory/providers/common/collectors_pool.rb +2 -1
  8. data/lib/topological_inventory/providers/common/logging.rb +6 -3
  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/processor.rb +46 -104
  17. data/lib/topological_inventory/providers/common/operations/source.rb +183 -144
  18. data/lib/topological_inventory/providers/common/sources_api_client.rb +92 -0
  19. data/lib/topological_inventory/providers/common/topology_api_client.rb +43 -0
  20. data/lib/topological_inventory/providers/common/version.rb +1 -1
  21. data/spec/support/shared/availability_check.rb +254 -90
  22. data/spec/topological_inventory/providers/common/operations/async_worker_spec.rb +36 -0
  23. data/spec/topological_inventory/providers/common/operations/processor_spec.rb +52 -83
  24. data/topological_inventory-providers-common.gemspec +14 -10
  25. metadata +74 -9
  26. data/lib/topological_inventory/providers/common/operations/endpoint_client.rb +0 -65
  27. data/lib/topological_inventory/providers/common/operations/sources_api_client.rb +0 -94
  28. 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