diff --git a/.apigentools-info b/.apigentools-info index 702cbbb2aa06..f6ab5768fd19 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-12-11 20:35:37.297873", - "spec_repo_commit": "7b62d196" + "regenerated": "2024-12-12 13:29:22.131222", + "spec_repo_commit": "f0c3c0f4" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-12-11 20:35:37.316642", - "spec_repo_commit": "7b62d196" + "regenerated": "2024-12-12 13:29:22.150037", + "spec_repo_commit": "f0c3c0f4" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index c2b7a7ae0162..643901c6d7fd 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -16012,6 +16012,36 @@ components: - COUNT - RATE - GAUGE + MetricMetaPage: + description: Paging attributes. Only present if pagination query parameters + were provided. + properties: + cursor: + description: The cursor used to get the current results, if any. + nullable: true + type: string + limit: + description: Number of results returned + format: int32 + maximum: 20000 + minimum: 0 + type: integer + next_cursor: + description: The cursor used to get the next results, if any. + nullable: true + type: string + type: + $ref: '#/components/schemas/MetricMetaPageType' + type: object + MetricMetaPageType: + default: cursor_limit + description: Type of metric pagination. + enum: + - cursor_limit + example: cursor_limit + type: string + x-enum-varnames: + - CURSOR_LIMIT MetricMetadata: description: Metadata for the metric. properties: @@ -16094,6 +16124,12 @@ components: maximum: 1000 type: integer type: object + MetricPaginationMeta: + description: Response metadata object. + properties: + pagination: + $ref: '#/components/schemas/MetricMetaPage' + type: object MetricPayload: description: The metrics' payload. properties: @@ -16570,6 +16606,10 @@ components: items: $ref: '#/components/schemas/MetricsAndMetricTagConfigurations' type: array + links: + $ref: '#/components/schemas/MetricsListResponseLinks' + meta: + $ref: '#/components/schemas/MetricPaginationMeta' readOnly: true type: object MetricsDataSource: @@ -16583,6 +16623,29 @@ components: x-enum-varnames: - METRICS - CLOUD_COST + MetricsListResponseLinks: + description: Pagination links. Only present if pagination query parameters were + provided. + properties: + first: + description: Link to the first page. + type: string + last: + description: Link to the last page. + nullable: true + type: string + next: + description: Link to the next page. + nullable: true + type: string + prev: + description: Link to previous page. + nullable: true + type: string + self: + description: Link to current page. + type: string + type: object MetricsScalarQuery: description: An individual scalar metrics query. properties: @@ -35773,7 +35836,12 @@ paths: get: description: "Returns all metrics that can be configured in the Metrics Summary page or with Metrics without Limits\u2122 (matching additional filters if - specified)." + specified).\nOptionally, paginate by using the `page[cursor]` and/or `page[size]` + query parameters.\nTo fetch the first page, pass in a query parameter with + either a valid `page[size]` or an empty cursor like `page[cursor]=`. To fetch + the next page, pass in the `next_cursor` value from the response as the new + `page[cursor]` value.\nOnce the `meta.pagination.next_cursor` value is null, + all pages have been retrieved." operationId: ListTagConfigurations parameters: - description: Filter custom metrics that have configured tags. @@ -35838,6 +35906,27 @@ paths: schema: format: int64 type: integer + - description: Maximum number of results returned. + in: query + name: page[size] + required: false + schema: + default: 10000 + format: int32 + maximum: 10000 + minimum: 1 + type: integer + - description: 'String to query the next page of results. + + This key is provided with each valid response from the API in `meta.pagination.next_cursor`. + + Once the `meta.pagination.next_cursor` key is null, all pages have been + retrieved.' + in: query + name: page[cursor] + required: false + schema: + type: string responses: '200': content: @@ -35871,6 +35960,11 @@ paths: summary: Get a list of metrics tags: - Metrics + x-pagination: + cursorParam: page[cursor] + cursorPath: meta.pagination.next_cursor + limitParam: page[size] + resultsPath: data x-permission: operator: OR permissions: diff --git a/cassettes/features/v2/metrics/Get-a-list-of-metrics-returns-Success-response-with-pagination.frozen b/cassettes/features/v2/metrics/Get-a-list-of-metrics-returns-Success-response-with-pagination.frozen new file mode 100644 index 000000000000..f6dce24ea42e --- /dev/null +++ b/cassettes/features/v2/metrics/Get-a-list-of-metrics-returns-Success-response-with-pagination.frozen @@ -0,0 +1 @@ +2024-12-06T19:12:25.667Z \ No newline at end of file diff --git a/cassettes/features/v2/metrics/Get-a-list-of-metrics-returns-Success-response-with-pagination.yml b/cassettes/features/v2/metrics/Get-a-list-of-metrics-returns-Success-response-with-pagination.yml new file mode 100644 index 000000000000..7bf07523a37f --- /dev/null +++ b/cassettes/features/v2/metrics/Get-a-list-of-metrics-returns-Success-response-with-pagination.yml @@ -0,0 +1,42 @@ +http_interactions: +- recorded_at: Fri, 06 Dec 2024 19:12:25 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/metrics?page%5Bsize%5D=2 + response: + body: + encoding: UTF-8 + string: '{"data":[{"type":"metrics","id":"datadog.event.tracking.indexation.audit.events"},{"type":"metrics","id":"datadog.estimated_usage.events.ingested_events"}],"meta":{"pagination":{"cursor":null,"next_cursor":"6354566d64454633525642695631597759323173616d4d784f5768614d6d52355748704265455a7561453154526b704554315a4f616c5577566b685862456f305455646e6557517a526e6c5752555642526d787355314e756233686c617a56575656526b52465273516c6456526c5a74557a427756574a73525546425155464251554642526c705464316455566b354a5658706e4e574d7863465669565852465657316b576b354962464a566257733156564642516b5a7561453154526b704554315a4f616c5577566b685862456f305455646e6557517a526e6c57525556425155453950546f365a474630595752765a79356c63335270625746305a57526664584e685a3255755a585a6c626e527a4c6d6c755a32567a6447566b583256325a573530637977324c6a67794e7a677a4e3255724d44593d","limit":1,"type":"cursor_limit"}},"links":{"self":"https://api.datadoghq.com/api/v2/metrics?page[size]=1","last":null,"next":"https://api.datadoghq.com/api/v2/metrics?page[cursor]=6354566d64454633525642695631597759323173616d4d784f5768614d6d52355748704265455a7561453154526b704554315a4f616c5577566b685862456f305455646e6557517a526e6c5752555642526d787355314e756233686c617a56575656526b52465273516c6456526c5a74557a427756574a73525546425155464251554642526c705464316455566b354a5658706e4e574d7863465669565852465657316b576b354962464a566257733156564642516b5a7561453154526b704554315a4f616c5577566b685862456f305455646e6557517a526e6c57525556425155453950546f365a474630595752765a79356c63335270625746305a57526664584e685a3255755a585a6c626e527a4c6d6c755a32567a6447566b583256325a573530637977324c6a67794e7a677a4e3255724d44593d","prev":null,"first":"https://api.datadoghq.com/api/v2/metrics?page[size]=1"}} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Fri, 06 Dec 2024 19:12:25 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/metrics?page%5Bsize%5D=2&page%5Bcursor%5D=6354566d64454633525642695631597759323173616d4d784f5768614d6d52355748704265455a7561453154526b704554315a4f616c5577566b685862456f305455646e6557517a526e6c5752555642526d787355314e756233686c617a56575656526b52465273516c6456526c5a74557a427756574a73525546425155464251554642526c705464316455566b354a5658706e4e574d7863465669565852465657316b576b354962464a566257733156564642516b5a7561453154526b704554315a4f616c5577566b685862456f305455646e6557517a526e6c57525556425155453950546f365a474630595752765a79356c63335270625746305a57526664584e685a3255755a585a6c626e527a4c6d6c755a32567a6447566b583256325a573530637977324c6a67794e7a677a4e3255724d44593d + response: + body: + encoding: UTF-8 + string: '{"data":[{"type":"metrics","id":"datadog.estimated_usage.synthetics.api_test_runs"}],"meta":{"pagination":{"cursor":"6354566d64454633525642695631597759323173616d4d784f5768614d6d52355748704265455a7561453154526b704554315a4f616c5577566b685862456f305455646e6557517a526e6c5752555642526d787355314e756233686c617a56575656526b52465273516c6456526c5a74557a427756574a73525546425155464251554642526c705464316455566b354a5658706e4e574d7863465669565852465657316b576b354962464a566257733156564642516b5a7561453154526b704554315a4f616c5577566b685862456f305455646e6557517a526e6c57525556425155453950546f365a474630595752765a79356c63335270625746305a57526664584e685a3255755a585a6c626e527a4c6d6c755a32567a6447566b583256325a573530637977324c6a67794e7a677a4e3255724d44593d","next_cursor":"6354566d64454633525642695631597759323173616d4d784f5768614d6d52355748704265455a7561453154526b704554315a4f616c5577566b685862456f305455646e6557517a526e6c5752555642526d787355314e756233686c617a56575656526b52465273516c6456526c5a74557a427756574a73525546425155464251554642526c705464316455566b354a5658706e4e574d7863465669565852465657316b576b354962464a566257733156564642516b5a7561453154526b704554315a4f616c5577566b685862456f305455646e6557517a526e6c57525556425155453950546f365a474630595752765a79356c63335270625746305a57526664584e685a32557563336c756447686c64476c6a6379356863476c666447567a644639796457357a4c4445754d44417a4e6a4d795a5373774e673d3d","limit":1,"type":"cursor_limit"}},"links":{"self":"https://api.datadoghq.com/api/v2/metrics?page[cursor]=6354566d64454633525642695631597759323173616d4d784f5768614d6d52355748704265455a7561453154526b704554315a4f616c5577566b685862456f305455646e6557517a526e6c5752555642526d787355314e756233686c617a56575656526b52465273516c6456526c5a74557a427756574a73525546425155464251554642526c705464316455566b354a5658706e4e574d7863465669565852465657316b576b354962464a566257733156564642516b5a7561453154526b704554315a4f616c5577566b685862456f305455646e6557517a526e6c57525556425155453950546f365a474630595752765a79356c63335270625746305a57526664584e685a3255755a585a6c626e527a4c6d6c755a32567a6447566b583256325a573530637977324c6a67794e7a677a4e3255724d44593d&page[size]=1","last":null,"next":"https://api.datadoghq.com/api/v2/metrics?page[cursor]=6354566d64454633525642695631597759323173616d4d784f5768614d6d52355748704265455a7561453154526b704554315a4f616c5577566b685862456f305455646e6557517a526e6c5752555642526d787355314e756233686c617a56575656526b52465273516c6456526c5a74557a427756574a73525546425155464251554642526c705464316455566b354a5658706e4e574d7863465669565852465657316b576b354962464a566257733156564642516b5a7561453154526b704554315a4f616c5577566b685862456f305455646e6557517a526e6c57525556425155453950546f365a474630595752765a79356c63335270625746305a57526664584e685a32557563336c756447686c64476c6a6379356863476c666447567a644639796457357a4c4445754d44417a4e6a4d795a5373774e673d3d","prev":null,"first":"https://api.datadoghq.com/api/v2/metrics?page[size]=1"}} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/examples/v2/metrics/ListTagConfigurations_3969783727.rb b/examples/v2/metrics/ListTagConfigurations_3969783727.rb new file mode 100644 index 000000000000..ba7971b60551 --- /dev/null +++ b/examples/v2/metrics/ListTagConfigurations_3969783727.rb @@ -0,0 +1,8 @@ +# Get a list of metrics returns "Success" response with pagination + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::MetricsAPI.new +opts = { + page_size: 2, +} +api_instance.list_tag_configurations_with_pagination(opts) { |item| puts item } diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 52e7dc71b28a..f286bd178363 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -1582,6 +1582,8 @@ "filter_queried" => "Boolean", "filter_tags" => "String", "window_seconds" => "Integer", + "page_size" => "Integer", + "page_cursor" => "String", }, "v2.DeleteBulkTagsMetricsConfiguration" => { "body" => "MetricBulkTagConfigDeleteRequest", diff --git a/features/v2/metrics.feature b/features/v2/metrics.feature index d98275fb2dee..b69e8dc104c3 100644 --- a/features/v2/metrics.feature +++ b/features/v2/metrics.feature @@ -125,6 +125,15 @@ Feature: Metrics When the request is sent Then the response status is 200 Success + @replay-only @skip-validation @team:DataDog/metrics-experience @with-pagination + Scenario: Get a list of metrics returns "Success" response with pagination + Given a valid "appKeyAuth" key in the system + And new "ListTagConfigurations" request + And request contains "page[size]" parameter with value 2 + When the request with pagination is sent + Then the response status is 200 Success + And the response has 3 items + @team:DataDog/metrics-experience Scenario: Get a list of metrics with a tag filter returns "Success" response Given a valid "appKeyAuth" key in the system diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 92edeca70319..c96a5e6c3f09 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1868,11 +1868,14 @@ def overrides "v2.metric_ingested_indexed_volume_type" => "MetricIngestedIndexedVolumeType", "v2.metric_intake_type" => "MetricIntakeType", "v2.metric_metadata" => "MetricMetadata", + "v2.metric_meta_page" => "MetricMetaPage", + "v2.metric_meta_page_type" => "MetricMetaPageType", "v2.metric_monitor_asset" => "MetricMonitorAsset", "v2.metric_monitor_type" => "MetricMonitorType", "v2.metric_notebook_asset" => "MetricNotebookAsset", "v2.metric_notebook_type" => "MetricNotebookType", "v2.metric_origin" => "MetricOrigin", + "v2.metric_pagination_meta" => "MetricPaginationMeta", "v2.metric_payload" => "MetricPayload", "v2.metric_point" => "MetricPoint", "v2.metric_resource" => "MetricResource", @@ -1881,6 +1884,7 @@ def overrides "v2.metrics_and_metric_tag_configurations_response" => "MetricsAndMetricTagConfigurationsResponse", "v2.metrics_data_source" => "MetricsDataSource", "v2.metric_series" => "MetricSeries", + "v2.metrics_list_response_links" => "MetricsListResponseLinks", "v2.metric_slo_asset" => "MetricSLOAsset", "v2.metric_slo_type" => "MetricSLOType", "v2.metrics_scalar_query" => "MetricsScalarQuery", diff --git a/lib/datadog_api_client/v2/api/metrics_api.rb b/lib/datadog_api_client/v2/api/metrics_api.rb index 59e94cdf0c4d..9f55345ad62b 100644 --- a/lib/datadog_api_client/v2/api/metrics_api.rb +++ b/lib/datadog_api_client/v2/api/metrics_api.rb @@ -603,6 +603,9 @@ def list_tag_configurations(opts = {}) # Get a list of metrics. # # Returns all metrics that can be configured in the Metrics Summary page or with Metrics without Limits™ (matching additional filters if specified). + # Optionally, paginate by using the `page[cursor]` and/or `page[size]` query parameters. + # To fetch the first page, pass in a query parameter with either a valid `page[size]` or an empty cursor like `page[cursor]=`. To fetch the next page, pass in the `next_cursor` value from the response as the new `page[cursor]` value. + # Once the `meta.pagination.next_cursor` value is null, all pages have been retrieved. # # @param opts [Hash] the optional parameters # @option opts [Boolean] :filter_configured Filter custom metrics that have configured tags. @@ -612,6 +615,8 @@ def list_tag_configurations(opts = {}) # @option opts [Boolean] :filter_queried (Beta) Filter custom metrics that have or have not been queried in the specified window[seconds]. If no window is provided or the window is less than 2 hours, a default of 2 hours will be applied. # @option opts [String] :filter_tags Filter metrics that have been submitted with the given tags. Supports boolean and wildcard expressions. Can only be combined with the filter[queried] filter. # @option opts [Integer] :window_seconds The number of seconds of look back (from now) to apply to a filter[tag] or filter[queried] query. Default value is 3600 (1 hour), maximum value is 2,592,000 (30 days). + # @option opts [Integer] :page_size Maximum number of results returned. + # @option opts [String] :page_cursor String to query the next page of results. This key is provided with each valid response from the API in `meta.pagination.next_cursor`. Once the `meta.pagination.next_cursor` key is null, all pages have been retrieved. # @return [Array<(MetricsAndMetricTagConfigurationsResponse, Integer, Hash)>] MetricsAndMetricTagConfigurationsResponse data, response status code and response headers def list_tag_configurations_with_http_info(opts = {}) @@ -622,6 +627,12 @@ def list_tag_configurations_with_http_info(opts = {}) if @api_client.config.client_side_validation && opts[:'filter_metric_type'] && !allowable_values.include?(opts[:'filter_metric_type']) fail ArgumentError, "invalid value for \"filter_metric_type\", must be one of #{allowable_values}" end + if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 10000 + fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling MetricsAPI.list_tag_configurations, must be smaller than or equal to 10000.' + 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 MetricsAPI.list_tag_configurations, must be greater than or equal to 1.' + end # resource path local_var_path = '/api/v2/metrics' @@ -634,6 +645,8 @@ def list_tag_configurations_with_http_info(opts = {}) query_params[:'filter[queried]'] = opts[:'filter_queried'] if !opts[:'filter_queried'].nil? query_params[:'filter[tags]'] = opts[:'filter_tags'] if !opts[:'filter_tags'].nil? query_params[:'window[seconds]'] = opts[:'window_seconds'] if !opts[:'window_seconds'].nil? + query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil? + query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil? # header parameters header_params = opts[:header_params] || {} @@ -670,6 +683,27 @@ def list_tag_configurations_with_http_info(opts = {}) return data, status_code, headers end + # Get a list of metrics. + # + # Provide a paginated version of {#list_tag_configurations}, returning all items. + # + # To use it you need to use a block: list_tag_configurations_with_pagination { |item| p item } + # + # @yield [MetricsAndMetricTagConfigurations] Paginated items + def list_tag_configurations_with_pagination(opts = {}) + api_version = "V2" + page_size = @api_client.get_attribute_from_path(opts, "page_size", 10000) + @api_client.set_attribute_from_path(api_version, opts, "page_size", Integer, page_size) + while true do + response = list_tag_configurations(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_cursor", String, @api_client.get_attribute_from_path(response, "meta.pagination.next_cursor")) + end + end + # List tags by metric name. # # @see #list_tags_by_metric_name_with_http_info diff --git a/lib/datadog_api_client/v2/models/metric_meta_page.rb b/lib/datadog_api_client/v2/models/metric_meta_page.rb new file mode 100644 index 000000000000..51ab5c5d0b33 --- /dev/null +++ b/lib/datadog_api_client/v2/models/metric_meta_page.rb @@ -0,0 +1,166 @@ +=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 + # Paging attributes. Only present if pagination query parameters were provided. + class MetricMetaPage + include BaseGenericModel + + # The cursor used to get the current results, if any. + attr_accessor :cursor + + # Number of results returned + attr_reader :limit + + # The cursor used to get the next results, if any. + attr_accessor :next_cursor + + # Type of metric pagination. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'cursor' => :'cursor', + :'limit' => :'limit', + :'next_cursor' => :'next_cursor', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'cursor' => :'String', + :'limit' => :'Integer', + :'next_cursor' => :'String', + :'type' => :'MetricMetaPageType' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'cursor', + :'next_cursor', + ]) + 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::MetricMetaPage` 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?(:'cursor') + self.cursor = attributes[:'cursor'] + end + + if attributes.key?(:'limit') + self.limit = attributes[:'limit'] + end + + if attributes.key?(:'next_cursor') + self.next_cursor = attributes[:'next_cursor'] + 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 !@limit.nil? && @limit > 20000 + return false if !@limit.nil? && @limit < 0 + true + end + + # Custom attribute writer method with validation + # @param limit [Object] Object to be assigned + # @!visibility private + def limit=(limit) + if !limit.nil? && limit > 20000 + fail ArgumentError, 'invalid value for "limit", must be smaller than or equal to 20000.' + end + if !limit.nil? && limit < 0 + fail ArgumentError, 'invalid value for "limit", must be greater than or equal to 0.' + end + @limit = limit + 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 && + cursor == o.cursor && + limit == o.limit && + next_cursor == o.next_cursor && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [cursor, limit, next_cursor, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/metric_meta_page_type.rb b/lib/datadog_api_client/v2/models/metric_meta_page_type.rb new file mode 100644 index 000000000000..f41974dbae31 --- /dev/null +++ b/lib/datadog_api_client/v2/models/metric_meta_page_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 + # Type of metric pagination. + class MetricMetaPageType + include BaseEnumModel + + CURSOR_LIMIT = "cursor_limit".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/metric_pagination_meta.rb b/lib/datadog_api_client/v2/models/metric_pagination_meta.rb new file mode 100644 index 000000000000..608c9df74b6b --- /dev/null +++ b/lib/datadog_api_client/v2/models/metric_pagination_meta.rb @@ -0,0 +1,105 @@ +=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 metadata object. + class MetricPaginationMeta + include BaseGenericModel + + # Paging attributes. Only present if pagination query parameters were provided. + attr_accessor :pagination + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'pagination' => :'pagination' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'pagination' => :'MetricMetaPage' + } + 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::MetricPaginationMeta` 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?(:'pagination') + self.pagination = attributes[:'pagination'] + end + 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 && + pagination == o.pagination && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [pagination, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/metrics_and_metric_tag_configurations_response.rb b/lib/datadog_api_client/v2/models/metrics_and_metric_tag_configurations_response.rb index 33857b629394..8dbb2fb87161 100644 --- a/lib/datadog_api_client/v2/models/metrics_and_metric_tag_configurations_response.rb +++ b/lib/datadog_api_client/v2/models/metrics_and_metric_tag_configurations_response.rb @@ -24,13 +24,21 @@ class MetricsAndMetricTagConfigurationsResponse # Array of metrics and metric tag configurations. attr_accessor :data + # Pagination links. Only present if pagination query parameters were provided. + attr_accessor :links + + # Response metadata object. + attr_accessor :meta + attr_accessor :additional_properties # Attribute mapping from ruby-style variable name to JSON key. # @!visibility private def self.attribute_map { - :'data' => :'data' + :'data' => :'data', + :'links' => :'links', + :'meta' => :'meta' } end @@ -38,7 +46,9 @@ def self.attribute_map # @!visibility private def self.openapi_types { - :'data' => :'Array' + :'data' => :'Array', + :'links' => :'MetricsListResponseLinks', + :'meta' => :'MetricPaginationMeta' } end @@ -65,6 +75,14 @@ def initialize(attributes = {}) self.data = value end end + + if attributes.key?(:'links') + self.links = attributes[:'links'] + end + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + end end # Returns the object in the form of hash, with additionalProperties support. @@ -94,6 +112,8 @@ def ==(o) return true if self.equal?(o) self.class == o.class && data == o.data && + links == o.links && + meta == o.meta && additional_properties == o.additional_properties end @@ -101,7 +121,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [data, additional_properties].hash + [data, links, meta, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/metrics_list_response_links.rb b/lib/datadog_api_client/v2/models/metrics_list_response_links.rb new file mode 100644 index 000000000000..994905bfb7a4 --- /dev/null +++ b/lib/datadog_api_client/v2/models/metrics_list_response_links.rb @@ -0,0 +1,155 @@ +=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. Only present if pagination query parameters were provided. + class MetricsListResponseLinks + include BaseGenericModel + + # Link to the first page. + attr_accessor :first + + # Link to the last page. + attr_accessor :last + + # Link to the next page. + attr_accessor :_next + + # Link to previous page. + attr_accessor :prev + + # Link to current page. + attr_accessor :_self + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'first' => :'first', + :'last' => :'last', + :'_next' => :'next', + :'prev' => :'prev', + :'_self' => :'self' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'first' => :'String', + :'last' => :'String', + :'_next' => :'String', + :'prev' => :'String', + :'_self' => :'String' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'last', + :'_next', + :'prev', + ]) + 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::MetricsListResponseLinks` 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?(:'last') + self.last = attributes[:'last'] + end + + if attributes.key?(:'_next') + self._next = attributes[:'_next'] + end + + if attributes.key?(:'prev') + self.prev = attributes[:'prev'] + end + + if attributes.key?(:'_self') + self._self = attributes[:'_self'] + end + 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 && + last == o.last && + _next == o._next && + prev == o.prev && + _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, last, _next, prev, _self, additional_properties].hash + end + end +end