Class: DatadogAPIClient::V2::AgentHealthAPI
- Inherits:
-
Object
- Object
- DatadogAPIClient::V2::AgentHealthAPI
- Defined in:
- lib/datadog_api_client/v2/api/agent_health_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#get_agent_health_issue(issue_id, opts = {}) ⇒ Object
Get an Agent Health issue.
-
#get_agent_health_issue_with_http_info(issue_id, opts = {}) ⇒ Array<(AgentHealthIssueResponse, Integer, Hash)>
Get an Agent Health issue.
-
#initialize(api_client = DatadogAPIClient::APIClient.default) ⇒ AgentHealthAPI
constructor
A new instance of AgentHealthAPI.
-
#list_agent_health_host_issues(resource_id, opts = {}) ⇒ Object
List active Agent Health issues.
-
#list_agent_health_host_issues_with_http_info(resource_id, opts = {}) ⇒ Array<(AgentHealthHostIssuesResponse, Integer, Hash)>
List active Agent Health issues.
-
#list_agent_health_issues(opts = {}) ⇒ Object
List Agent Health issues.
-
#list_agent_health_issues_with_http_info(opts = {}) ⇒ Array<(AgentHealthIssuesResponse, Integer, Hash)>
List Agent Health issues.
-
#list_agent_health_issues_with_pagination(opts = {}) {|AgentHealthIssueData| ... } ⇒ Object
List Agent Health issues.
Constructor Details
#initialize(api_client = DatadogAPIClient::APIClient.default) ⇒ AgentHealthAPI
Returns a new instance of AgentHealthAPI.
22 23 24 |
# File 'lib/datadog_api_client/v2/api/agent_health_api.rb', line 22 def initialize(api_client = DatadogAPIClient::APIClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
20 21 22 |
# File 'lib/datadog_api_client/v2/api/agent_health_api.rb', line 20 def api_client @api_client end |
Instance Method Details
#get_agent_health_issue(issue_id, opts = {}) ⇒ Object
Get an Agent Health issue.
29 30 31 32 |
# File 'lib/datadog_api_client/v2/api/agent_health_api.rb', line 29 def get_agent_health_issue(issue_id, opts = {}) data, _status_code, _headers = get_agent_health_issue_with_http_info(issue_id, opts) data end |
#get_agent_health_issue_with_http_info(issue_id, opts = {}) ⇒ Array<(AgentHealthIssueResponse, Integer, Hash)>
Get an Agent Health issue.
Get an Agent Health issue and its available remediation in your organization.
The remediation attribute is omitted when the issue has no remediation.
Returns 404 if the issue does not exist, belongs to another organization, or
you do not have access to its data. This response does not reveal whether the
issue exists. Returns 403 if you lack the hosts_read permission.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/datadog_api_client/v2/api/agent_health_api.rb', line 46 def get_agent_health_issue_with_http_info(issue_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AgentHealthAPI.get_agent_health_issue ...' end # verify the required parameter 'issue_id' is set if @api_client.config.client_side_validation && issue_id.nil? fail ArgumentError, "Missing the required parameter 'issue_id' when calling AgentHealthAPI.get_agent_health_issue" end # resource path local_var_path = '/api/v2/agenthealth/issues/{issue_id}'.sub('{issue_id}', CGI.escape(issue_id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'AgentHealthIssueResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] = opts.merge( :operation => :get_agent_health_issue, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type, :api_version => "V2" ) data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AgentHealthAPI#get_agent_health_issue\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_agent_health_host_issues(resource_id, opts = {}) ⇒ Object
List active Agent Health issues.
99 100 101 102 |
# File 'lib/datadog_api_client/v2/api/agent_health_api.rb', line 99 def list_agent_health_host_issues(resource_id, opts = {}) data, _status_code, _headers = list_agent_health_host_issues_with_http_info(resource_id, opts) data end |
#list_agent_health_host_issues_with_http_info(resource_id, opts = {}) ⇒ Array<(AgentHealthHostIssuesResponse, Integer, Hash)>
List active Agent Health issues.
Returns the active Agent Health issues for a node Agent or Cluster Agent resource.
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/datadog_api_client/v2/api/agent_health_api.rb', line 112 def list_agent_health_host_issues_with_http_info(resource_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AgentHealthAPI.list_agent_health_host_issues ...' end # verify the required parameter 'resource_id' is set if @api_client.config.client_side_validation && resource_id.nil? fail ArgumentError, "Missing the required parameter 'resource_id' when calling AgentHealthAPI.list_agent_health_host_issues" end allowable_values = ['node', 'cluster'] if @api_client.config.client_side_validation && opts[:'agent_type'] && !allowable_values.include?(opts[:'agent_type']) fail ArgumentError, "invalid value for \"agent_type\", must be one of #{allowable_values}" end # resource path local_var_path = '/api/v2/agenthealth/hosts/{resource_id}/issues'.sub('{resource_id}', CGI.escape(resource_id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} query_params[:'agent_type'] = opts[:'agent_type'] if !opts[:'agent_type'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'AgentHealthHostIssuesResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth] = opts.merge( :operation => :list_agent_health_host_issues, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type, :api_version => "V2" ) data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AgentHealthAPI#list_agent_health_host_issues\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_agent_health_issues(opts = {}) ⇒ Object
List Agent Health issues.
170 171 172 173 |
# File 'lib/datadog_api_client/v2/api/agent_health_api.rb', line 170 def list_agent_health_issues(opts = {}) data, _status_code, _headers = list_agent_health_issues_with_http_info(opts) data end |
#list_agent_health_issues_with_http_info(opts = {}) ⇒ Array<(AgentHealthIssuesResponse, Integer, Hash)>
List Agent Health issues.
List open Agent Health issues across your organization. Returns 403 if you
lack the hosts_read permission.
Each item in data is a JSON:API resource object whose attributes hold the issue
fields, including its issue_type. Issues use a stable order: severity rank
(high, medium, low, then other values), then first_seen_at descending with
missing timestamps last, then issue ID ascending.
The response always includes meta.page with the applied limit, offset, and
total_count (the number of open issues matching the filters). Set count_by=issue_type
to also include counts_by_issue_type with per-issue-type counts.
Each filter accepts up to 50 comma-separated exact values of at most 256 characters each, combined with OR within a filter and AND across filters. Blank entries are ignored; an all-blank filter is treated as absent.
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 |
# File 'lib/datadog_api_client/v2/api/agent_health_api.rb', line 203 def list_agent_health_issues_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AgentHealthAPI.list_agent_health_issues ...' end allowable_values = ['issue_type'] if @api_client.config.client_side_validation && opts[:'count_by'] && !allowable_values.include?(opts[:'count_by']) fail ArgumentError, "invalid value for \"count_by\", must be one of #{allowable_values}" end if @api_client.config.client_side_validation && !opts[:'page_limit'].nil? && opts[:'page_limit'] > 1000 fail ArgumentError, 'invalid value for "opts[:"page_limit"]" when calling AgentHealthAPI.list_agent_health_issues, must be smaller than or equal to 1000.' end if @api_client.config.client_side_validation && !opts[:'page_limit'].nil? && opts[:'page_limit'] < 1 fail ArgumentError, 'invalid value for "opts[:"page_limit"]" when calling AgentHealthAPI.list_agent_health_issues, must be greater than or equal to 1.' end if @api_client.config.client_side_validation && !opts[:'page_offset'].nil? && opts[:'page_offset'] < 0 fail ArgumentError, 'invalid value for "opts[:"page_offset"]" when calling AgentHealthAPI.list_agent_health_issues, must be greater than or equal to 0.' end if @api_client.config.client_side_validation && !opts[:'filter_severity'].nil? && opts[:'filter_severity'].to_s.length > 12850 fail ArgumentError, 'invalid value for "opts[:"filter_severity"]" when calling AgentHealthAPI.list_agent_health_issues, the character length must be smaller than or equal to 12850.' end if @api_client.config.client_side_validation && !opts[:'filter_category'].nil? && opts[:'filter_category'].to_s.length > 12850 fail ArgumentError, 'invalid value for "opts[:"filter_category"]" when calling AgentHealthAPI.list_agent_health_issues, the character length must be smaller than or equal to 12850.' end if @api_client.config.client_side_validation && !opts[:'filter_issue_type'].nil? && opts[:'filter_issue_type'].to_s.length > 12850 fail ArgumentError, 'invalid value for "opts[:"filter_issue_type"]" when calling AgentHealthAPI.list_agent_health_issues, the character length must be smaller than or equal to 12850.' end if @api_client.config.client_side_validation && !opts[:'filter_resource_kind'].nil? && opts[:'filter_resource_kind'].to_s.length > 12850 fail ArgumentError, 'invalid value for "opts[:"filter_resource_kind"]" when calling AgentHealthAPI.list_agent_health_issues, the character length must be smaller than or equal to 12850.' end if @api_client.config.client_side_validation && !opts[:'filter_resource_id'].nil? && opts[:'filter_resource_id'].to_s.length > 12850 fail ArgumentError, 'invalid value for "opts[:"filter_resource_id"]" when calling AgentHealthAPI.list_agent_health_issues, the character length must be smaller than or equal to 12850.' end # resource path local_var_path = '/api/v2/agenthealth/issues' # query parameters query_params = opts[:query_params] || {} query_params[:'count_by'] = opts[:'count_by'] if !opts[:'count_by'].nil? query_params[:'page[limit]'] = opts[:'page_limit'] if !opts[:'page_limit'].nil? query_params[:'page[offset]'] = opts[:'page_offset'] if !opts[:'page_offset'].nil? query_params[:'filter[severity]'] = opts[:'filter_severity'] if !opts[:'filter_severity'].nil? query_params[:'filter[category]'] = opts[:'filter_category'] if !opts[:'filter_category'].nil? query_params[:'filter[issue_type]'] = opts[:'filter_issue_type'] if !opts[:'filter_issue_type'].nil? query_params[:'filter[resource_kind]'] = opts[:'filter_resource_kind'] if !opts[:'filter_resource_kind'].nil? query_params[:'filter[resource_id]'] = opts[:'filter_resource_id'] if !opts[:'filter_resource_id'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'AgentHealthIssuesResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] = opts.merge( :operation => :list_agent_health_issues, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type, :api_version => "V2" ) data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AgentHealthAPI#list_agent_health_issues\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_agent_health_issues_with_pagination(opts = {}) {|AgentHealthIssueData| ... } ⇒ Object
List Agent Health issues.
Provide a paginated version of #list_agent_health_issues, returning all items.
To use it you need to use a block: list_agent_health_issues_with_pagination { |item| p item }
292 293 294 295 296 297 298 299 300 301 302 303 304 |
# File 'lib/datadog_api_client/v2/api/agent_health_api.rb', line 292 def list_agent_health_issues_with_pagination(opts = {}) api_version = "V2" page_size = @api_client.get_attribute_from_path(opts, "page_limit", 100) @api_client.set_attribute_from_path(api_version, opts, "page_limit", Integer, page_size) while true do response = list_agent_health_issues(opts) @api_client.get_attribute_from_path(response, "data").each { |item| yield(item) } if @api_client.get_attribute_from_path(response, "data").length < page_size break end @api_client.set_attribute_from_path(api_version, opts, "page_offset", Integer, @api_client.get_attribute_from_path(opts, "page_offset", 0) + page_size) end end |