diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index c554255f1343..2d9b7ddd3529 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -43548,6 +43548,51 @@ components: example: "/api/v2/catalog/relation?filter[from_ref]=service:service-catalog&include=entity&page[limit]=2&page[offset]=0" type: string type: object + ListRowsResponse: + description: Paginated list of reference table rows. + example: + data: + - attributes: + values: + category: tor + intention: suspicious + ip_address: 102.130.113.9 + id: 102.130.113.9 + type: row + links: + first: "/api/v2/reference-tables/tables/00000000-0000-0000-0000-000000000000/rows/list?page%5Blimit%5D=100" + self: "/api/v2/reference-tables/tables/00000000-0000-0000-0000-000000000000/rows/list?page%5Bcontinuation_token%5D=eyJzaWQiOjEyMzQ1LCJwayI6ImV4YW1wbGVfcGsifQ%3D%3D&page%5Blimit%5D=100" + properties: + data: + description: The rows. + items: + $ref: "#/components/schemas/TableRowResourceData" + type: array + links: + $ref: "#/components/schemas/ListRowsResponseLinks" + required: + - data + - links + type: object + ListRowsResponseLinks: + description: Pagination links for the list rows response. + properties: + first: + description: Link to the first page of results. + example: "/api/v2/reference-tables/tables/00000000-0000-0000-0000-000000000000/rows/list?page%5Blimit%5D=100" + type: string + next: + description: Link to the next page of results. Only present when more rows are available. + example: "/api/v2/reference-tables/tables/00000000-0000-0000-0000-000000000000/rows/list?page%5Bcontinuation_token%5D=eyJzaWQiOjEyMzQ1LCJwayI6ImV4YW1wbGVfcGsifQ%3D%3D&page%5Blimit%5D=100" + type: string + self: + description: Link to the current page of results. + example: "/api/v2/reference-tables/tables/00000000-0000-0000-0000-000000000000/rows/list?page%5Bcontinuation_token%5D=eyJzaWQiOjEyMzQ1LCJwayI6ImV4YW1wbGVfcGsifQ%3D%3D&page%5Blimit%5D=100" + type: string + required: + - self + - first + type: object ListRulesResponse: description: Scorecard rules response. properties: @@ -127568,6 +127613,73 @@ paths: summary: Upsert rows tags: - Reference Tables + /api/v2/reference-tables/tables/{id}/rows/list: + get: + description: List all rows in a reference table using cursor-based pagination. Pass the `page[continuation_token]` from the previous response to fetch the next page on the same consistent snapshot. Returns 400 for tables with more than 10,000,000 rows. + operationId: ListReferenceTableRows + parameters: + - description: Unique identifier of the reference table to list rows from. + example: "00000000-0000-0000-0000-000000000000" + in: path + name: id + required: true + schema: + type: string + - description: Number of rows to return per page. Defaults to 100, maximum is 1000. + example: 100 + in: query + name: page[limit] + required: false + schema: + default: 100 + format: int64 + maximum: 1000 + minimum: 1 + type: integer + - description: Opaque cursor from the previous response's next link. Pass this to retrieve the next page on the same consistent snapshot. + example: "eyJzaWQiOjEyMzQ1LCJwayI6ImV4YW1wbGVfcGsifQ==" + in: query + name: page[continuation_token] + required: false + schema: + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + values: + category: tor + intention: suspicious + ip_address: 102.130.113.9 + id: 102.130.113.9 + type: row + links: + first: "/api/v2/reference-tables/tables/00000000-0000-0000-0000-000000000000/rows/list?page%5Blimit%5D=100" + next: "/api/v2/reference-tables/tables/00000000-0000-0000-0000-000000000000/rows/list?page%5Bcontinuation_token%5D=eyJzaWQiOjY5NzA0ODkwNDE4ODA3MTAzOTgsInBrIjoiMTAyLjEzMC4xMjcuMTE3In0%3D&page%5Blimit%5D=100" + self: "/api/v2/reference-tables/tables/00000000-0000-0000-0000-000000000000/rows/list?page%5Bcontinuation_token%5D=eyJzaWQiOjEyMzQ1LCJwayI6ImV4YW1wbGVfcGsifQ%3D%3D&page%5Blimit%5D=100" + schema: + $ref: "#/components/schemas/ListRowsResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: List rows + tags: + - Reference Tables /api/v2/reference-tables/uploads: post: description: Create a reference table upload for bulk data ingestion diff --git a/cassettes/features/v2/reference_tables/List-reference-table-rows-returns-Bad-Request-response-for-invalid-limit.frozen b/cassettes/features/v2/reference_tables/List-reference-table-rows-returns-Bad-Request-response-for-invalid-limit.frozen new file mode 100644 index 000000000000..84c1983149ea --- /dev/null +++ b/cassettes/features/v2/reference_tables/List-reference-table-rows-returns-Bad-Request-response-for-invalid-limit.frozen @@ -0,0 +1 @@ +2026-05-15T19:32:21.293Z \ No newline at end of file diff --git a/cassettes/features/v2/reference_tables/List-reference-table-rows-returns-Bad-Request-response-for-invalid-limit.yml b/cassettes/features/v2/reference_tables/List-reference-table-rows-returns-Bad-Request-response-for-invalid-limit.yml new file mode 100644 index 000000000000..3d715c914725 --- /dev/null +++ b/cassettes/features/v2/reference_tables/List-reference-table-rows-returns-Bad-Request-response-for-invalid-limit.yml @@ -0,0 +1,21 @@ +http_interactions: +- recorded_at: Fri, 15 May 2026 19:32:21 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/reference-tables/tables/not-a-valid-uuid/rows/list + response: + body: + encoding: UTF-8 + string: '{"errors":[{"title":"Generic Error","detail":"table ID must be a valid + UUID format"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 400 + message: Bad Request +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/reference_tables/List-reference-table-rows-returns-Not-Found-response.frozen b/cassettes/features/v2/reference_tables/List-reference-table-rows-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..58c81afc5ec5 --- /dev/null +++ b/cassettes/features/v2/reference_tables/List-reference-table-rows-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2026-05-15T19:32:23.068Z \ No newline at end of file diff --git a/cassettes/features/v2/reference_tables/List-reference-table-rows-returns-Not-Found-response.yml b/cassettes/features/v2/reference_tables/List-reference-table-rows-returns-Not-Found-response.yml new file mode 100644 index 000000000000..c711c8ca53df --- /dev/null +++ b/cassettes/features/v2/reference_tables/List-reference-table-rows-returns-Not-Found-response.yml @@ -0,0 +1,21 @@ +http_interactions: +- recorded_at: Fri, 15 May 2026 19:32:23 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/reference-tables/tables/00000000-0000-0000-0000-000000000000/rows/list + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"404","title":"Not Found","detail":"table not + found"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/examples/v2/reference-tables/ListReferenceTableRows.rb b/examples/v2/reference-tables/ListReferenceTableRows.rb new file mode 100644 index 000000000000..c07ce192e480 --- /dev/null +++ b/examples/v2/reference-tables/ListReferenceTableRows.rb @@ -0,0 +1,5 @@ +# List rows returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::ReferenceTablesAPI.new +p api_instance.list_reference_table_rows("id") diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 6e10b197f4fe..89948217ee9a 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -3855,6 +3855,11 @@ "id" => "String", "body" => "BatchUpsertRowsRequestArray", }, + "v2.ListReferenceTableRows" => { + "id" => "String", + "page_limit" => "Integer", + "page_continuation_token" => "String", + }, "v2.CreateReferenceTableUpload" => { "body" => "CreateUploadRequest", }, diff --git a/features/v2/reference_tables.feature b/features/v2/reference_tables.feature index 0ba8738c6b9f..859f70c13ec0 100644 --- a/features/v2/reference_tables.feature +++ b/features/v2/reference_tables.feature @@ -142,6 +142,41 @@ Feature: Reference Tables When the request is sent Then the response status is 200 OK + @team:DataDog/redapl-experiences + Scenario: List reference table rows returns "Bad Request" response for invalid limit + Given new "ListReferenceTableRows" request + And request contains "id" parameter with value "not-a-valid-uuid" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/redapl-experiences + Scenario: List reference table rows returns "Not Found" response + Given new "ListReferenceTableRows" request + And request contains "id" parameter with value "00000000-0000-0000-0000-000000000000" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/redapl-experiences + Scenario: List rows returns "Bad Request" response + Given new "ListReferenceTableRows" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/redapl-experiences + Scenario: List rows returns "Not Found" response + Given new "ListReferenceTableRows" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/redapl-experiences + Scenario: List rows returns "OK" response + Given new "ListReferenceTableRows" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @skip @team:DataDog/redapl-experiences Scenario: List tables returns "OK" response Given new "ListTables" request diff --git a/features/v2/undo.json b/features/v2/undo.json index faa660d7de0b..5a00daefda6f 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -4820,6 +4820,12 @@ "type": "unsafe" } }, + "ListReferenceTableRows": { + "tag": "Reference Tables", + "undo": { + "type": "safe" + } + }, "CreateReferenceTableUpload": { "tag": "Reference Tables", "undo": { diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index ffb9b3c3429a..189241a5f3c7 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -3573,6 +3573,8 @@ def overrides "v2.list_powerpacks_response" => "ListPowerpacksResponse", "v2.list_relation_catalog_response" => "ListRelationCatalogResponse", "v2.list_relation_catalog_response_links" => "ListRelationCatalogResponseLinks", + "v2.list_rows_response" => "ListRowsResponse", + "v2.list_rows_response_links" => "ListRowsResponseLinks", "v2.list_rules_response" => "ListRulesResponse", "v2.list_rules_response_data_item" => "ListRulesResponseDataItem", "v2.list_rules_response_links" => "ListRulesResponseLinks", diff --git a/lib/datadog_api_client/v2/api/reference_tables_api.rb b/lib/datadog_api_client/v2/api/reference_tables_api.rb index 97df6f86556e..c0d8f3abfda6 100644 --- a/lib/datadog_api_client/v2/api/reference_tables_api.rb +++ b/lib/datadog_api_client/v2/api/reference_tables_api.rb @@ -502,6 +502,81 @@ def get_table_with_http_info(id, opts = {}) return data, status_code, headers end + # List rows. + # + # @see #list_reference_table_rows_with_http_info + def list_reference_table_rows(id, opts = {}) + data, _status_code, _headers = list_reference_table_rows_with_http_info(id, opts) + data + end + + # List rows. + # + # List all rows in a reference table using cursor-based pagination. Pass the `page[continuation_token]` from the previous response to fetch the next page on the same consistent snapshot. Returns 400 for tables with more than 10,000,000 rows. + # + # @param id [String] Unique identifier of the reference table to list rows from. + # @param opts [Hash] the optional parameters + # @option opts [Integer] :page_limit Number of rows to return per page. Defaults to 100, maximum is 1000. + # @option opts [String] :page_continuation_token Opaque cursor from the previous response's next link. Pass this to retrieve the next page on the same consistent snapshot. + # @return [Array<(ListRowsResponse, Integer, Hash)>] ListRowsResponse data, response status code and response headers + def list_reference_table_rows_with_http_info(id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ReferenceTablesAPI.list_reference_table_rows ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling ReferenceTablesAPI.list_reference_table_rows" + 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 ReferenceTablesAPI.list_reference_table_rows, 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 ReferenceTablesAPI.list_reference_table_rows, must be greater than or equal to 1.' + end + # resource path + local_var_path = '/api/v2/reference-tables/tables/{id}/rows/list'.sub('{id}', CGI.escape(id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page[limit]'] = opts[:'page_limit'] if !opts[:'page_limit'].nil? + query_params[:'page[continuation_token]'] = opts[:'page_continuation_token'] if !opts[:'page_continuation_token'].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] || 'ListRowsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :list_reference_table_rows, + :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: ReferenceTablesAPI#list_reference_table_rows\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # List tables. # # @see #list_tables_with_http_info diff --git a/lib/datadog_api_client/v2/models/list_rows_response.rb b/lib/datadog_api_client/v2/models/list_rows_response.rb new file mode 100644 index 000000000000..83d562f457f8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/list_rows_response.rb @@ -0,0 +1,146 @@ +=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 + # Paginated list of reference table rows. + class ListRowsResponse + include BaseGenericModel + + # The rows. + attr_reader :data + + # Pagination links for the list rows response. + attr_reader :links + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'links' => :'links' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array', + :'links' => :'ListRowsResponseLinks' + } + 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::ListRowsResponse` 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') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + + if attributes.key?(:'links') + self.links = attributes[:'links'] + 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? + return false if @links.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 + + # Custom attribute writer method with validation + # @param links [Object] Object to be assigned + # @!visibility private + def links=(links) + if links.nil? + fail ArgumentError, 'invalid value for "links", links cannot be nil.' + end + @links = links + 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 && + links == o.links && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, links, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/list_rows_response_links.rb b/lib/datadog_api_client/v2/models/list_rows_response_links.rb new file mode 100644 index 000000000000..d79c72a4504c --- /dev/null +++ b/lib/datadog_api_client/v2/models/list_rows_response_links.rb @@ -0,0 +1,154 @@ +=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 + # Pagination links for the list rows response. + class ListRowsResponseLinks + include BaseGenericModel + + # Link to the first page of results. + attr_reader :first + + # Link to the next page of results. Only present when more rows are available. + attr_accessor :_next + + # Link to the current page of results. + attr_reader :_self + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'first' => :'first', + :'_next' => :'next', + :'_self' => :'self' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'first' => :'String', + :'_next' => :'String', + :'_self' => :'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::ListRowsResponseLinks` 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?(:'first') + self.first = attributes[:'first'] + end + + if attributes.key?(:'_next') + self._next = attributes[:'_next'] + end + + if attributes.key?(:'_self') + self._self = attributes[:'_self'] + 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 @first.nil? + return false if @_self.nil? + true + end + + # Custom attribute writer method with validation + # @param first [Object] Object to be assigned + # @!visibility private + def first=(first) + if first.nil? + fail ArgumentError, 'invalid value for "first", first cannot be nil.' + end + @first = first + end + + # Custom attribute writer method with validation + # @param _self [Object] Object to be assigned + # @!visibility private + def _self=(_self) + if _self.nil? + fail ArgumentError, 'invalid value for "_self", _self cannot be nil.' + end + @_self = _self + 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 && + first == o.first && + _next == o._next && + _self == o._self && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [first, _next, _self, additional_properties].hash + end + end +end