lex-dynatrace 0.1.0 → 0.2.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/.github/dependabot.yml +12 -0
  3. data/CHANGELOG.md +25 -2
  4. data/CODEOWNERS +1 -0
  5. data/LICENSE +21 -0
  6. data/README.md +41 -6
  7. data/lib/legion/extensions/dynatrace/active_gates/runners/active_gates.rb +30 -0
  8. data/lib/legion/extensions/dynatrace/client.rb +75 -0
  9. data/lib/legion/extensions/dynatrace/davis/client.rb +17 -0
  10. data/lib/legion/extensions/dynatrace/davis/runners/davis.rb +19 -0
  11. data/lib/legion/extensions/dynatrace/davis.rb +13 -0
  12. data/lib/legion/extensions/dynatrace/documents/runners/documents.rb +43 -0
  13. data/lib/legion/extensions/dynatrace/documents.rb +17 -0
  14. data/lib/legion/extensions/dynatrace/dql/runners/dql.rb +25 -0
  15. data/lib/legion/extensions/dynatrace/dql.rb +17 -0
  16. data/lib/legion/extensions/dynatrace/entities/runners/entities.rb +5 -0
  17. data/lib/legion/extensions/dynatrace/helpers/paginator.rb +27 -0
  18. data/lib/legion/extensions/dynatrace/hub/runners/hub.rb +26 -0
  19. data/lib/legion/extensions/dynatrace/hub.rb +17 -0
  20. data/lib/legion/extensions/dynatrace/oneagents/client.rb +17 -0
  21. data/lib/legion/extensions/dynatrace/oneagents/runners/oneagents.rb +30 -0
  22. data/lib/legion/extensions/dynatrace/oneagents.rb +13 -0
  23. data/lib/legion/extensions/dynatrace/open_pipeline/runners/open_pipeline.rb +28 -0
  24. data/lib/legion/extensions/dynatrace/open_pipeline.rb +17 -0
  25. data/lib/legion/extensions/dynatrace/synthetic/runners/monitors.rb +5 -0
  26. data/lib/legion/extensions/dynatrace/tokens/runners/tokens.rb +5 -0
  27. data/lib/legion/extensions/dynatrace/version.rb +1 -1
  28. data/lib/legion/extensions/dynatrace.rb +8 -0
  29. metadata +20 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce656ccaf788e435189fc8eb6c7fb12e948cca86e689624e7d26877c8c5cdd6a
4
- data.tar.gz: 842b834a51a6e0eb79c1797a7d20e741a773f39660d1d6fe2256ee8c421ce073
3
+ metadata.gz: b303113698a77c9f3528ffd4a5fa98ecdb807fe6eb7c14c74a4e025bc44b8dd8
4
+ data.tar.gz: b837198ac9ef345ac3592e5f60c21cda5afaa97c60e0bdeccab3accecf74eaf3
5
5
  SHA512:
6
- metadata.gz: 52dfafa4209ea9c3a6297e33567a51afdad9007c3227c162fb31582838c96400249241d926a339379abef63ffc28f14cc47bc95d6ab1ee343819485207045c66
7
- data.tar.gz: 1f42b39b83e1d41cbb192c45a009ce0a687a0ee0181ed90509d8374cc4e63665c8bd57d0d60d3e7e2bcb1727fe5a3577a49954132c21c0ef8620dd218efa87b0
6
+ metadata.gz: 00374f1c72754647e3e99b75b40cd73bf5db3aea499dbf4f8fa02e508eaf133ad9b348d96cb2756d99bd0f743c41dd7402e3ced29d56b95dde660f1f7a0b4e6c
7
+ data.tar.gz: 28c2106f5a55f244a3d1701a08cee0aae62290da953ce689e70b2e74ed53ed9e4cee44cdbc2afb3c04462e7da355383b2322a031e3bba31cc02fe079fca10548
@@ -0,0 +1,12 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: /
5
+ schedule:
6
+ interval: weekly
7
+ open-pull-requests-limit: 5
8
+ - package-ecosystem: github-actions
9
+ directory: /
10
+ schedule:
11
+ interval: weekly
12
+ open-pull-requests-limit: 5
data/CHANGELOG.md CHANGED
@@ -1,9 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.0] - 2026-03-27
4
+
5
+ ### Added
6
+ - Hub: list/get hub items (`/api/v2/hub/items`)
7
+ - OpenPipeline: list/get/update pipeline configurations (`/api/v2/openpipeline/configurations`)
8
+ - Documents: CRUD for Grail documents (`/api/v2/documents`)
9
+ - DQL: execute Dynatrace Query Language queries (`/platform/storage/query/v1/query:execute`)
10
+ - ActiveGates: update jobs (list/get/create/delete), auto-update config (get/update)
11
+ - Entities: push custom device
12
+ - Synthetic: trigger on-demand execution
13
+ - Tokens: get tenant token metadata
14
+ - 28 sub-modules, 113 specs
15
+
3
16
  ## [0.1.0] - 2026-03-27
