petstroepack 1.0.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 (141) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +86 -0
  4. data/lib/ctd_documentation/api_helper.rb +10 -0
  5. data/lib/ctd_documentation/client.rb +140 -0
  6. data/lib/ctd_documentation/configuration.rb +103 -0
  7. data/lib/ctd_documentation/controllers/activities_controller.rb +69 -0
  8. data/lib/ctd_documentation/controllers/alerts_controller.rb +170 -0
  9. data/lib/ctd_documentation/controllers/assets_controller.rb +409 -0
  10. data/lib/ctd_documentation/controllers/base_controller.rb +65 -0
  11. data/lib/ctd_documentation/controllers/custom_attributes_categories_controller.rb +50 -0
  12. data/lib/ctd_documentation/controllers/events_controller.rb +67 -0
  13. data/lib/ctd_documentation/controllers/groups_controller.rb +28 -0
  14. data/lib/ctd_documentation/controllers/insights_controller.rb +111 -0
  15. data/lib/ctd_documentation/controllers/license_controller.rb +73 -0
  16. data/lib/ctd_documentation/controllers/login_controller.rb +31 -0
  17. data/lib/ctd_documentation/controllers/queries_controller.rb +128 -0
  18. data/lib/ctd_documentation/controllers/sensors_controller.rb +26 -0
  19. data/lib/ctd_documentation/controllers/sites_controller.rb +39 -0
  20. data/lib/ctd_documentation/controllers/tasks_controller.rb +148 -0
  21. data/lib/ctd_documentation/controllers/tasks_queries_controller.rb +29 -0
  22. data/lib/ctd_documentation/controllers/users_controller.rb +28 -0
  23. data/lib/ctd_documentation/exceptions/api_exception.rb +10 -0
  24. data/lib/ctd_documentation/exceptions/auth_authenticate401_error_exception.rb +48 -0
  25. data/lib/ctd_documentation/http/auth/custom_header_auth.rb +25 -0
  26. data/lib/ctd_documentation/http/http_call_back.rb +10 -0
  27. data/lib/ctd_documentation/http/http_method_enum.rb +10 -0
  28. data/lib/ctd_documentation/http/http_request.rb +10 -0
  29. data/lib/ctd_documentation/http/http_response.rb +10 -0
  30. data/lib/ctd_documentation/models/actionable.rb +70 -0
  31. data/lib/ctd_documentation/models/actionable_asset.rb +80 -0
  32. data/lib/ctd_documentation/models/actionable_cap.rb +80 -0
  33. data/lib/ctd_documentation/models/actionable_information.rb +80 -0
  34. data/lib/ctd_documentation/models/actionable_policy.rb +361 -0
  35. data/lib/ctd_documentation/models/actionable_related_asset.rb +142 -0
  36. data/lib/ctd_documentation/models/active_history.rb +311 -0
  37. data/lib/ctd_documentation/models/activities_object.rb +150 -0
  38. data/lib/ctd_documentation/models/activities_response.rb +100 -0
  39. data/lib/ctd_documentation/models/activity.rb +150 -0
  40. data/lib/ctd_documentation/models/add_license_response.rb +79 -0
  41. data/lib/ctd_documentation/models/alert.rb +455 -0
  42. data/lib/ctd_documentation/models/alert_severity_enum.rb +23 -0
  43. data/lib/ctd_documentation/models/asset.rb +527 -0
  44. data/lib/ctd_documentation/models/assets_with_insights.rb +252 -0
  45. data/lib/ctd_documentation/models/assets_with_insights_response.rb +90 -0
  46. data/lib/ctd_documentation/models/authenticate.rb +57 -0
  47. data/lib/ctd_documentation/models/base_model.rb +58 -0
  48. data/lib/ctd_documentation/models/base_task.rb +198 -0
  49. data/lib/ctd_documentation/models/cap.rb +90 -0
  50. data/lib/ctd_documentation/models/code_sections.rb +70 -0
  51. data/lib/ctd_documentation/models/content_type_enum.rb +14 -0
  52. data/lib/ctd_documentation/models/create_a_new_query.rb +57 -0
  53. data/lib/ctd_documentation/models/create_a_new_query_response.rb +57 -0
  54. data/lib/ctd_documentation/models/create_group_response.rb +48 -0
  55. data/lib/ctd_documentation/models/create_user_response.rb +48 -0
  56. data/lib/ctd_documentation/models/createanewtask.rb +57 -0
  57. data/lib/ctd_documentation/models/createanewtask_response.rb +57 -0
  58. data/lib/ctd_documentation/models/ctd_login_exception.rb +81 -0
  59. data/lib/ctd_documentation/models/ctd_login_response.rb +101 -0
  60. data/lib/ctd_documentation/models/custom_attribute_category.rb +90 -0
  61. data/lib/ctd_documentation/models/db_statistics.rb +50 -0
  62. data/lib/ctd_documentation/models/delete_a_query_response.rb +48 -0
  63. data/lib/ctd_documentation/models/delete_a_task_response.rb +48 -0
  64. data/lib/ctd_documentation/models/destination_virtual_zone.rb +60 -0
  65. data/lib/ctd_documentation/models/detail.rb +60 -0
  66. data/lib/ctd_documentation/models/discovery_params.rb +82 -0
  67. data/lib/ctd_documentation/models/entity.rb +70 -0
  68. data/lib/ctd_documentation/models/event.rb +175 -0
  69. data/lib/ctd_documentation/models/find_asset_by_id_response.rb +547 -0
  70. data/lib/ctd_documentation/models/format1_enum.rb +22 -0
  71. data/lib/ctd_documentation/models/format_enum.rb +20 -0
  72. data/lib/ctd_documentation/models/get_active_detection_history_response.rb +90 -0
  73. data/lib/ctd_documentation/models/get_alerts_response.rb +90 -0
  74. data/lib/ctd_documentation/models/get_all_sites_response.rb +90 -0
  75. data/lib/ctd_documentation/models/get_assets_response.rb +90 -0
  76. data/lib/ctd_documentation/models/get_custom_attribute_categories_response.rb +90 -0
  77. data/lib/ctd_documentation/models/get_events_response.rb +90 -0
  78. data/lib/ctd_documentation/models/get_license_details_response.rb +81 -0
  79. data/lib/ctd_documentation/models/get_queries_ids_and_assigned_task_response.rb +70 -0
  80. data/lib/ctd_documentation/models/get_queries_response.rb +90 -0
  81. data/lib/ctd_documentation/models/get_tasks_response.rb +90 -0
  82. data/lib/ctd_documentation/models/get_types_response.rb +57 -0
  83. data/lib/ctd_documentation/models/group.rb +73 -0
  84. data/lib/ctd_documentation/models/identifiable.rb +70 -0
  85. data/lib/ctd_documentation/models/indicator_info.rb +90 -0
  86. data/lib/ctd_documentation/models/indicators.rb +122 -0
  87. data/lib/ctd_documentation/models/information.rb +183 -0
  88. data/lib/ctd_documentation/models/insight_status_enum.rb +20 -0
  89. data/lib/ctd_documentation/models/insight_status_exact1_enum.rb +21 -0
  90. data/lib/ctd_documentation/models/insight_status_exact_enum.rb +20 -0
  91. data/lib/ctd_documentation/models/license_request.rb +48 -0
  92. data/lib/ctd_documentation/models/network.rb +80 -0
  93. data/lib/ctd_documentation/models/new_queryobject.rb +199 -0
  94. data/lib/ctd_documentation/models/new_taskobject.rb +199 -0
  95. data/lib/ctd_documentation/models/object.rb +70 -0
  96. data/lib/ctd_documentation/models/paginated_response.rb +71 -0
  97. data/lib/ctd_documentation/models/policy.rb +331 -0
  98. data/lib/ctd_documentation/models/queryextraparams.rb +60 -0
  99. data/lib/ctd_documentation/models/ranger_system_check_response.rb +57 -0
  100. data/lib/ctd_documentation/models/risk_vector.rb +89 -0
  101. data/lib/ctd_documentation/models/selection_params.rb +58 -0
  102. data/lib/ctd_documentation/models/selection_params1.rb +80 -0
  103. data/lib/ctd_documentation/models/site.rb +256 -0
  104. data/lib/ctd_documentation/models/site_list_slim_enum.rb +14 -0
  105. data/lib/ctd_documentation/models/slim_insight.rb +139 -0
  106. data/lib/ctd_documentation/models/sort1_enum.rb +65 -0
  107. data/lib/ctd_documentation/models/sort31_enum.rb +59 -0
  108. data/lib/ctd_documentation/models/sort3_enum.rb +59 -0
  109. data/lib/ctd_documentation/models/sort41_enum.rb +41 -0
  110. data/lib/ctd_documentation/models/sort4_enum.rb +41 -0
  111. data/lib/ctd_documentation/models/sort5_enum.rb +35 -0
  112. data/lib/ctd_documentation/models/sort6_enum.rb +41 -0
  113. data/lib/ctd_documentation/models/sort_enum.rb +125 -0
  114. data/lib/ctd_documentation/models/source_virtual_zone.rb +60 -0
  115. data/lib/ctd_documentation/models/special_hint_enum.rb +26 -0
  116. data/lib/ctd_documentation/models/special_hint_exact_enum.rb +26 -0
  117. data/lib/ctd_documentation/models/status_enum.rb +17 -0
  118. data/lib/ctd_documentation/models/status_exact_enum.rb +23 -0
  119. data/lib/ctd_documentation/models/subnet.rb +50 -0
  120. data/lib/ctd_documentation/models/task.rb +281 -0
  121. data/lib/ctd_documentation/models/taskextraparams.rb +71 -0
  122. data/lib/ctd_documentation/models/update_a_single_query_response.rb +57 -0
  123. data/lib/ctd_documentation/models/update_a_single_task_response.rb +57 -0
  124. data/lib/ctd_documentation/models/update_license_response.rb +79 -0
  125. data/lib/ctd_documentation/models/user.rb +88 -0
  126. data/lib/ctd_documentation/models/virtual_zones.rb +118 -0
  127. data/lib/ctd_documentation/utilities/date_time_helper.rb +11 -0
  128. data/lib/ctd_documentation/utilities/file_wrapper.rb +16 -0
  129. data/lib/ctd_documentation.rb +155 -0
  130. data/test/controllers/controller_test_base.rb +29 -0
  131. data/test/controllers/test_activities_controller.rb +64 -0
  132. data/test/controllers/test_alerts_controller.rb +16 -0
  133. data/test/controllers/test_assets_controller.rb +79 -0
  134. data/test/controllers/test_custom_attributes_categories_controller.rb +52 -0
  135. data/test/controllers/test_events_controller.rb +55 -0
  136. data/test/controllers/test_login_controller.rb +45 -0
  137. data/test/controllers/test_queries_controller.rb +292 -0
  138. data/test/controllers/test_sites_controller.rb +53 -0
  139. data/test/controllers/test_tasks_controller.rb +250 -0
  140. data/test/http_response_catcher.rb +19 -0
  141. metadata +259 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 105ac697134f4526a5c84c7f9e6e2468094409e47322bb7565df6a6b6d66f113
