Class: DatadogAPIClient::V2::AgentHealthAPI

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog_api_client/v2/api/agent_health_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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. Only open issues are returned. The remediation attribute is omitted when the issue has no remediation.

Returns 404 if the issue does not exist, is not open, 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.

Parameters:

  • issue_id (String) —

    The unique identifier of the issue. It can contain : and must be percent-encoded by clients when included in the path.

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Returns:

  • (Array<(AgentHealthIssueResponse, Integer, Hash)>) —

    AgentHealthIssueResponse data, response status code and response headers



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
95
96
97
98
99
100
101
# File 'lib/datadog_api_client/v2/api/agent_health_api.rb', line 47

def get_agent_health_issue_with_http_info(issue_id, opts = {})
  unstable_enabled = @api_client.config.unstable_operations["v2.get_agent_health_issue".to_sym]
  if unstable_enabled
    @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_agent_health_issue")
  else
    raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_agent_health_issue"))
  end

  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]

  new_options = 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, new_options)
  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.



106
107
108
109
# File 'lib/datadog_api_client/v2/api/agent_health_api.rb', line 106

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.

Parameters:

  • resource_id (String) —

    Resource identifier whose active Agent Health issues should be returned: a DaemonSet UID for a node Agent or a cluster UUID for a Cluster Agent.

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Options Hash (opts):

  • :agent_type (AgentHealthAgentType) —

    Agent type associated with the resource. Defaults to node when omitted.

Returns:



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
166
167
168
169
170
171
172
# File 'lib/datadog_api_client/v2/api/agent_health_api.rb', line 119

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]

  new_options = 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, new_options)
  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.



177
178
179
180
# File 'lib/datadog_api_client/v2/api/agent_health_api.rb', line 177

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 Agent Health issues across your organization. Only open issues are returned. Returns 403 if you lack the hosts_read permission.

Results 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. Use page[size] and the zero-based page[number] to paginate. Invalid page values return a 400 JSON:API error response. meta.page.total_filtered_count is the number of issues matching the filters, and meta.page.total_count the number of open issues in the organization.

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.

Parameters:

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Options Hash (opts):

  • :page_size (Integer) —

    The number of issues to return per page, from 1 to 100. Defaults to 25.

  • :page_number (Integer) —

    The zero-based page number, from 0 to 1000000. Defaults to 0.

  • :filter_severity (String) —

    Filter by a comma-separated list of exact severity values, up to 50 values of at most 256 characters each. Values are combined with OR within this filter and AND across filters. Blank entries are ignored; an all-blank filter is treated as absent.

  • :filter_category (String) —

    Filter by a comma-separated list of exact category values, up to 50 values of at most 256 characters each. Values are combined with OR within this filter and AND across filters. Blank entries are ignored; an all-blank filter is treated as absent.

  • :filter_issue_type (String) —

    Filter by a comma-separated list of exact issue_type values, up to 50 values of at most 256 characters each. Values are combined with OR within this filter and AND across filters. Blank entries are ignored; an all-blank filter is treated as absent.

  • :filter_resource_kind (String) —

    Filter by a comma-separated list of exact resource_kind values, up to 50 values of at most 256 characters each. Values are combined with OR within this filter and AND across filters. Blank entries are ignored; an all-blank filter is treated as absent.

  • :filter_resource_id (String) —

    Filter by a comma-separated list of exact resource_id values, up to 50 values of at most 256 characters each. Values are combined with OR within this filter and AND across filters. Blank entries are ignored; an all-blank filter is treated as absent.

Returns:

  • (Array<(AgentHealthIssuesResponse, Integer, Hash)>) —

    AgentHealthIssuesResponse data, response status code and response headers



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
284
285
286
287
288
289
290
291
# File 'lib/datadog_api_client/v2/api/agent_health_api.rb', line 207

def list_agent_health_issues_with_http_info(opts = {})
  unstable_enabled = @api_client.config.unstable_operations["v2.list_agent_health_issues".to_sym]
  if unstable_enabled
    @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_agent_health_issues")
  else
    raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_agent_health_issues"))
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AgentHealthAPI.list_agent_health_issues ...'
  end
  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling AgentHealthAPI.list_agent_health_issues, must be smaller than or equal to 100.'
  end
  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" 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_number'].nil? && opts[:'page_number'] > 1000000
    fail ArgumentError, 'invalid value for "opts[:"page_number"]" when calling AgentHealthAPI.list_agent_health_issues, must be smaller than or equal to 1000000.'
  end
  if @api_client.config.client_side_validation && !opts[:'page_number'].nil? && opts[:'page_number'] < 0
    fail ArgumentError, 'invalid value for "opts[:"page_number"]" 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[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil?
  query_params[:'page[number]'] = opts[:'page_number'] if !opts[:'page_number'].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]

  new_options = 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, new_options)
  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