4
17
 
5
18
  ### Added
6
- - Initial release with 16 sub-modules covering Dynatrace Environment API v2
19
+ - Initial release with 24 sub-modules covering Dynatrace Environment API v2
7
20
  - Metrics: list descriptors, get descriptor, query data points, ingest custom metrics
8
21
  - Entities: list/get entities, list/get entity types
9
22
  - Problems: list/get/close problems, list/create comments
@@ -20,5 +33,15 @@
20
33
  - Tags: get/add/delete entity tags
21
34
  - API Tokens: CRUD, lookup
22
35
  - Releases: list/get release information
36
+ - Attacks: list/get detected attacks
37
+ - Business Events: ingest single and batch CloudEvents
38
+ - Credentials: credential vault CRUD
39
+ - Deployment: agent installer metadata, connection info, versions
40
+ - Units: list/get/convert measurement units
41
+ - Geographic Regions: IP detection headers, address mappings
42
+ - OneAgents: list OneAgent instances with filtering
43
+ - Davis: AI root cause analysis (evidence, impact, root cause entity)
44
+ - Unified top-level Client including all runners + pagination helper
23
45
  - Standalone Client class per sub-module (lex-cloudflare multi-module pattern)
24
- - 66 specs with WebMock stubs
46
+ - Shared CI/release workflow via LegionIO/.github
47
+ - 93 specs with WebMock stubs
data/CODEOWNERS ADDED
@@ -0,0 +1 @@
1
+ * @Esity
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 LegionIO
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # lex-dynatrace
2
2
 