4
+ data.tar.gz: a4dfa7bdbc8668a5dfc4454ca1bb99666c325bf0a90ada030fc5937f528b0ecc
5
+ SHA512:
6
+ metadata.gz: 0f220bbef825602fd490256ec8e713a334718cf1b468f68222d6bfcb9fc5689a8d829bb0563c0a9ff3eda26f11ce05669d09df7cdfb1a4384f1d56051d3c395f
7
+ data.tar.gz: '059030aee21bc5d365b556c4862154a004e7dff39df2f396c7478004ed1daa28130e639ce473c3f74f052c3114ae3fb59075e6c8500b6829b3a534959eccd5b9'
data/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ License:
2
+ ========
3
+ The MIT License (MIT)
4
+ http://opensource.org/licenses/MIT
5
+
6
+ Copyright (c) 2014 - 2023 APIMATIC Limited
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in
16
+ all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ THE SOFTWARE.
25
+
26
+ Trade Mark:
27
+ ==========
28
+ APIMATIC is a trade mark for APIMATIC Limited
data/README.md ADDED
@@ -0,0 +1,86 @@
1
+
2
+ # Getting Started with CTD - Documentation
3
+
4
+ ## Install the Package
5
+
6
+ Install the gem from the command line:
7
+
8
+ ```ruby
9
+ gem install petstroepack -v 1.0.0
10
+ ```
11
+
12
+ Or add the gem to your Gemfile and run `bundle`:
13
+
14
+ ```ruby
15
+ gem 'petstroepack', '1.0.0'
16
+ ```
17
+
18
+ For additional gem details, see the [RubyGems page for the petstroepack gem](https://rubygems.org/gems/petstroepack/versions/1.0.0).
19
+
20
+ ## Test the SDK
21
+
22
+ To run the tests, navigate to the root directory of the SDK in your terminal and execute the following command:
23
+
24
+ ```
25
+ rake
26
+ ```
27
+
28
+ ## Initialize the API Client
29
+
30
+ **_Note:_** Documentation for the client can be found [here.](doc/client.md)
31
+
32
+ The following parameters are configurable for the API Client:
33
+
34
+ | Parameter | Type | Description |
35
+ | --- | --- | --- |
36
+ | `host` | `String` | *Default*: `'HostValue'` |
37
+ | `environment` | Environment | The API environment. <br> **Default: `Environment.PRODUCTION`** |
38
+ | `connection` | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
39
+ | `adapter` | `Faraday::Adapter` | The Faraday adapter object passed by the SDK user for performing http requests |
40
+ | `timeout` | `Float` | The value to use for connection timeout. <br> **Default: 60** |
41
+ | `max_retries` | `Integer` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
42
+ | `retry_interval` | `Float` | Pause in seconds between retries. <br> **Default: 1** |
43
+ | `backoff_factor` | `Float` | The amount to multiply each successive retry's interval amount by in order to provide backoff. <br> **Default: 2** |
44
+ | `retry_statuses` | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
45
+ | `retry_methods` | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put]** |
46
+ | `http_callback` | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
47
+ | `authorization` | `String` | |
48
+
49
+ The API client can be initialized as follows:
50
+
51
+ ```ruby
52
+ client = CtdDocumentation::Client.new(
53
+ authorization: 'Authorization',
54
+ environment: Environment::PRODUCTION,
55
+ host: 'HostValue'
56
+ )
57
+ ```
58
+
59
+ ## Authorization
60
+
61
+ This API uses `Custom Header Signature`.
62
+
63
+ ## List of APIs
64
+
65
+ * [Tasks Queries](doc/controllers/tasks-queries.md)
66
+ * [Custom Attributes Categories](doc/controllers/custom-attributes-categories.md)
67
+ * [Login](doc/controllers/login.md)
68
+ * [Assets](doc/controllers/assets.md)
69
+ * [Alerts](doc/controllers/alerts.md)
70
+ * [Tasks](doc/controllers/tasks.md)
71
+ * [Queries](doc/controllers/queries.md)
72
+ * [Insights](doc/controllers/insights.md)
73
+ * [Sites](doc/controllers/sites.md)
74
+ * [Activities](doc/controllers/activities.md)
75
+ * [License](doc/controllers/license.md)
76
+ * [Users](doc/controllers/users.md)
77
+ * [Groups](doc/controllers/groups.md)
78
+ * [Sensors](doc/controllers/sensors.md)
79
+ * [Events](doc/controllers/events.md)
80
+
81
+ ## Classes Documentation
82
+
83
+ * [Utility Classes](doc/utility-classes.md)
84
+ * [HttpResponse](doc/http-response.md)
85
+ * [HttpRequest](doc/http-request.md)
86
+
@@ -0,0 +1,10 @@
1
+ # ctd_documentation
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module CtdDocumentation
7
+ # API utility class
8
+ class APIHelper < CoreLibrary::ApiHelper
9
+ end
10
+ end
@@ -0,0 +1,140 @@
1
+ # ctd_documentation
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module CtdDocumentation
7
+ # ctd_documentation client class.
8
+ class Client
9
+ attr_reader :config, :auth_managers
10
+
11
+ # Access to login controller.
12
+ # @return [LoginController] Returns the controller instance.
13
+ def login
14
+ @login ||= LoginController.new @global_configuration
15
+ end
16
+
17
+ # Access to assets controller.
18
+ # @return [AssetsController] Returns the controller instance.
19
+ def assets
20
+ @assets ||= AssetsController.new @global_configuration
21
+ end
22
+
23
+ # Access to alerts controller.
24
+ # @return [AlertsController] Returns the controller instance.
25
+ def alerts
26
+ @alerts ||= AlertsController.new @global_configuration
27
+ end
28
+
29
+ # Access to tasks controller.
30
+ # @return [TasksController] Returns the controller instance.
31
+ def tasks
32
+ @tasks ||= TasksController.new @global_configuration
33
+ end
34
+
35
+ # Access to tasks_queries controller.
36
+ # @return [TasksQueriesController] Returns the controller instance.
37
+ def tasks_queries
38
+ @tasks_queries ||= TasksQueriesController.new @global_configuration
39
+ end
40
+
41
+ # Access to queries controller.
42
+ # @return [QueriesController] Returns the controller instance.
43
+ def queries
44
+ @queries ||= QueriesController.new @global_configuration
45
+ end
46
+
47
+ # Access to insights controller.
48
+ # @return [InsightsController] Returns the controller instance.
49
+ def insights
50
+ @insights ||= InsightsController.new @global_configuration
51
+ end
52
+
53
+ # Access to sites controller.
54
+ # @return [SitesController] Returns the controller instance.
55
+ def sites
56
+ @sites ||= SitesController.new @global_configuration
57
+ end
58
+
59
+ # Access to activities controller.
60
+ # @return [ActivitiesController] Returns the controller instance.
61
+ def activities
62
+ @activities ||= ActivitiesController.new @global_configuration
63
+ end
64
+
65
+ # Access to license controller.
66
+ # @return [LicenseController] Returns the controller instance.
67
+ def license
68
+ @license ||= LicenseController.new @global_configuration
69
+ end
70
+
71
+ # Access to users controller.
72
+ # @return [UsersController] Returns the controller instance.
73
+ def users
74
+ @users ||= UsersController.new @global_configuration
75
+ end
76
+
77
+ # Access to groups controller.
78
+ # @return [GroupsController] Returns the controller instance.
79
+ def groups
80
+ @groups ||= GroupsController.new @global_configuration
81
+ end
82
+
83
+ # Access to sensors controller.
84
+ # @return [SensorsController] Returns the controller instance.
85
+ def sensors
86
+ @sensors ||= SensorsController.new @global_configuration
87
+ end
88
+
89
+ # Access to custom_attributes_categories controller.
90
+ # @return [CustomAttributesCategoriesController] Returns the controller instance.
91
+ def custom_attributes_categories
92
+ @custom_attributes_categories ||= CustomAttributesCategoriesController.new @global_configuration
93
+ end
94
+
95
+ # Access to events controller.
96
+ # @return [EventsController] Returns the controller instance.
97
+ def events
98
+ @events ||= EventsController.new @global_configuration
99
+ end
100
+
101
+ def initialize(connection: nil, adapter: :net_http_persistent, timeout: 60,
102
+ max_retries: 0, retry_interval: 1, backoff_factor: 2,
103
+ retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
104
+ retry_methods: %i[get put], http_callback: nil,
105
+ environment: Environment::PRODUCTION, host: 'HostValue',
106
+ authorization: 'TODO: Replace', config: nil)
107
+ @config = if config.nil?
108
+ Configuration.new(connection: connection, adapter: adapter,
109
+ timeout: timeout, max_retries: max_retries,
110
+ retry_interval: retry_interval,
111
+ backoff_factor: backoff_factor,
112
+ retry_statuses: retry_statuses,
113
+ retry_methods: retry_methods,
114
+ http_callback: http_callback,
115
+ environment: environment, host: host,
116
+ authorization: authorization)
117
+ else
118
+ config
119
+ end
120
+
121
+ @global_configuration = GlobalConfiguration.new(client_configuration: @config)
122
+ .base_uri_executor(@config.method(:get_base_uri))
123
+ .global_errors(BaseController::GLOBAL_ERRORS)
124
+ .user_agent(BaseController.user_agent)
125
+ .sdk_module(CtdDocumentation)
126
+
127
+ initialize_auth_managers(@global_configuration)
128
+ @global_configuration = @global_configuration.auth_managers(@auth_managers)
129
+ end
130
+
131
+ # Initializes the auth managers hash used for authenticating API calls.
132
+ # @param [GlobalConfiguration] global_config The global configuration of the SDK)
133
+ def initialize_auth_managers(global_config)
134
+ @auth_managers = {}
135
+ http_client_config = global_config.client_configuration
136
+ ['global'].each { |auth| @auth_managers[auth] = nil }
137
+ @auth_managers['global'] = CustomHeaderAuth.new(http_client_config.authorization)
138
+ end
139
+ end
140
+ end
@@ -0,0 +1,103 @@
1
+ # ctd_documentation
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module CtdDocumentation
7
+ # An enum for SDK environments.
8
+ class Environment
9
+ ENVIRONMENT = [
10
+ PRODUCTION = 'production'.freeze
11
+ ].freeze
12
+ end
13
+
14
+ # An enum for API servers.
15
+ class Server
16
+ SERVER = [
17
+ DEFAULT = 'default'.freeze
18
+ ].freeze
19
+ end
20
+
21
+ # All configuration including auth info and base URI for the API access
22
+ # are configured in this class.
23
+ class Configuration < CoreLibrary::HttpClientConfiguration
24
+ # The attribute readers for properties.
25
+ attr_reader :environment, :host, :authorization
26
+
27
+ class << self
28
+ attr_reader :environments
29
+ end
30
+
31
+ def initialize(connection: nil, adapter: :net_http_persistent, timeout: 60,
32
+ max_retries: 0, retry_interval: 1, backoff_factor: 2,
33
+ retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
34
+ retry_methods: %i[get put], http_callback: nil,
35
+ environment: Environment::PRODUCTION, host: 'HostValue',
36
+ authorization: 'TODO: Replace')
37
+
38
+ super connection: connection, adapter: adapter, timeout: timeout,
39
+ max_retries: max_retries, retry_interval: retry_interval,
40
+ backoff_factor: backoff_factor, retry_statuses: retry_statuses,
41
+ retry_methods: retry_methods, http_callback: http_callback
42
+
43
+ # Current API environment
44
+ @environment = String(environment)
45
+
46
+ # host value
47
+ @host = host
48
+
49
+ # TODO: Replace
50
+ @authorization = authorization
51
+
52
+ # The Http Client to use for making requests.
53
+ set_http_client CoreLibrary::FaradayClient.new(self)
54
+ end
55
+
56
+ def clone_with(connection: nil, adapter: nil, timeout: nil,
57
+ max_retries: nil, retry_interval: nil, backoff_factor: nil,
58
+ retry_statuses: nil, retry_methods: nil, http_callback: nil,
59
+ environment: nil, host: nil, authorization: nil)
60
+ connection ||= self.connection
61
+ adapter ||= self.adapter
62
+ timeout ||= self.timeout
63
+ max_retries ||= self.max_retries
64
+ retry_interval ||= self.retry_interval
65
+ backoff_factor ||= self.backoff_factor
66
+ retry_statuses ||= self.retry_statuses
67
+ retry_methods ||= self.retry_methods
68
+ http_callback ||= self.http_callback
69
+ environment ||= self.environment
70
+ host ||= self.host
71
+ authorization ||= self.authorization
72
+
73
+ Configuration.new(connection: connection, adapter: adapter,
74
+ timeout: timeout, max_retries: max_retries,
75
+ retry_interval: retry_interval,
76
+ backoff_factor: backoff_factor,
77
+ retry_statuses: retry_statuses,
78
+ retry_methods: retry_methods,
79
+ http_callback: http_callback, environment: environment,
80
+ host: host, authorization: authorization)
81
+ end
82
+
83
+ # All the environments the SDK can run in.
84
+ ENVIRONMENTS = {
85
+ Environment::PRODUCTION => {
86
+ Server::DEFAULT => 'https://{Host}'
87
+ }
88
+ }.freeze
89
+
90
+ # Generates the appropriate base URI for the environment and the server.
91
+ # @param [Configuration::Server] server The server enum for which the base URI is
92
+ # required.
93
+ # @return [String] The base URI.
94
+ def get_base_uri(server = Server::DEFAULT)
95
+ parameters = {
96
+ 'Host' => { 'value' => host, 'encode' => false }
97
+ }
98
+ APIHelper.append_url_with_template_parameters(
99
+ ENVIRONMENTS[environment][server], parameters
100
+ )
101
+ end
102
+ end
103
+ end
@@ -0,0 +1,69 @@
1
+ # ctd_documentation
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module CtdDocumentation
7
+ # ActivitiesController
8
+ class ActivitiesController < BaseController
9
+ # Get Activities
10
+ # @param [Integer] page Optional parameter: Example:
11
+ # @param [Integer] per_page Optional parameter: Example:
12
+ # @param [String] alert_id__exact Optional parameter: Example:
13
+ # @param [String] asset_reference__exact Optional parameter: Example:
14
+ # @param [String] baseline__exact Optional parameter: Example:
15
+ # @param [String] site__exact Optional parameter: Example:
16
+ # @param [String] asset__exact Optional parameter: Example:
17
+ # @param [String] message__exact Optional parameter: Example:
18
+ # @param [String] comment__exact Optional parameter: Example:
19
+ # @param [Integer] id__exact Optional parameter: Example:
20
+ # @param [Integer] site_id__exact Optional parameter: Example:
21
+ # @param [Integer] type__exact Optional parameter: Example:
22
+ # @param [String] timestamp__exact Optional parameter: Example:
23
+ # @param [Integer] user_id__exact Optional parameter: Example:
24
+ # @param [Sort41Enum] sort Optional parameter: Sort order: add - for
25
+ # descending order
26
+ # @return [ActivitiesResponse] response from the API call
27
+ def get_activities(page: nil,
28
+ per_page: nil,
29
+ alert_id__exact: nil,
30
+ asset_reference__exact: nil,
31
+ baseline__exact: nil,
32
+ site__exact: nil,
33
+ asset__exact: nil,
34
+ message__exact: nil,
35
+ comment__exact: nil,
36
+ id__exact: nil,
37
+ site_id__exact: nil,
38
+ type__exact: nil,
39
+ timestamp__exact: nil,
40
+ user_id__exact: nil,
41
+ sort: nil)
42
+ new_api_call_builder
43
+ .request(new_request_builder(HttpMethodEnum::GET,
44
+ '/ranger/activities',
45
+ Server::DEFAULT)
46
+ .query_param(new_parameter(page, key: 'page'))
47
+ .query_param(new_parameter(per_page, key: 'per_page'))
48
+ .query_param(new_parameter(alert_id__exact, key: 'alert_id__exact'))
49
+ .query_param(new_parameter(asset_reference__exact, key: 'asset_reference__exact'))
50
+ .query_param(new_parameter(baseline__exact, key: 'baseline__exact'))
51
+ .query_param(new_parameter(site__exact, key: 'site__exact'))
52
+ .query_param(new_parameter(asset__exact, key: 'asset__exact'))
53
+ .query_param(new_parameter(message__exact, key: 'message__exact'))
54
+ .query_param(new_parameter(comment__exact, key: 'comment__exact'))
55
+ .query_param(new_parameter(id__exact, key: 'id__exact'))
56
+ .query_param(new_parameter(site_id__exact, key: 'site_id__exact'))
57
+ .query_param(new_parameter(type__exact, key: 'type__exact'))
58
+ .query_param(new_parameter(timestamp__exact, key: 'timestamp__exact'))
59
+ .query_param(new_parameter(user_id__exact, key: 'user_id__exact'))
60
+ .query_param(new_parameter(sort, key: 'sort'))
61
+ .header_param(new_parameter('application/json', key: 'accept'))
62
+ .auth(Single.new('global')))
63
+ .response(new_response_handler
64
+ .deserializer(APIHelper.method(:custom_type_deserializer))
65
+ .deserialize_into(ActivitiesResponse.method(:from_hash)))
66
+ .execute
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,170 @@
1
+ # ctd_documentation
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module CtdDocumentation
7
+ # AlertsController
8
+ class AlertsController < BaseController
9
+ # Retrieves a list of Alerts in CTD, with optional filters.
10
+ # Note - All filters are optional.
11
+ # @param [Integer] page Optional parameter: Page offset
12
+ # @param [Integer] per_page Optional parameter: Number of Alerts to pull on
13
+ # each page. (The maximum is 500).
14
+ # @param [String] asset_id__exact Optional parameter: Resource ID of the
15
+ # Asset
16
+ # @param [String] asset__exact Optional parameter: Example:
17
+ # @param [String] for_asset__exact Optional parameter: Example:
18
+ # @param [String] q__exact Optional parameter: Example:
19
+ # @param [String] primary_asset__exact Optional parameter: The resource ID
20
+ # of the primary asset that triggered the alert
21
+ # @param [String] non_primary_assets__exact Optional parameter: Resource IDs
22
+ # of the non-primary assets involved in the alert
23
+ # @param [String] virtual_zone__exact Optional parameter: The resource ID of
24
+ # the Zone that triggered the alert
25
+ # @param [String] alert_id__exact Optional parameter: The resource ID of the
26
+ # Alert. You can add multiple IDs.
27
+ # @param [String] ot_alerts__exact Optional parameter: Example:
28
+ # @param [String] family__exact Optional parameter: Model family of the
29
+ # Asset involved in the Alert, for example Policy Violation. Alert Families
30
+ # appear in the Advanced Options filter of Alerts.
31
+ # @param [String] story_severity__exact Optional parameter: Example:
32
+ # @param [Integer] id__exact Optional parameter: Example:
33
+ # @param [Integer] site_id__exact Optional parameter: ID of the Site on
34
+ # which the Alert occurred
35
+ # @param [String] data__exact Optional parameter: Example:
36
+ # @param [String] description__exact Optional parameter: Description of the
37
+ # alert
38
+ # @param [Integer] type__exact Optional parameter: Alert Type, such as Known
39
+ # Threat, New Conflict Asset, etc.
40
+ # @param [Integer] category__exact Optional parameter: Alert Category: 0 =
41
+ # Integrity, 1 = Security
42
+ # @param [Integer] severity__exact Optional parameter: Alert Severity: 0 =
43
+ # Low, 1 = Medium, 2 = High, 3 = Critical
44
+ # @param [String] timestamp__exact Optional parameter: Timestamp on which
45
+ # the Alert occured. **Format:** YYYY-MM-DD**T**HH:MM:SS (in UTC)
46
+ # **Example:** 2022-11-01T16:22:05
47
+ # @param [String] last_updated__gte Optional parameter: The timestamp when
48
+ # the latest change on the Alert was made in the EMC. **Format:**
49
+ # YYYY-MM-DD**T**HH:MM:SS (in UTC) **Example:** 2022-11-01T16:22:05
50
+ # @param [TrueClass|FalseClass] relevant__exact Optional parameter:
51
+ # Example:
52
+ # @param [TrueClass|FalseClass] resolved__exact Optional parameter: Whether
53
+ # or not an Alert was resolved: True = resolved, False = not resolved
54
+ # @param [Integer] resolution__exact Optional parameter: Type of
55
+ # resolution.
56
+ # @param [String] protocol__exact Optional parameter: Protocol used in the
57
+ # alert, for example: S7Comm
58
+ # @param [Integer] score__exact Optional parameter: Alert Score calculated
59
+ # for this alert, on a score of 1-100
60
+ # @param [TrueClass|FalseClass] is_qualified__exact Optional parameter:
61
+ # Example:
62
+ # @param [Integer] network_id__exact Optional parameter: Example:
63
+ # @param [Integer] resolved_id__exact Optional parameter: Example:
64
+ # @param [Integer] assigned_id__exact Optional parameter: ID of the User to
65
+ # which the Alert was assigned
66
+ # @param [Integer] story_id__exact Optional parameter: ID of the Alert Story
67
+ # to which the Alert belongs - can be viewed in the UI by selecting "Group
68
+ # By Story"
69
+ # @param [SortEnum] sort Optional parameter: By default, results are sorted
70
+ # in ascending order of the sort attribute. The sorting prefix "-" sorts the
71
+ # results in descending order of the sort attribute.
72
+ # @return [GetAlertsResponse] response from the API call
73
+ def get_alerts(page: nil,
74
+ per_page: nil,
75
+ asset_id__exact: nil,
76
+ asset__exact: nil,
77
+ for_asset__exact: nil,
78
+ q__exact: nil,
79
+ primary_asset__exact: nil,
80
+ non_primary_assets__exact: nil,
81
+ virtual_zone__exact: nil,
82
+ alert_id__exact: nil,
83
+ ot_alerts__exact: nil,
84
+ family__exact: nil,
85
+ story_severity__exact: nil,
86
+ id__exact: nil,
87
+ site_id__exact: nil,
88
+ data__exact: nil,
89
+ description__exact: nil,
90
+ type__exact: nil,
91
+ category__exact: nil,
92
+ severity__exact: nil,
93
+ timestamp__exact: nil,
94
+ last_updated__gte: nil,
95
+ relevant__exact: nil,
96
+ resolved__exact: nil,
97
+ resolution__exact: nil,
98
+ protocol__exact: nil,
99
+ score__exact: nil,
100
+ is_qualified__exact: nil,
101
+ network_id__exact: nil,
102
+ resolved_id__exact: nil,
103
+ assigned_id__exact: nil,
104
+ story_id__exact: nil,
105
+ sort: nil)
106
+ new_api_call_builder
107
+ .request(new_request_builder(HttpMethodEnum::GET,
108
+ '/ranger/alerts',
109
+ Server::DEFAULT)
110
+ .query_param(new_parameter(page, key: 'page'))
111
+ .query_param(new_parameter(per_page, key: 'per_page'))
112
+ .query_param(new_parameter(asset_id__exact, key: 'asset_id__exact'))
113
+ .query_param(new_parameter(asset__exact, key: 'asset__exact'))
114
+ .query_param(new_parameter(for_asset__exact, key: 'for_asset__exact'))
115
+ .query_param(new_parameter(q__exact, key: 'q__exact'))
116
+ .query_param(new_parameter(primary_asset__exact, key: 'primary_asset__exact'))
117
+ .query_param(new_parameter(non_primary_assets__exact, key: 'non_primary_assets__exact'))
118
+ .query_param(new_parameter(virtual_zone__exact, key: 'virtual_zone__exact'))
119
+ .query_param(new_parameter(alert_id__exact, key: 'alert_id__exact'))
120
+ .query_param(new_parameter(ot_alerts__exact, key: 'ot_alerts__exact'))
121
+ .query_param(new_parameter(family__exact, key: 'family__exact'))
122
+ .query_param(new_parameter(story_severity__exact, key: 'story_severity__exact'))
123
+ .query_param(new_parameter(id__exact, key: 'id__exact'))
124
+ .query_param(new_parameter(site_id__exact, key: 'site_id__exact'))
125
+ .query_param(new_parameter(data__exact, key: 'data__exact'))
126
+ .query_param(new_parameter(description__exact, key: 'description__exact'))
127
+ .query_param(new_parameter(type__exact, key: 'type__exact'))
128
+ .query_param(new_parameter(category__exact, key: 'category__exact'))
129
+ .query_param(new_parameter(severity__exact, key: 'severity__exact'))
130
+ .query_param(new_parameter(timestamp__exact, key: 'timestamp__exact'))
131
+ .query_param(new_parameter(last_updated__gte, key: 'last_updated__gte'))
132
+ .query_param(new_parameter(relevant__exact, key: 'relevant__exact'))
133
+ .query_param(new_parameter(resolved__exact, key: 'resolved__exact'))
134
+ .query_param(new_parameter(resolution__exact, key: 'resolution__exact'))
135
+ .query_param(new_parameter(protocol__exact, key: 'protocol__exact'))
136
+ .query_param(new_parameter(score__exact, key: 'score__exact'))
137
+ .query_param(new_parameter(is_qualified__exact, key: 'is_qualified__exact'))
138
+ .query_param(new_parameter(network_id__exact, key: 'network_id__exact'))
139
+ .query_param(new_parameter(resolved_id__exact, key: 'resolved_id__exact'))
140
+ .query_param(new_parameter(assigned_id__exact, key: 'assigned_id__exact'))
141
+ .query_param(new_parameter(story_id__exact, key: 'story_id__exact'))
142
+ .query_param(new_parameter(sort, key: 'sort'))
143
+ .header_param(new_parameter('application/json', key: 'accept'))
144
+ .auth(Single.new('global')))
145
+ .response(new_response_handler
146
+ .deserializer(APIHelper.method(:custom_type_deserializer))
147
+ .deserialize_into(GetAlertsResponse.method(:from_hash)))
148
+ .execute
149
+ end
150
+
151
+ # Get a single alert.
152
+ # @param [String] resource_id Required parameter: Resource ID of the Alert
153
+ # to return
154
+ # @return [Alert] response from the API call
155
+ def find_alert_by_id(resource_id)
156
+ new_api_call_builder
157
+ .request(new_request_builder(HttpMethodEnum::GET,
158
+ '/ranger/alerts/{resource_id}',
159
+ Server::DEFAULT)
160
+ .template_param(new_parameter(resource_id, key: 'resource_id')
161
+ .should_encode(true))
162
+ .header_param(new_parameter('application/json', key: 'accept'))
163
+ .auth(Single.new('global')))
164
+ .response(new_response_handler
165
+ .deserializer(APIHelper.method(:custom_type_deserializer))
166
+ .deserialize_into(Alert.method(:from_hash)))
167
+ .execute
168
+ end
169
+ end
170
+ end