diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 04454bdda2d4..1ea0da0c9bc8 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -4969,6 +4969,91 @@ components: - id - base_severity type: object + AgentHealthAgentType: + default: node + description: Agent type associated with the resource. + enum: + - node + - cluster + example: node + type: string + x-enum-varnames: + - NODE + - CLUSTER + AgentHealthHostIssue: + description: An active Agent Health issue associated with a resource. + properties: + category: + description: The category used by the Agent to group and reconcile the issue. + example: configuration + type: string + issue_id: + description: The unique identifier of the issue. + example: invalid-config:4828e7d6c704c4a3 + type: string + issue_name: + description: The human-readable name of the issue. + example: Invalid Config + type: string + issue_type: + description: The machine-readable type of the issue. + example: invalid_config + type: string + required: + - issue_id + - issue_name + - issue_type + - category + type: object + AgentHealthHostIssuesAttributes: + description: Active Agent Health issues for a resource. + properties: + issues: + description: The active issues and their reconciliation metadata. + example: + - category: configuration + issue_id: invalid-config:4828e7d6c704c4a3 + issue_name: Invalid Config + issue_type: invalid_config + items: + $ref: "#/components/schemas/AgentHealthHostIssue" + type: array + required: + - issues + type: object + AgentHealthHostIssuesData: + description: Agent Health issue data for a resource. + properties: + attributes: + $ref: "#/components/schemas/AgentHealthHostIssuesAttributes" + id: + description: The resource identifier. + example: 123e4567-e89b-12d3-a456-426614174000 + type: string + type: + $ref: "#/components/schemas/AgentHealthHostIssuesType" + required: + - id + - type + - attributes + type: object + AgentHealthHostIssuesResponse: + description: Response containing the active Agent Health issues for a resource. + properties: + data: + $ref: "#/components/schemas/AgentHealthHostIssuesData" + required: + - data + type: object + AgentHealthHostIssuesType: + default: agent_health_issues + description: The Agent Health issue resource type. + enum: + - agent_health_issues + example: agent_health_issues + type: string + x-enum-varnames: + - AGENT_HEALTH_ISSUES AgentTrigger: description: "Trigger a workflow from an agent via the MCP execute tool. Workflow can be executed from Bits Chat, Bits Agent Builder, Claude Code, Codex, Cursor, and any other coding agent using the Datadog MCP." properties: @@ -144008,6 +144093,56 @@ paths: x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/agenthealth/hosts/{resource_id}/issues: + get: + description: Returns the active Agent Health issues for a node Agent or Cluster Agent resource. + operationId: ListAgentHealthHostIssues + parameters: + - description: >- + 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. + example: 123e4567-e89b-12d3-a456-426614174000 + in: path + name: resource_id + required: true + schema: + type: string + - description: Agent type associated with the resource. Defaults to `node` when omitted. + example: node + in: query + name: agent_type + required: false + schema: + $ref: "#/components/schemas/AgentHealthAgentType" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + issues: + - category: configuration + issue_id: invalid-config:4828e7d6c704c4a3 + issue_name: Invalid Config + issue_type: invalid_config + id: 123e4567-e89b-12d3-a456-426614174000 + type: agent_health_issues + schema: + $ref: "#/components/schemas/AgentHealthHostIssuesResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + summary: List active Agent Health issues + tags: + - Agent Health /api/v2/agentless_scanning/accounts/aws: get: description: Fetches the scan options configured for AWS accounts. @@ -250883,6 +251018,8 @@ tags: externalDocs: url: https://docs.datadoghq.com/actions/datastore name: Actions Datastores + - description: View Agent Health issues reported for node Agents and Cluster Agents. + name: Agent Health - description: >- Manage Agent Observability spans, data, projects, datasets, dataset records, experiments, prompts, and annotations. name: Agent Observability diff --git a/examples/v2/agent-health/ListAgentHealthHostIssues.rb b/examples/v2/agent-health/ListAgentHealthHostIssues.rb new file mode 100644 index 000000000000..994c9a6da9f7 --- /dev/null +++ b/examples/v2/agent-health/ListAgentHealthHostIssues.rb @@ -0,0 +1,8 @@ +# List active Agent Health issues returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::AgentHealthAPI.new +opts = { + agent_type: AgentHealthAgentType::NODE, +} +p api_instance.list_agent_health_host_issues("123e4567-e89b-12d3-a456-426614174000", opts) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 0085a39ed1b9..909a86668014 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -1291,6 +1291,10 @@ "policy_id" => "String", "body" => "ExecutionPolicyUpdateRequest", }, + "v2.ListAgentHealthHostIssues" => { + "resource_id" => "String", + "agent_type" => "AgentHealthAgentType", + }, "v2.CreateAwsScanOptions" => { "body" => "AwsScanOptionsCreateRequest", }, diff --git a/features/v2/agent_health.feature b/features/v2/agent_health.feature new file mode 100644 index 000000000000..0e0dc268c74e --- /dev/null +++ b/features/v2/agent_health.feature @@ -0,0 +1,21 @@ +@endpoint(agent-health) @endpoint(agent-health-v2) +Feature: Agent Health + View Agent Health issues reported for node Agents and Cluster Agents. + + Background: + Given a valid "apiKeyAuth" key in the system + And an instance of "AgentHealth" API + And new "ListAgentHealthHostIssues" request + And request contains "resource_id" parameter with value "123e4567-e89b-12d3-a456-426614174000" + + @skip @team:ddoghq/fleet-remediation + Scenario: List active Agent Health issues returns "Bad Request" response + Given request contains "agent_type" parameter with value "process" + When the request is sent + Then the response status is 400 Bad Request + + @skip @team:ddoghq/fleet-remediation + Scenario: List active Agent Health issues returns "OK" response + Given request contains "agent_type" parameter with value "node" + When the request is sent + Then the response status is 200 OK diff --git a/features/v2/undo.json b/features/v2/undo.json index 44429f978f81..1e95b2e53fba 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -239,6 +239,12 @@ "type": "idempotent" } }, + "ListAgentHealthHostIssues": { + "tag": "Agent Health", + "undo": { + "type": "safe" + } + }, "ListAwsScanOptions": { "tag": "Agentless Scanning", "undo": { diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 50d49c111df5..565481beb4c3 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1255,6 +1255,12 @@ def overrides "v2.active_billing_dimensions_type" => "ActiveBillingDimensionsType", "v2.add_member_team_request" => "AddMemberTeamRequest", "v2.advisory" => "Advisory", + "v2.agent_health_agent_type" => "AgentHealthAgentType", + "v2.agent_health_host_issue" => "AgentHealthHostIssue", + "v2.agent_health_host_issues_attributes" => "AgentHealthHostIssuesAttributes", + "v2.agent_health_host_issues_data" => "AgentHealthHostIssuesData", + "v2.agent_health_host_issues_response" => "AgentHealthHostIssuesResponse", + "v2.agent_health_host_issues_type" => "AgentHealthHostIssuesType", "v2.agent_trigger" => "AgentTrigger", "v2.agent_trigger_wrapper" => "AgentTriggerWrapper", "v2.aggregated_long_tasks_by_invoker_type" => "AggregatedLongTasksByInvokerType", @@ -9715,6 +9721,7 @@ def overrides "v1.webhooks_integration_api" => "WebhooksIntegrationAPI", "v2.action_connection_api" => "ActionConnectionAPI", "v2.actions_datastores_api" => "ActionsDatastoresAPI", + "v2.agent_health_api" => "AgentHealthAPI", "v2.agent_observability_api" => "AgentObservabilityAPI", "v2.agentless_scanning_api" => "AgentlessScanningAPI", "v2.annotations_api" => "AnnotationsAPI", diff --git a/lib/datadog_api_client/v2/api/agent_health_api.rb b/lib/datadog_api_client/v2/api/agent_health_api.rb new file mode 100644 index 000000000000..f78602dba5a1 --- /dev/null +++ b/lib/datadog_api_client/v2/api/agent_health_api.rb @@ -0,0 +1,97 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'cgi' + +module DatadogAPIClient::V2 + class AgentHealthAPI + attr_accessor :api_client + + def initialize(api_client = DatadogAPIClient::APIClient.default) + @api_client = api_client + end + + # List active Agent Health issues. + # + # @see #list_agent_health_host_issues_with_http_info + 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 active Agent Health issues. + # + # Returns the active Agent Health issues for a node Agent or Cluster Agent resource. + # + # @param 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. + # @param opts [Hash] the optional parameters + # @option opts [AgentHealthAgentType] :agent_type Agent type associated with the resource. Defaults to `node` when omitted. + # @return [Array<(AgentHealthHostIssuesResponse, Integer, Hash)>] AgentHealthHostIssuesResponse data, response status code and response headers + 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 + end +end diff --git a/lib/datadog_api_client/v2/models/agent_health_agent_type.rb b/lib/datadog_api_client/v2/models/agent_health_agent_type.rb new file mode 100644 index 000000000000..5df3caa20211 --- /dev/null +++ b/lib/datadog_api_client/v2/models/agent_health_agent_type.rb @@ -0,0 +1,27 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Agent type associated with the resource. + class AgentHealthAgentType + include BaseEnumModel + + NODE = "node".freeze + CLUSTER = "cluster".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/agent_health_host_issue.rb b/lib/datadog_api_client/v2/models/agent_health_host_issue.rb new file mode 100644 index 000000000000..de15bf7b5a71 --- /dev/null +++ b/lib/datadog_api_client/v2/models/agent_health_host_issue.rb @@ -0,0 +1,186 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # An active Agent Health issue associated with a resource. + class AgentHealthHostIssue + include BaseGenericModel + + # The category used by the Agent to group and reconcile the issue. + attr_reader :category + + # The unique identifier of the issue. + attr_reader :issue_id + + # The human-readable name of the issue. + attr_reader :issue_name + + # The machine-readable type of the issue. + attr_reader :issue_type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'category' => :'category', + :'issue_id' => :'issue_id', + :'issue_name' => :'issue_name', + :'issue_type' => :'issue_type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'category' => :'String', + :'issue_id' => :'String', + :'issue_name' => :'String', + :'issue_type' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AgentHealthHostIssue` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'issue_id') + self.issue_id = attributes[:'issue_id'] + end + + if attributes.key?(:'issue_name') + self.issue_name = attributes[:'issue_name'] + end + + if attributes.key?(:'issue_type') + self.issue_type = attributes[:'issue_type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @category.nil? + return false if @issue_id.nil? + return false if @issue_name.nil? + return false if @issue_type.nil? + true + end + + # Custom attribute writer method with validation + # @param category [Object] Object to be assigned + # @!visibility private + def category=(category) + if category.nil? + fail ArgumentError, 'invalid value for "category", category cannot be nil.' + end + @category = category + end + + # Custom attribute writer method with validation + # @param issue_id [Object] Object to be assigned + # @!visibility private + def issue_id=(issue_id) + if issue_id.nil? + fail ArgumentError, 'invalid value for "issue_id", issue_id cannot be nil.' + end + @issue_id = issue_id + end + + # Custom attribute writer method with validation + # @param issue_name [Object] Object to be assigned + # @!visibility private + def issue_name=(issue_name) + if issue_name.nil? + fail ArgumentError, 'invalid value for "issue_name", issue_name cannot be nil.' + end + @issue_name = issue_name + end + + # Custom attribute writer method with validation + # @param issue_type [Object] Object to be assigned + # @!visibility private + def issue_type=(issue_type) + if issue_type.nil? + fail ArgumentError, 'invalid value for "issue_type", issue_type cannot be nil.' + end + @issue_type = issue_type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + category == o.category && + issue_id == o.issue_id && + issue_name == o.issue_name && + issue_type == o.issue_type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [category, issue_id, issue_name, issue_type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/agent_health_host_issues_attributes.rb b/lib/datadog_api_client/v2/models/agent_health_host_issues_attributes.rb new file mode 100644 index 000000000000..d9da6061df82 --- /dev/null +++ b/lib/datadog_api_client/v2/models/agent_health_host_issues_attributes.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Active Agent Health issues for a resource. + class AgentHealthHostIssuesAttributes + include BaseGenericModel + + # The active issues and their reconciliation metadata. + attr_reader :issues + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'issues' => :'issues' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'issues' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AgentHealthHostIssuesAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'issues') + if (value = attributes[:'issues']).is_a?(Array) + self.issues = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @issues.nil? + true + end + + # Custom attribute writer method with validation + # @param issues [Object] Object to be assigned + # @!visibility private + def issues=(issues) + if issues.nil? + fail ArgumentError, 'invalid value for "issues", issues cannot be nil.' + end + @issues = issues + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + issues == o.issues && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [issues, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/agent_health_host_issues_data.rb b/lib/datadog_api_client/v2/models/agent_health_host_issues_data.rb new file mode 100644 index 000000000000..ddeee4a9786d --- /dev/null +++ b/lib/datadog_api_client/v2/models/agent_health_host_issues_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Agent Health issue data for a resource. + class AgentHealthHostIssuesData + include BaseGenericModel + + # Active Agent Health issues for a resource. + attr_reader :attributes + + # The resource identifier. + attr_reader :id + + # The Agent Health issue resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'AgentHealthHostIssuesAttributes', + :'id' => :'String', + :'type' => :'AgentHealthHostIssuesType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AgentHealthHostIssuesData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/agent_health_host_issues_response.rb b/lib/datadog_api_client/v2/models/agent_health_host_issues_response.rb new file mode 100644 index 000000000000..b15caa187ba5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/agent_health_host_issues_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing the active Agent Health issues for a resource. + class AgentHealthHostIssuesResponse + include BaseGenericModel + + # Agent Health issue data for a resource. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'AgentHealthHostIssuesData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AgentHealthHostIssuesResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/agent_health_host_issues_type.rb b/lib/datadog_api_client/v2/models/agent_health_host_issues_type.rb new file mode 100644 index 000000000000..bbe360439120 --- /dev/null +++ b/lib/datadog_api_client/v2/models/agent_health_host_issues_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The Agent Health issue resource type. + class AgentHealthHostIssuesType + include BaseEnumModel + + AGENT_HEALTH_ISSUES = "agent_health_issues".freeze + end +end