3
- Legion Extension for the [Dynatrace Environment API v2](https://docs.dynatrace.com/docs/dynatrace-api/environment-api). Multi-module monolith covering 16 API areas with standalone clients.
3
+ Legion Extension for the [Dynatrace Environment API v2](https://docs.dynatrace.com/docs/dynatrace-api/environment-api). Multi-module monolith covering 28 API areas with standalone clients.
4
4
 
5
5
  ## Installation
6
6
 
@@ -50,21 +50,56 @@ entities.get_entity(entity_id: 'HOST-ABC123')
50
50
  | Module | API Path | Methods |
51
51
  |--------|----------|---------|
52
52
  | **Metrics** | `/api/v2/metrics` | `list_descriptors`, `get_descriptor`, `query`, `ingest` |
53
- | **Entities** | `/api/v2/entities` | `list_entities`, `get_entity`, `list_entity_types`, `get_entity_type` |
53
+ | **Entities** | `/api/v2/entities` | `list_entities`, `get_entity`, `list_entity_types`, `get_entity_type`, `push_custom_device` |
54
54
  | **Problems** | `/api/v2/problems` | `list_problems`, `get_problem`, `close_problem`, `list_comments`, `create_comment` |
55
55
  | **Events** | `/api/v2/events` | `list_events`, `get_event`, `ingest_event` |
56
56
  | **Logs** | `/api/v2/logs` | `search_logs`, `aggregate_logs` |
57
57
  | **AuditLogs** | `/api/v2/auditlogs` | `list_audit_logs`, `get_audit_log` |
58
- | **ActiveGates** | `/api/v2/activeGates` | `list_active_gates`, `get_active_gate` |
58
+ | **ActiveGates** | `/api/v2/activeGates` | `list_active_gates`, `get_active_gate`, `list_update_jobs`, `get_update_job`, `create_update_job`, `delete_update_job`, `get_auto_update_config`, `update_auto_update_config` |
59
59
  | **Extensions20** | `/api/v2/extensions` | `list_extensions`, `get_extension`, `delete_extension`, `get_extension_version`, `delete_extension_version`, `get_environment_config`, `update_environment_config`, `delete_environment_config`, `list_monitoring_configs`, `get_monitoring_config`, `create_monitoring_config`, `update_monitoring_config`, `delete_monitoring_config` |
60
60
  | **Slos** | `/api/v2/slo` | `list_slos`, `get_slo`, `create_slo`, `update_slo`, `delete_slo` |
61
- | **Synthetic** | `/api/v2/synthetic` | `list_monitors`, `get_monitor`, `create_monitor`, `update_monitor`, `delete_monitor`, `get_execution`, `list_locations`, `get_location` |
61
+ | **Synthetic** | `/api/v2/synthetic` | `list_monitors`, `get_monitor`, `create_monitor`, `update_monitor`, `delete_monitor`, `get_execution`, `trigger_on_demand`, `list_locations`, `get_location` |
62
62
  | **SecurityProblems** | `/api/v2/securityProblems` | `list_security_problems`, `get_security_problem`, `mute_security_problem`, `unmute_security_problem`, `list_remediations` |
63
63
  | **SettingsObjects** | `/api/v2/settings` | `list_objects`, `get_object`, `create_objects`, `update_object`, `delete_object`, `list_schemas`, `get_schema` |
64
64
  | **NetworkZones** | `/api/v2/networkZones` | `list_network_zones`, `get_network_zone`, `create_network_zone`, `update_network_zone`, `delete_network_zone` |
65
65
  | **Tags** | `/api/v2/tags` | `get_tags`, `add_tags`, `delete_tag` |
66
- | **Tokens** | `/api/v2/apiTokens` | `list_tokens`, `get_token`, `create_token`, `update_token`, `delete_token`, `lookup_token` |
66
+ | **Tokens** | `/api/v2/apiTokens` | `list_tokens`, `get_token`, `create_token`, `update_token`, `delete_token`, `lookup_token`, `get_tenant_token` |
67
67
  | **Releases** | `/api/v2/releases` | `list_releases`, `get_release` |
68
+ | **Attacks** | `/api/v2/attacks` | `list_attacks`, `get_attack` |
69
+ | **BusinessEvents** | `/api/v2/bizevents` | `ingest_business_event`, `ingest_business_events_batch` |
70
+ | **Credentials** | `/api/v2/credentials` | `list_credentials`, `get_credential`, `create_credential`, `update_credential`, `delete_credential` |
71
+ | **Deployment** | `/api/v2/deployment` | `get_agent_installer_metadata`, `get_agent_installer_connection_info`, `get_agent_versions`, `get_activegate_installer_connection_info` |
72
+ | **Units** | `/api/v2/units` | `list_units`, `get_unit`, `convert_units` |
73
+ | **GeographicRegions** | `/api/v2/rum/geographicRegions` | `list_regions`, `list_ip_address_mappings` |
74
+ | **Oneagents** | `/api/v2/oneagents` | `list_oneagents` |
75
+ | **Davis** | `/api/v2/problems` | `get_davis_analysis` (evidence, impact, root cause) |
76
+ | **Hub** | `/api/v2/hub/items` | `list_hub_items`, `get_hub_item` |
77
+ | **OpenPipeline** | `/api/v2/openpipeline/configurations` | `list_pipelines`, `get_pipeline`, `update_pipeline` |
78
+ | **Documents** | `/api/v2/documents` | `list_documents`, `get_document`, `create_document`, `update_document`, `delete_document` |
79
+ | **DQL** | `/platform/storage/query/v1/query:execute` | `execute_query` |
80
+
81
+ ### Unified Client
82
+
83
+ Use `Legion::Extensions::Dynatrace::Client` to access all runners from a single instance:
84
+
85
+ ```ruby
86
+ dt = Legion::Extensions::Dynatrace::Client.new(
87
+ environment_url: 'https://abc12345.live.dynatrace.com',
88
+ api_token: 'dt0c01.xxxx'
89
+ )
90
+ dt.list_problems(from: 'now-1h')
91
+ dt.query(metric_selector: 'builtin:host.cpu.usage')
92
+ dt.list_entities(entity_selector: 'type(SERVICE)')
93
+ ```
94
+
95
+ ### Pagination Helper
96
+
97
+ The unified client includes a `paginate` helper for auto-paging:
98
+
99
+ ```ruby
100
+ all_entities = dt.paginate(:list_entities, result_key: 'entities',
101
+ entity_selector: 'type(HOST)')
102
+ ```
68
103
 
69
104
  ## Legion Settings
70
105
 
@@ -83,7 +118,7 @@ When running inside the Legion framework, credentials resolve from settings:
83
118
 
84
119
  ```bash
85
120
  bundle install
86
- bundle exec rspec # 66 specs
121
+ bundle exec rspec # 113 specs
87
122
  bundle exec rubocop # 0 offenses
88
123
  ```
89
124
 
@@ -27,6 +27,36 @@ module Legion
27
27
  conn = opts[:connection] || connection(**opts)
28
28
  conn.get("api/v2/activeGates/#{ag_id}").body
29
29
  end
30
+
31
+ def list_update_jobs(ag_id:, **opts)
32
+ conn = opts[:connection] || connection(**opts)
33
+ conn.get("api/v2/activeGates/#{ag_id}/updateJobs").body
34
+ end
35
+
36
+ def get_update_job(ag_id:, job_id:, **opts)
37
+ conn = opts[:connection] || connection(**opts)
38
+ conn.get("api/v2/activeGates/#{ag_id}/updateJobs/#{job_id}").body
39
+ end
40
+
41
+ def create_update_job(ag_id:, job:, **opts)
42
+ conn = opts[:connection] || connection(**opts)
43
+ conn.post("api/v2/activeGates/#{ag_id}/updateJobs", job).body
44
+ end
45
+
46
+ def delete_update_job(ag_id:, job_id:, **opts)
47
+ conn = opts[:connection] || connection(**opts)
48
+ conn.delete("api/v2/activeGates/#{ag_id}/updateJobs/#{job_id}").body
49
+ end
50
+
51
+ def get_auto_update_config(**opts)
52
+ conn = opts[:connection] || connection(**opts)
53
+ conn.get('api/v2/activeGates/autoUpdate').body
54
+ end
55
+
56
+ def update_auto_update_config(config:, **opts)
57
+ conn = opts[:connection] || connection(**opts)
58
+ conn.put('api/v2/activeGates/autoUpdate', config).body
59
+ end
30
60
  end
31
61
  end
32
62
  end
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'helpers/client'
4
+ require_relative 'base_client'
5
+ require_relative 'metrics/runners/metrics'
6
+ require_relative 'entities/runners/entities'
7
+ require_relative 'problems/runners/problems'
8
+ require_relative 'events/runners/events'
9
+ require_relative 'logs/runners/logs'
10
+ require_relative 'audit_logs/runners/audit_logs'
11
+ require_relative 'active_gates/runners/active_gates'
12
+ require_relative 'extensions20/runners/extensions'
13
+ require_relative 'slos/runners/slos'
14
+ require_relative 'synthetic/runners/monitors'
15
+ require_relative 'synthetic/runners/locations'
16
+ require_relative 'security_problems/runners/security_problems'
17
+ require_relative 'settings_objects/runners/objects'
18
+ require_relative 'settings_objects/runners/schemas'
19
+ require_relative 'network_zones/runners/network_zones'
20
+ require_relative 'tags/runners/tags'
21
+ require_relative 'tokens/runners/tokens'
22
+ require_relative 'releases/runners/releases'
23
+ require_relative 'attacks/runners/attacks'
24
+ require_relative 'business_events/runners/business_events'
25
+ require_relative 'credentials/runners/credentials'
26
+ require_relative 'deployment/runners/deployment'
27
+ require_relative 'units/runners/units'
28
+ require_relative 'geographic_regions/runners/geographic_regions'
29
+ require_relative 'oneagents/runners/oneagents'
30
+ require_relative 'davis/runners/davis'
31
+ require_relative 'hub/runners/hub'
32
+ require_relative 'open_pipeline/runners/open_pipeline'
33
+ require_relative 'documents/runners/documents'
34
+ require_relative 'dql/runners/dql'
35
+ require_relative 'helpers/paginator'
36
+
37
+ module Legion
38
+ module Extensions
39
+ module Dynatrace
40
+ class Client < BaseClient
41
+ include Helpers::Paginator
42
+ include Metrics::Runners::Metrics
43
+ include Entities::Runners::Entities
44
+ include Problems::Runners::Problems
45
+ include Events::Runners::Events
46
+ include Logs::Runners::Logs
47
+ include AuditLogs::Runners::AuditLogs
48
+ include ActiveGates::Runners::ActiveGates
49
+ include Extensions20::Runners::Extensions
50
+ include Slos::Runners::Slos
51
+ include Synthetic::Runners::Monitors
52
+ include Synthetic::Runners::Locations
53
+ include SecurityProblems::Runners::SecurityProblems
54
+ include SettingsObjects::Runners::Objects
55
+ include SettingsObjects::Runners::Schemas
56
+ include NetworkZones::Runners::NetworkZones
57
+ include Tags::Runners::Tags
58
+ include Tokens::Runners::Tokens
59
+ include Releases::Runners::Releases
60
+ include Attacks::Runners::Attacks
61
+ include BusinessEvents::Runners::BusinessEvents
62
+ include Credentials::Runners::Credentials
63
+ include Deployment::Runners::Deployment
64
+ include Units::Runners::Units
65
+ include GeographicRegions::Runners::GeographicRegions
66
+ include Oneagents::Runners::Oneagents
67
+ include Davis::Runners::Davis
68
+ include Hub::Runners::Hub
69
+ include OpenPipeline::Runners::OpenPipeline
70
+ include Documents::Runners::Documents
71
+ include Dql::Runners::Dql
72
+ end
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../helpers/client'
4
+ require_relative '../base_client'
5
+ require_relative 'runners/davis'
6
+
7
+ module Legion
8
+ module Extensions
9
+ module Dynatrace
10
+ module Davis
11
+ class Client < Legion::Extensions::Dynatrace::BaseClient
12
+ include Runners::Davis
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Legion
4
+ module Extensions
5
+ module Dynatrace
6
+ module Davis
7
+ module Runners
8
+ module Davis
9
+ def get_davis_analysis(problem_id:, **opts)
10
+ conn = opts[:connection] || connection(**opts)
11
+ conn.get("api/v2/problems/#{problem_id}",
12
+ fields: '+evidenceDetails,+impactAnalysis,+rootCauseEntity').body
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'davis/runners/davis'
4
+ require_relative 'davis/client'
5
+
6
+ module Legion
7
+ module Extensions
8
+ module Dynatrace
9
+ module Davis
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Legion
4
+ module Extensions
5
+ module Dynatrace
6
+ module Documents
7
+ module Runners
8
+ module Documents
9
+ def list_documents(filter: nil, sort: nil, page_size: nil, next_page_key: nil, **opts)
10
+ conn = opts[:connection] || connection(**opts)
11
+ params = {}
12
+ params[:filter] = filter if filter
13
+ params[:sort] = sort if sort
14
+ params[:pageSize] = page_size if page_size
15
+ params[:nextPageKey] = next_page_key if next_page_key
16
+ conn.get('api/v2/documents', params).body
17
+ end
18
+
19
+ def get_document(document_id:, **opts)
20
+ conn = opts[:connection] || connection(**opts)
21
+ conn.get("api/v2/documents/#{document_id}").body
22
+ end
23
+
24
+ def create_document(document:, **opts)
25
+ conn = opts[:connection] || connection(**opts)
26
+ conn.post('api/v2/documents', document).body
27
+ end
28
+
29
+ def update_document(document_id:, document:, **opts)
30
+ conn = opts[:connection] || connection(**opts)
31
+ conn.put("api/v2/documents/#{document_id}", document).body
32
+ end
33
+
34
+ def delete_document(document_id:, **opts)
35
+ conn = opts[:connection] || connection(**opts)
36
+ conn.delete("api/v2/documents/#{document_id}").body
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'documents/runners/documents'
4
+ require_relative 'helpers/client'
5
+ require_relative 'base_client'
6
+
7
+ module Legion
8
+ module Extensions
9
+ module Dynatrace
10
+ module Documents
11
+ class Client < BaseClient
12
+ include Runners::Documents
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Legion
4
+ module Extensions
5
+ module Dynatrace
6
+ module Dql
7
+ module Runners
8
+ module Dql
9
+ def execute_query(query:, default_timeframe_start: nil, default_timeframe_end: nil,
10
+ timezone: nil, locale: nil, max_result_records: nil, **opts)
11
+ conn = opts[:connection] || connection(**opts)
12
+ payload = { query: query }
13
+ payload[:defaultTimeframeStart] = default_timeframe_start if default_timeframe_start
14
+ payload[:defaultTimeframeEnd] = default_timeframe_end if default_timeframe_end
15
+ payload[:timezone] = timezone if timezone
16
+ payload[:locale] = locale if locale
17
+ payload[:maxResultRecords] = max_result_records if max_result_records
18
+ conn.post('platform/storage/query/v1/query:execute', payload).body
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'dql/runners/dql'
4
+ require_relative 'helpers/client'
5
+ require_relative 'base_client'
6
+
7
+ module Legion
8
+ module Extensions
9
+ module Dynatrace
10
+ module Dql
11
+ class Client < BaseClient
12
+ include Runners::Dql
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -40,6 +40,11 @@ module Legion
40
40
  conn = opts[:connection] || connection(**opts)
41
41
  conn.get("api/v2/entityTypes/#{type}").body
42
42
  end
43
+
44
+ def push_custom_device(body:, **opts)
45
+ conn = opts[:connection] || connection(**opts)
46
+ conn.post('api/v2/entities/custom', body).body
47
+ end
43
48
  end
44
49
  end
45
50
  end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Legion
4
+ module Extensions
5
+ module Dynatrace
6
+ module Helpers
7
+ module Paginator
8
+ def paginate(method_name, result_key:, **params)
9
+ all_results = []
10
+ next_page_key = nil
11
+
12
+ loop do
13
+ params[:next_page_key] = next_page_key if next_page_key
14
+ response = send(method_name, **params)
15
+ items = response[result_key]
16
+ all_results.concat(items) if items.is_a?(Array)
17
+ next_page_key = response['nextPageKey']
18
+ break if next_page_key.nil? || next_page_key.empty?
19
+ end
20
+
21
+ all_results
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Legion
4
+ module Extensions
5
+ module Dynatrace
6
+ module Hub
7
+ module Runners
8
+ module Hub
9
+ def list_hub_items(page_size: nil, next_page_key: nil, **opts)
10
+ conn = opts[:connection] || connection(**opts)
11
+ params = {}
12
+ params[:pageSize] = page_size if page_size
13
+ params[:nextPageKey] = next_page_key if next_page_key
14
+ conn.get('api/v2/hub/items', params).body
15
+ end
16
+
17
+ def get_hub_item(item_id:, **opts)
18
+ conn = opts[:connection] || connection(**opts)
19
+ conn.get("api/v2/hub/items/#{item_id}").body
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'hub/runners/hub'
4
+ require_relative 'helpers/client'
5
+ require_relative 'base_client'
6
+
7
+ module Legion
8
+ module Extensions
9
+ module Dynatrace
10
+ module Hub
11
+ class Client < BaseClient
12
+ include Runners::Hub
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../helpers/client'
4
+ require_relative '../base_client'
5
+ require_relative 'runners/oneagents'
6
+
7
+ module Legion
8
+ module Extensions
9
+ module Dynatrace
10
+ module Oneagents
11
+ class Client < Legion::Extensions::Dynatrace::BaseClient
12
+ include Runners::Oneagents
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Legion
4
+ module Extensions
5
+ module Dynatrace
6
+ module Oneagents
7
+ module Runners
8
+ module Oneagents
9
+ def list_oneagents(host_id: nil, os_type: nil, auto_update_setting: nil,
10
+ update_status: nil, version_compare_type: nil, version: nil,
11
+ availability_state: nil, page_size: nil, next_page_key: nil, **opts)
12
+ conn = opts[:connection] || connection(**opts)
13
+ params = {}
14
+ params[:hostId] = host_id if host_id
15
+ params[:osType] = os_type if os_type
16
+ params[:autoUpdateSetting] = auto_update_setting if auto_update_setting
17
+ params[:updateStatus] = update_status if update_status
18
+ params[:versionCompareType] = version_compare_type if version_compare_type
19
+ params[:version] = version if version
20
+ params[:availabilityState] = availability_state if availability_state
21
+ params[:pageSize] = page_size if page_size
22
+ params[:nextPageKey] = next_page_key if next_page_key
23
+ conn.get('api/v2/oneagents', params).body
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'oneagents/runners/oneagents'
4
+ require_relative 'oneagents/client'
5
+
6
+ module Legion
7
+ module Extensions
8
+ module Dynatrace
9
+ module Oneagents
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Legion
4
+ module Extensions
5
+ module Dynatrace
6
+ module OpenPipeline
7
+ module Runners
8
+ module OpenPipeline
9
+ def list_pipelines(**opts)
10
+ conn = opts[:connection] || connection(**opts)
11
+ conn.get('api/v2/openpipeline/configurations').body
12
+ end
13
+
14
+ def get_pipeline(pipeline_id:, **opts)
15
+ conn = opts[:connection] || connection(**opts)
16
+ conn.get("api/v2/openpipeline/configurations/#{pipeline_id}").body
17
+ end
18
+
19
+ def update_pipeline(pipeline_id:, config:, **opts)
20
+ conn = opts[:connection] || connection(**opts)
21
+ conn.put("api/v2/openpipeline/configurations/#{pipeline_id}", config).body
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'open_pipeline/runners/open_pipeline'
4
+ require_relative 'helpers/client'
5
+ require_relative 'base_client'
6
+
7
+ module Legion
8
+ module Extensions
9
+ module Dynatrace
10
+ module OpenPipeline
11
+ class Client < BaseClient
12
+ include Runners::OpenPipeline
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -38,6 +38,11 @@ module Legion
38
38
  conn = opts[:connection] || connection(**opts)
39
39
  conn.get("api/v2/synthetic/executions/#{execution_id}/fullReport").body
40
40
  end
41
+
42
+ def trigger_on_demand(body:, **opts)
43
+ conn = opts[:connection] || connection(**opts)
44
+ conn.post('api/v2/synthetic/executions', body).body
45
+ end
41
46
  end
42
47
  end
43
48
  end
@@ -46,6 +46,11 @@ module Legion
46
46
  conn = opts[:connection] || connection(**opts)
47
47
  conn.post('api/v2/apiTokens/lookup', { token: token }).body
48
48
  end
49
+
50
+ def get_tenant_token(**opts)
51
+ conn = opts[:connection] || connection(**opts)
52
+ conn.get('api/v2/apiTokens/tenantToken').body
53
+ end
49
54
  end
50
55
  end
51
56
  end
@@ -3,7 +3,7 @@
3
3
  module Legion
4
4
  module Extensions
5
5
  module Dynatrace
6
- VERSION = '0.1.0'
6
+ VERSION = '0.2.0'
7
7
  end
8
8
  end
9
9
  end
@@ -25,6 +25,14 @@ require_relative 'dynatrace/credentials'
25
25
  require_relative 'dynatrace/deployment'
26
26
  require_relative 'dynatrace/units'
27
27
  require_relative 'dynatrace/geographic_regions'
28
+ require_relative 'dynatrace/oneagents'
29
+ require_relative 'dynatrace/davis'
30
+ require_relative 'dynatrace/hub'
31
+ require_relative 'dynatrace/open_pipeline'
32
+ require_relative 'dynatrace/documents'
33
+ require_relative 'dynatrace/dql'
34
+ require_relative 'dynatrace/helpers/paginator'
35
+ require_relative 'dynatrace/client'
28
36
 
29
37
  module Legion
30
38
  module Extensions
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lex-dynatrace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity
@@ -128,10 +128,13 @@ executables: []
128
128
  extensions: []
129
129
  extra_rdoc_files: []
130
130
  files:
131
+ - ".github/dependabot.yml"
131
132
  - ".github/workflows/ci.yml"
132
133
  - ".rubocop.yml"
133
134
  - CHANGELOG.md
135
+ - CODEOWNERS
134
136
  - Gemfile
137
+ - LICENSE
135
138
  - README.md
136
139
  - lex-dynatrace.gemspec
137
140
  - lib/legion/extensions/dynatrace.rb
@@ -148,12 +151,20 @@ files:
148
151
  - lib/legion/extensions/dynatrace/business_events.rb
149
152
  - lib/legion/extensions/dynatrace/business_events/client.rb
150
153
  - lib/legion/extensions/dynatrace/business_events/runners/business_events.rb
154
+ - lib/legion/extensions/dynatrace/client.rb
151
155
  - lib/legion/extensions/dynatrace/credentials.rb
152
156
  - lib/legion/extensions/dynatrace/credentials/client.rb
153
157
  - lib/legion/extensions/dynatrace/credentials/runners/credentials.rb
158
+ - lib/legion/extensions/dynatrace/davis.rb
159
+ - lib/legion/extensions/dynatrace/davis/client.rb
160
+ - lib/legion/extensions/dynatrace/davis/runners/davis.rb
154
161
  - lib/legion/extensions/dynatrace/deployment.rb
155
162
  - lib/legion/extensions/dynatrace/deployment/client.rb
156
163
  - lib/legion/extensions/dynatrace/deployment/runners/deployment.rb
164
+ - lib/legion/extensions/dynatrace/documents.rb
165
+ - lib/legion/extensions/dynatrace/documents/runners/documents.rb
166
+ - lib/legion/extensions/dynatrace/dql.rb
167
+ - lib/legion/extensions/dynatrace/dql/runners/dql.rb
157
168
  - lib/legion/extensions/dynatrace/entities.rb
158
169
  - lib/legion/extensions/dynatrace/entities/client.rb
159
170
  - lib/legion/extensions/dynatrace/entities/runners/entities.rb
@@ -167,6 +178,9 @@ files:
167
178
  - lib/legion/extensions/dynatrace/geographic_regions/client.rb
168
179
  - lib/legion/extensions/dynatrace/geographic_regions/runners/geographic_regions.rb
169
180
  - lib/legion/extensions/dynatrace/helpers/client.rb
181
+ - lib/legion/extensions/dynatrace/helpers/paginator.rb
182
+ - lib/legion/extensions/dynatrace/hub.rb
183
+ - lib/legion/extensions/dynatrace/hub/runners/hub.rb
170
184
  - lib/legion/extensions/dynatrace/logs.rb
171
185
  - lib/legion/extensions/dynatrace/logs/client.rb
172
186
  - lib/legion/extensions/dynatrace/logs/runners/logs.rb
@@ -176,6 +190,11 @@ files:
176
190
  - lib/legion/extensions/dynatrace/network_zones.rb
177
191
  - lib/legion/extensions/dynatrace/network_zones/client.rb
178
192
  - lib/legion/extensions/dynatrace/network_zones/runners/network_zones.rb
193
+ - lib/legion/extensions/dynatrace/oneagents.rb
194
+ - lib/legion/extensions/dynatrace/oneagents/client.rb
195
+ - lib/legion/extensions/dynatrace/oneagents/runners/oneagents.rb
196
+ - lib/legion/extensions/dynatrace/open_pipeline.rb
197
+ - lib/legion/extensions/dynatrace/open_pipeline/runners/open_pipeline.rb
179
198
  - lib/legion/extensions/dynatrace/problems.rb
180
199
  - lib/legion/extensions/dynatrace/problems/client.rb
181
200
  - lib/legion/extensions/dynatrace/problems/runners/problems.rb