diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 52c5ef104a4d..4ab2ce42720e 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1748,6 +1748,14 @@ components: required: true schema: type: string + TagIndexingRuleId: + description: ID of the tag indexing rule. + example: 00000000-0000-0000-0000-000000000001 + in: path + name: id + required: true + schema: + type: string TagKey: description: The Cloud Cost Management tag key. Tag keys can contain forward slashes (for example, `kubernetes/instance`). in: path @@ -91290,6 +91298,412 @@ components: type: string x-enum-varnames: - TAG + TagIndexingRuleAttributes: + description: Attributes of a tag indexing rule. + properties: + created_at: + description: Timestamp when the rule was created. + example: "2024-01-15T12:00:00.000Z" + format: date-time + readOnly: true + type: string + created_by_handle: + description: Handle of the user who created the rule. + example: user@datadoghq.com + readOnly: true + type: string + exclude_tags_mode: + description: >- + When true, the rule excludes the listed tags and indexes all others. When false (default), the rule includes only the listed tags. + example: false + type: boolean + ignored_metric_name_matches: + description: Metric name prefixes excluded from the rule's scope. + example: + - "dd.test.excluded.*" + items: + type: string + type: array + metric_name_matches: + description: Metric name prefixes (glob patterns) this rule applies to. + example: + - "dd.test.*" + items: + type: string + type: array + modified_at: + description: Timestamp when the rule was last modified. + example: "2024-01-15T12:00:00.000Z" + format: date-time + readOnly: true + type: string + modified_by_handle: + description: Handle of the user who last modified the rule. + example: user@datadoghq.com + readOnly: true + type: string + name: + description: Human-readable name for the rule. + example: my-indexing-rule + type: string + options: + $ref: "#/components/schemas/TagIndexingRuleOptions" + rule_order: + description: >- + Evaluation order within the org. Lower values are evaluated first. Assigned server-side on create (max+1); pass on update to change the rule's position. + example: 1 + format: int64 + readOnly: true + type: integer + tags: + description: Tag keys managed by this rule. + example: + - env + - service + items: + type: string + type: array + type: object + TagIndexingRuleCreateAttributes: + description: Attributes for creating a tag indexing rule. + properties: + exclude_tags_mode: + description: >- + When true, the rule excludes the listed tags and indexes all others. When false (default), the rule includes only the listed tags. + example: false + type: boolean + ignored_metric_name_matches: + description: Metric name prefixes excluded from the rule's scope. + items: + type: string + type: array + metric_name_matches: + description: Metric name prefixes (glob patterns) this rule applies to. + example: + - "dd.test.*" + items: + type: string + type: array + name: + description: Human-readable name for the rule. + example: my-indexing-rule + type: string + options: + $ref: "#/components/schemas/TagIndexingRuleOptions" + tags: + description: Tag keys managed by this rule. + example: + - env + - service + items: + type: string + type: array + required: + - name + - metric_name_matches + type: object + TagIndexingRuleCreateData: + description: Data object for creating a tag indexing rule. + properties: + attributes: + $ref: "#/components/schemas/TagIndexingRuleCreateAttributes" + type: + $ref: "#/components/schemas/TagIndexingRuleType" + required: + - type + - attributes + type: object + TagIndexingRuleCreateRequest: + description: Request body for creating a tag indexing rule. + properties: + data: + $ref: "#/components/schemas/TagIndexingRuleCreateData" + required: + - data + type: object + TagIndexingRuleData: + description: A tag indexing rule resource object. + properties: + attributes: + $ref: "#/components/schemas/TagIndexingRuleAttributes" + id: + description: The unique identifier (UUID) of the tag indexing rule. + example: "00000000-0000-0000-0000-000000000001" + type: string + type: + $ref: "#/components/schemas/TagIndexingRuleType" + type: object + TagIndexingRuleDynamicTags: + description: Configuration for including dynamically queried tags. + properties: + queried_tags_window_seconds: + description: Window in seconds for evaluating queried tags. + example: 3600 + format: int64 + type: integer + related_asset_tags: + description: When true, tags from related assets are included. + example: false + type: boolean + type: object + TagIndexingRuleExemptionAttributes: + description: Attributes of a tag indexing rule exemption. + properties: + created_at: + description: Timestamp when the exemption was created. + example: "2024-01-15T12:00:00.000Z" + format: date-time + readOnly: true + type: string + created_by_handle: + description: Handle of the user who created the exemption. + example: user@datadoghq.com + readOnly: true + type: string + kind: + description: >- + Discriminates between an explicit exemption (`exemption`) and a pre-existing legacy tag configuration acting as an implicit exclusion (`legacy_tag_configuration`). + example: exemption + type: string + reason: + description: The reason the metric is exempt from tag indexing rules. + example: This metric has a pre-existing tag configuration. + type: string + type: object + TagIndexingRuleExemptionCreateAttributes: + description: Attributes for creating a tag indexing rule exemption. + properties: + reason: + description: The reason the metric is exempt from tag indexing rules. + example: This metric has a pre-existing tag configuration. + type: string + required: + - reason + type: object + TagIndexingRuleExemptionCreateData: + description: Data object for creating a tag indexing rule exemption. + properties: + attributes: + $ref: "#/components/schemas/TagIndexingRuleExemptionCreateAttributes" + type: + $ref: "#/components/schemas/TagIndexingRuleExemptionType" + required: + - type + - attributes + type: object + TagIndexingRuleExemptionCreateRequest: + description: Request body for creating a tag indexing rule exemption. + properties: + data: + $ref: "#/components/schemas/TagIndexingRuleExemptionCreateData" + required: + - data + type: object + TagIndexingRuleExemptionData: + description: A tag indexing rule exemption resource object. + properties: + attributes: + $ref: "#/components/schemas/TagIndexingRuleExemptionAttributes" + id: + description: The metric name, used as the resource ID. + example: dd.test.metric + type: string + type: + $ref: "#/components/schemas/TagIndexingRuleExemptionType" + type: object + TagIndexingRuleExemptionResponse: + description: Response containing a tag indexing rule exemption. + properties: + data: + $ref: "#/components/schemas/TagIndexingRuleExemptionData" + readOnly: true + type: object + TagIndexingRuleExemptionType: + default: tag_indexing_rule_exemptions + description: The tag indexing rule exemption resource type. + enum: + - tag_indexing_rule_exemptions + example: tag_indexing_rule_exemptions + type: string + x-enum-varnames: + - TAG_INDEXING_RULE_EXEMPTIONS + TagIndexingRuleMetricMatch: + description: Criteria for matching metrics based on query state. + properties: + is_queried: + description: Match metrics that are being queried. + type: boolean + not_queried: + description: Match metrics that are not being queried. + type: boolean + not_used_in_assets: + description: Match metrics not used in any dashboards or monitors. + type: boolean + queried_window_seconds: + description: Window in seconds for evaluating query state. + example: 3600 + format: int64 + type: integer + used_in_assets: + description: Match metrics used in dashboards or monitors. + type: boolean + type: object + TagIndexingRuleOptions: + description: Versioned configuration options for a tag indexing rule. + properties: + data: + $ref: "#/components/schemas/TagIndexingRuleOptionsData" + version: + description: Options schema version. Only `1` is supported. + example: 1 + format: int64 + type: integer + type: object + TagIndexingRuleOptionsData: + description: Data payload for tag indexing rule options. + properties: + dynamic_tags: + $ref: "#/components/schemas/TagIndexingRuleDynamicTags" + manage_preexisting_metrics: + description: >- + When true, the rule applies to metrics that were ingested before the rule was created. + example: true + type: boolean + metric_match: + $ref: "#/components/schemas/TagIndexingRuleMetricMatch" + override_previous_rules: + description: >- + When true, this rule's tag list overrides tags configured by earlier rules for the same metric. When false (default), tags from all matching rules are combined. + example: false + type: boolean + type: object + TagIndexingRuleOrderAttributes: + description: Attributes for the reorder operation. + properties: + rule_ids: + description: >- + Ordered list of tag indexing rule UUIDs. The server assigns rule_order 1, 2, … matching position in this list. + example: + - "00000000-0000-0000-0000-000000000001" + - "00000000-0000-0000-0000-000000000002" + items: + type: string + type: array + type: object + TagIndexingRuleOrderData: + description: Data object for the reorder operation. + properties: + attributes: + $ref: "#/components/schemas/TagIndexingRuleOrderAttributes" + type: + $ref: "#/components/schemas/TagIndexingRuleType" + required: + - type + - attributes + type: object + TagIndexingRuleOrderRequest: + description: Request body for reordering tag indexing rules. + properties: + data: + $ref: "#/components/schemas/TagIndexingRuleOrderData" + required: + - data + type: object + TagIndexingRuleResponse: + description: Response containing a single tag indexing rule. + properties: + data: + $ref: "#/components/schemas/TagIndexingRuleData" + readOnly: true + type: object + TagIndexingRuleType: + default: tag_indexing_rules + description: The tag indexing rule resource type. + enum: + - tag_indexing_rules + example: tag_indexing_rules + type: string + x-enum-varnames: + - TAG_INDEXING_RULES + TagIndexingRuleUpdateAttributes: + description: Attributes for updating a tag indexing rule. All fields are optional; omitted fields are unchanged. + properties: + exclude_tags_mode: + description: >- + When true, the rule excludes the listed tags and indexes all others. + type: boolean + ignored_metric_name_matches: + description: Metric name prefixes excluded from the rule's scope. + items: + type: string + type: array + metric_name_matches: + description: Metric name prefixes (glob patterns) this rule applies to. + example: + - "dd.test.*" + items: + type: string + type: array + name: + description: Human-readable name for the rule. + example: my-indexing-rule + type: string + options: + $ref: "#/components/schemas/TagIndexingRuleOptions" + rule_order: + description: >- + Desired evaluation order. Returns 409 if the value conflicts with another rule; use POST /api/v2/metrics/tag-indexing-rules/order for atomic re-sequencing. + example: 2 + format: int64 + type: integer + tags: + description: Tag keys managed by this rule. + example: + - env + - service + items: + type: string + type: array + type: object + TagIndexingRuleUpdateData: + description: Data object for updating a tag indexing rule. + properties: + attributes: + $ref: "#/components/schemas/TagIndexingRuleUpdateAttributes" + type: + $ref: "#/components/schemas/TagIndexingRuleType" + required: + - type + type: object + TagIndexingRuleUpdateRequest: + description: Request body for updating a tag indexing rule. + properties: + data: + $ref: "#/components/schemas/TagIndexingRuleUpdateData" + required: + - data + type: object + TagIndexingRulesResponse: + description: Response containing a page of tag indexing rules. + properties: + data: + description: Array of tag indexing rule objects. + items: + $ref: "#/components/schemas/TagIndexingRuleData" + type: array + meta: + $ref: "#/components/schemas/TagIndexingRulesResponseMeta" + readOnly: true + type: object + TagIndexingRulesResponseMeta: + description: Pagination metadata for a list of tag indexing rules. + properties: + total: + description: Total number of tag indexing rules in the org. + example: 5 + format: int64 + type: integer + type: object TagsEventAttribute: description: Array of tags associated with your event. example: ["team:A"] @@ -137497,6 +137911,417 @@ paths: operator: OR permissions: - metric_tags_write + /api/v2/metrics/tag-indexing-rules: + get: + description: List tag indexing rules for an org, sorted by `rule_order`, with offset/limit pagination. + operationId: ListTagIndexingRules + parameters: + - description: Page size (1–1000, default 100). + in: query + name: page[limit] + schema: + type: integer + - description: Page offset from the start of the list (default 0). + in: query + name: page[offset] + schema: + type: integer + - description: Substring filter on rule name. + in: query + name: search + schema: + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + exclude_tags_mode: false + metric_name_matches: + - "dd.test.*" + name: my-indexing-rule + rule_order: 1 + tags: + - env + - service + id: "00000000-0000-0000-0000-000000000001" + type: tag_indexing_rules + meta: + total: 1 + schema: + $ref: "#/components/schemas/TagIndexingRulesResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Too Many Requests + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - metrics_read + summary: List tag indexing rules + tags: + - Metrics + "x-permission": + operator: OR + permissions: + - metrics_read + post: + description: |- + Create a tag indexing rule for the org. `rule_order` is assigned server-side as max+1 + among existing rules; use the reorder endpoint to change the evaluation order. + Requires the `Manage Tags for Metrics` permission. + operationId: CreateTagIndexingRule + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + metric_name_matches: + - "dd.test.*" + name: my-indexing-rule + tags: + - env + - service + type: tag_indexing_rules + schema: + $ref: "#/components/schemas/TagIndexingRuleCreateRequest" + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2024-01-15T12:00:00.000Z" + exclude_tags_mode: false + metric_name_matches: + - "dd.test.*" + name: my-indexing-rule + rule_order: 1 + tags: + - env + - service + id: "00000000-0000-0000-0000-000000000001" + type: tag_indexing_rules + schema: + $ref: "#/components/schemas/TagIndexingRuleResponse" + description: Created + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Too Many Requests + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - metric_tags_write + summary: Create a tag indexing rule + tags: + - Metrics + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - metric_tags_write + /api/v2/metrics/tag-indexing-rules/order: + post: + description: |- + Atomically re-sequence the tag indexing rules for an org to match the supplied list of rule UUIDs. + The server assigns `rule_order` 1, 2, … matching each rule UUID by position in the list. + Requires the `Manage Tags for Metrics` permission. + operationId: ReorderTagIndexingRules + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + rule_ids: + - "00000000-0000-0000-0000-000000000001" + - "00000000-0000-0000-0000-000000000002" + type: tag_indexing_rules + schema: + $ref: "#/components/schemas/TagIndexingRuleOrderRequest" + required: true + responses: + "204": + description: No Content + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Too Many Requests + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - metric_tags_write + summary: Reorder tag indexing rules + tags: + - Metrics + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - metric_tags_write + /api/v2/metrics/tag-indexing-rules/{id}: + delete: + description: |- + Soft-delete a tag indexing rule. Idempotent: returns 204 whether the rule existed or was already deleted. + Remaining rules in the org are automatically re-sequenced to keep `rule_order` dense and 1-based. + Requires the `Manage Tags for Metrics` permission. + operationId: DeleteTagIndexingRule + parameters: + - $ref: "#/components/parameters/TagIndexingRuleId" + responses: + "204": + description: No Content + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Too Many Requests + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - metric_tags_write + summary: Delete a tag indexing rule + tags: + - Metrics + "x-permission": + operator: OR + permissions: + - metric_tags_write + get: + description: Get a single tag indexing rule by its UUID. + operationId: GetTagIndexingRule + parameters: + - $ref: "#/components/parameters/TagIndexingRuleId" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2024-01-15T12:00:00.000Z" + exclude_tags_mode: false + metric_name_matches: + - "dd.test.*" + name: my-indexing-rule + rule_order: 1 + tags: + - env + - service + id: "00000000-0000-0000-0000-000000000001" + type: tag_indexing_rules + schema: + $ref: "#/components/schemas/TagIndexingRuleResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Too Many Requests + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - metrics_read + summary: Get a tag indexing rule + tags: + - Metrics + "x-permission": + operator: OR + permissions: + - metrics_read + put: + description: |- + Partially update a tag indexing rule. Fields omitted from the request body are left unchanged. + Setting `rule_order` to a value already used by another rule returns 409; use the + reorder endpoint for atomic re-sequencing. Requires the `Manage Tags for Metrics` permission. + operationId: UpdateTagIndexingRule + parameters: + - $ref: "#/components/parameters/TagIndexingRuleId" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + name: my-updated-rule + tags: + - env + - service + - version + type: tag_indexing_rules + schema: + $ref: "#/components/schemas/TagIndexingRuleUpdateRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + exclude_tags_mode: false + metric_name_matches: + - "dd.test.*" + name: my-updated-rule + rule_order: 1 + tags: + - env + - service + - version + id: "00000000-0000-0000-0000-000000000001" + type: tag_indexing_rules + schema: + $ref: "#/components/schemas/TagIndexingRuleResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Conflict + "429": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Too Many Requests + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - metric_tags_write + summary: Update a tag indexing rule + tags: + - Metrics + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - metric_tags_write /api/v2/metrics/{metric_name}/active-configurations: get: description: |- @@ -137884,6 +138709,231 @@ paths: operator: OR permissions: - metrics_read + /api/v2/metrics/{metric_name}/tag-indexing-rule-exemptions: + delete: + description: |- + Remove a metric's exemption from tag indexing rules. Idempotent: returns 204 whether or not + an exemption existed. Any associated legacy tag configuration record is also removed. + Requires the `Manage Tags for Metrics` permission. + operationId: DeleteTagIndexingRuleExemption + parameters: + - $ref: "#/components/parameters/MetricName" + responses: + "204": + description: No Content + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Too Many Requests + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - metric_tags_write + summary: Delete a tag indexing rule exemption + tags: + - Metrics + "x-permission": + operator: OR + permissions: + - metric_tags_write + get: + description: |- + Returns why a metric is excluded from tag indexing rules. + Returns 200 with `kind=exemption` when an explicit exemption exists, 200 with + `kind=legacy_tag_configuration` when the metric has a legacy tag configuration acting as an + implicit exclusion, or 404 when neither applies. + operationId: GetTagIndexingRuleExemption + parameters: + - $ref: "#/components/parameters/MetricName" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2024-01-15T12:00:00.000Z" + created_by_handle: user@datadoghq.com + kind: exemption + reason: This metric has a pre-existing tag configuration. + id: dd.test.metric + type: tag_indexing_rule_exemptions + schema: + $ref: "#/components/schemas/TagIndexingRuleExemptionResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Too Many Requests + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - metrics_read + summary: Get a tag indexing rule exemption + tags: + - Metrics + "x-permission": + operator: OR + permissions: + - metrics_read + post: + description: |- + Exempt a metric from all tag indexing rules. The response includes the created + exemption resource. Requires the `Manage Tags for Metrics` permission. + operationId: CreateTagIndexingRuleExemption + parameters: + - $ref: "#/components/parameters/MetricName" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + reason: This metric has a pre-existing tag configuration. + type: tag_indexing_rule_exemptions + schema: + $ref: "#/components/schemas/TagIndexingRuleExemptionCreateRequest" + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2024-01-15T12:00:00.000Z" + created_by_handle: user@datadoghq.com + kind: exemption + reason: This metric has a pre-existing tag configuration. + id: dd.test.metric + type: tag_indexing_rule_exemptions + schema: + $ref: "#/components/schemas/TagIndexingRuleExemptionResponse" + description: Created + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Too Many Requests + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - metric_tags_write + summary: Create a tag indexing rule exemption + tags: + - Metrics + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - metric_tags_write + /api/v2/metrics/{metric_name}/tag-indexing-rules: + get: + description: |- + List the tag indexing rules that apply to a given metric, sorted by `rule_order`. + Matching is performed server-side using each rule's `metric_name_matches` glob patterns. + operationId: ListTagIndexingRulesForMetric + parameters: + - $ref: "#/components/parameters/MetricName" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: [] + meta: + total: 0 + schema: + $ref: "#/components/schemas/TagIndexingRulesResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Too Many Requests + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - metrics_read + summary: List tag indexing rules for a metric + tags: + - Metrics + "x-permission": + operator: OR + permissions: + - metrics_read /api/v2/metrics/{metric_name}/tags: delete: description: |- diff --git a/examples/v2/metrics/CreateTagIndexingRule.rb b/examples/v2/metrics/CreateTagIndexingRule.rb new file mode 100644 index 000000000000..d4e1d8e4f14d --- /dev/null +++ b/examples/v2/metrics/CreateTagIndexingRule.rb @@ -0,0 +1,37 @@ +# Create a tag indexing rule returns "Created" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::MetricsAPI.new + +body = DatadogAPIClient::V2::TagIndexingRuleCreateRequest.new({ + data: DatadogAPIClient::V2::TagIndexingRuleCreateData.new({ + attributes: DatadogAPIClient::V2::TagIndexingRuleCreateAttributes.new({ + exclude_tags_mode: false, + ignored_metric_name_matches: [], + metric_name_matches: [ + "dd.test.*", + ], + name: "my-indexing-rule", + options: DatadogAPIClient::V2::TagIndexingRuleOptions.new({ + data: DatadogAPIClient::V2::TagIndexingRuleOptionsData.new({ + dynamic_tags: DatadogAPIClient::V2::TagIndexingRuleDynamicTags.new({ + queried_tags_window_seconds: 3600, + related_asset_tags: false, + }), + manage_preexisting_metrics: true, + metric_match: DatadogAPIClient::V2::TagIndexingRuleMetricMatch.new({ + queried_window_seconds: 3600, + }), + override_previous_rules: false, + }), + version: 1, + }), + tags: [ + "env", + "service", + ], + }), + type: DatadogAPIClient::V2::TagIndexingRuleType::TAG_INDEXING_RULES, + }), +}) +p api_instance.create_tag_indexing_rule(body) diff --git a/examples/v2/metrics/CreateTagIndexingRuleExemption.rb b/examples/v2/metrics/CreateTagIndexingRuleExemption.rb new file mode 100644 index 000000000000..131939597cb3 --- /dev/null +++ b/examples/v2/metrics/CreateTagIndexingRuleExemption.rb @@ -0,0 +1,14 @@ +# Create a tag indexing rule exemption returns "Created" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::MetricsAPI.new + +body = DatadogAPIClient::V2::TagIndexingRuleExemptionCreateRequest.new({ + data: DatadogAPIClient::V2::TagIndexingRuleExemptionCreateData.new({ + attributes: DatadogAPIClient::V2::TagIndexingRuleExemptionCreateAttributes.new({ + reason: "This metric has a pre-existing tag configuration.", + }), + type: DatadogAPIClient::V2::TagIndexingRuleExemptionType::TAG_INDEXING_RULE_EXEMPTIONS, + }), +}) +p api_instance.create_tag_indexing_rule_exemption("metric_name", body) diff --git a/examples/v2/metrics/DeleteTagIndexingRule.rb b/examples/v2/metrics/DeleteTagIndexingRule.rb new file mode 100644 index 000000000000..d4f8b7d8e31a --- /dev/null +++ b/examples/v2/metrics/DeleteTagIndexingRule.rb @@ -0,0 +1,5 @@ +# Delete a tag indexing rule returns "No Content" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::MetricsAPI.new +api_instance.delete_tag_indexing_rule("id") diff --git a/examples/v2/metrics/DeleteTagIndexingRuleExemption.rb b/examples/v2/metrics/DeleteTagIndexingRuleExemption.rb new file mode 100644 index 000000000000..749c14ab8827 --- /dev/null +++ b/examples/v2/metrics/DeleteTagIndexingRuleExemption.rb @@ -0,0 +1,5 @@ +# Delete a tag indexing rule exemption returns "No Content" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::MetricsAPI.new +api_instance.delete_tag_indexing_rule_exemption("metric_name") diff --git a/examples/v2/metrics/GetTagIndexingRule.rb b/examples/v2/metrics/GetTagIndexingRule.rb new file mode 100644 index 000000000000..1a52d27ed702 --- /dev/null +++ b/examples/v2/metrics/GetTagIndexingRule.rb @@ -0,0 +1,5 @@ +# Get a tag indexing rule returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::MetricsAPI.new +p api_instance.get_tag_indexing_rule("id") diff --git a/examples/v2/metrics/GetTagIndexingRuleExemption.rb b/examples/v2/metrics/GetTagIndexingRuleExemption.rb new file mode 100644 index 000000000000..92a823429487 --- /dev/null +++ b/examples/v2/metrics/GetTagIndexingRuleExemption.rb @@ -0,0 +1,5 @@ +# Get a tag indexing rule exemption returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::MetricsAPI.new +p api_instance.get_tag_indexing_rule_exemption("metric_name") diff --git a/examples/v2/metrics/ListTagIndexingRules.rb b/examples/v2/metrics/ListTagIndexingRules.rb new file mode 100644 index 000000000000..d2979623e920 --- /dev/null +++ b/examples/v2/metrics/ListTagIndexingRules.rb @@ -0,0 +1,5 @@ +# List tag indexing rules returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::MetricsAPI.new +p api_instance.list_tag_indexing_rules() diff --git a/examples/v2/metrics/ListTagIndexingRulesForMetric.rb b/examples/v2/metrics/ListTagIndexingRulesForMetric.rb new file mode 100644 index 000000000000..11378cde2a63 --- /dev/null +++ b/examples/v2/metrics/ListTagIndexingRulesForMetric.rb @@ -0,0 +1,5 @@ +# List tag indexing rules for a metric returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::MetricsAPI.new +p api_instance.list_tag_indexing_rules_for_metric("metric_name") diff --git a/examples/v2/metrics/ReorderTagIndexingRules.rb b/examples/v2/metrics/ReorderTagIndexingRules.rb new file mode 100644 index 000000000000..4741a018e342 --- /dev/null +++ b/examples/v2/metrics/ReorderTagIndexingRules.rb @@ -0,0 +1,17 @@ +# Reorder tag indexing rules returns "No Content" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::MetricsAPI.new + +body = DatadogAPIClient::V2::TagIndexingRuleOrderRequest.new({ + data: DatadogAPIClient::V2::TagIndexingRuleOrderData.new({ + attributes: DatadogAPIClient::V2::TagIndexingRuleOrderAttributes.new({ + rule_ids: [ + "00000000-0000-0000-0000-000000000001", + "00000000-0000-0000-0000-000000000002", + ], + }), + type: DatadogAPIClient::V2::TagIndexingRuleType::TAG_INDEXING_RULES, + }), +}) +api_instance.reorder_tag_indexing_rules(body) diff --git a/examples/v2/metrics/UpdateTagIndexingRule.rb b/examples/v2/metrics/UpdateTagIndexingRule.rb new file mode 100644 index 000000000000..a730d86321d3 --- /dev/null +++ b/examples/v2/metrics/UpdateTagIndexingRule.rb @@ -0,0 +1,37 @@ +# Update a tag indexing rule returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::MetricsAPI.new + +body = DatadogAPIClient::V2::TagIndexingRuleUpdateRequest.new({ + data: DatadogAPIClient::V2::TagIndexingRuleUpdateData.new({ + attributes: DatadogAPIClient::V2::TagIndexingRuleUpdateAttributes.new({ + ignored_metric_name_matches: [], + metric_name_matches: [ + "dd.test.*", + ], + name: "my-indexing-rule", + options: DatadogAPIClient::V2::TagIndexingRuleOptions.new({ + data: DatadogAPIClient::V2::TagIndexingRuleOptionsData.new({ + dynamic_tags: DatadogAPIClient::V2::TagIndexingRuleDynamicTags.new({ + queried_tags_window_seconds: 3600, + related_asset_tags: false, + }), + manage_preexisting_metrics: true, + metric_match: DatadogAPIClient::V2::TagIndexingRuleMetricMatch.new({ + queried_window_seconds: 3600, + }), + override_previous_rules: false, + }), + version: 1, + }), + rule_order: 2, + tags: [ + "env", + "service", + ], + }), + type: DatadogAPIClient::V2::TagIndexingRuleType::TAG_INDEXING_RULES, + }), +}) +p api_instance.update_tag_indexing_rule("id", body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index c3e7e7142da3..41d79f0a7f0f 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -3797,6 +3797,27 @@ "v2.CreateBulkTagsMetricsConfiguration" => { "body" => "MetricBulkTagConfigCreateRequest", }, + "v2.ListTagIndexingRules" => { + "page_limit" => "Integer", + "page_offset" => "Integer", + "search" => "String", + }, + "v2.CreateTagIndexingRule" => { + "body" => "TagIndexingRuleCreateRequest", + }, + "v2.ReorderTagIndexingRules" => { + "body" => "TagIndexingRuleOrderRequest", + }, + "v2.DeleteTagIndexingRule" => { + "id" => "String", + }, + "v2.GetTagIndexingRule" => { + "id" => "String", + }, + "v2.UpdateTagIndexingRule" => { + "id" => "String", + "body" => "TagIndexingRuleUpdateRequest", + }, "v2.ListActiveMetricConfigurations" => { "metric_name" => "String", "window_seconds" => "Integer", @@ -3824,6 +3845,19 @@ "v2.GetMetricTagCardinalityDetails" => { "metric_name" => "String", }, + "v2.DeleteTagIndexingRuleExemption" => { + "metric_name" => "String", + }, + "v2.GetTagIndexingRuleExemption" => { + "metric_name" => "String", + }, + "v2.CreateTagIndexingRuleExemption" => { + "metric_name" => "String", + "body" => "TagIndexingRuleExemptionCreateRequest", + }, + "v2.ListTagIndexingRulesForMetric" => { + "metric_name" => "String", + }, "v2.DeleteTagConfiguration" => { "metric_name" => "String", }, diff --git a/features/v2/given.json b/features/v2/given.json index 097f6a07d557..0e1e956697de 100644 --- a/features/v2/given.json +++ b/features/v2/given.json @@ -902,6 +902,34 @@ "tag": "Logs Restriction Queries", "operationId": "CreateRestrictionQuery" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"tag_indexing_rules\",\n \"attributes\": {\n \"name\": \"{{ unique_alnum }}\",\n \"metric_name_matches\": [\"dd.{{ unique_alnum }}.*\"],\n \"tags\": [\"env\", \"service\"]\n }\n }\n}" + } + ], + "step": "there is a valid \"tag_indexing_rule\" in the system", + "key": "tag_indexing_rule", + "tag": "Metrics", + "operationId": "CreateTagIndexingRule" + }, + { + "parameters": [ + { + "name": "metric_name", + "value": "\"{{ unique_metric_name }}\"" + }, + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"tag_indexing_rule_exemptions\",\n \"attributes\": {\n \"reason\": \"BDD test exemption\"\n }\n }\n}" + } + ], + "step": "there is a valid \"tag_indexing_rule_exemption\" in the system", + "key": "tag_indexing_rule_exemption", + "tag": "Metrics", + "operationId": "CreateTagIndexingRuleExemption" + }, { "parameters": [ { diff --git a/features/v2/metrics.feature b/features/v2/metrics.feature index 114814e21e20..dadc9447df97 100644 --- a/features/v2/metrics.feature +++ b/features/v2/metrics.feature @@ -68,6 +68,40 @@ Feature: Metrics When the request is sent Then the response status is 201 Created + @generated @skip @team:DataDog/metrics-experience + Scenario: Create a tag indexing rule exemption returns "Bad Request" response + Given a valid "appKeyAuth" key in the system + And new "CreateTagIndexingRuleExemption" request + And request contains "metric_name" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"reason": "This metric has a pre-existing tag configuration."}, "type": "tag_indexing_rule_exemptions"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/metrics-experience + Scenario: Create a tag indexing rule exemption returns "Created" response + Given a valid "appKeyAuth" key in the system + And new "CreateTagIndexingRuleExemption" request + And request contains "metric_name" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"reason": "This metric has a pre-existing tag configuration."}, "type": "tag_indexing_rule_exemptions"}} + When the request is sent + Then the response status is 201 Created + + @generated @skip @team:DataDog/metrics-experience + Scenario: Create a tag indexing rule returns "Bad Request" response + Given a valid "appKeyAuth" key in the system + And new "CreateTagIndexingRule" request + And body with value {"data": {"attributes": {"exclude_tags_mode": false, "ignored_metric_name_matches": [], "metric_name_matches": ["dd.test.*"], "name": "my-indexing-rule", "options": {"data": {"dynamic_tags": {"queried_tags_window_seconds": 3600, "related_asset_tags": false}, "manage_preexisting_metrics": true, "metric_match": {"queried_window_seconds": 3600}, "override_previous_rules": false}, "version": 1}, "tags": ["env", "service"]}, "type": "tag_indexing_rules"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/metrics-experience + Scenario: Create a tag indexing rule returns "Created" response + Given a valid "appKeyAuth" key in the system + And new "CreateTagIndexingRule" request + And body with value {"data": {"attributes": {"exclude_tags_mode": false, "ignored_metric_name_matches": [], "metric_name_matches": ["dd.test.*"], "name": "my-indexing-rule", "options": {"data": {"dynamic_tags": {"queried_tags_window_seconds": 3600, "related_asset_tags": false}, "manage_preexisting_metrics": true, "metric_match": {"queried_window_seconds": 3600}, "override_previous_rules": false}, "version": 1}, "tags": ["env", "service"]}, "type": "tag_indexing_rules"}} + When the request is sent + Then the response status is 201 Created + @replay-only @skip-validation @team:DataDog/metrics-experience Scenario: Delete a tag configuration returns "No Content" response Given there is a valid "metric" in the system @@ -86,6 +120,38 @@ Feature: Metrics When the request is sent Then the response status is 404 Not found + @generated @skip @team:DataDog/metrics-experience + Scenario: Delete a tag indexing rule exemption returns "Bad Request" response + Given a valid "appKeyAuth" key in the system + And new "DeleteTagIndexingRuleExemption" request + And request contains "metric_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/metrics-experience + Scenario: Delete a tag indexing rule exemption returns "No Content" response + Given a valid "appKeyAuth" key in the system + And new "DeleteTagIndexingRuleExemption" request + And request contains "metric_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/metrics-experience + Scenario: Delete a tag indexing rule returns "Bad Request" response + Given a valid "appKeyAuth" key in the system + And new "DeleteTagIndexingRule" 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/metrics-experience + Scenario: Delete a tag indexing rule returns "No Content" response + Given a valid "appKeyAuth" key in the system + And new "DeleteTagIndexingRule" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + @generated @skip @team:DataDog/metrics-experience Scenario: Delete tags for multiple metrics returns "Accepted" response Given a valid "appKeyAuth" key in the system @@ -152,6 +218,54 @@ Feature: Metrics Then the response status is 200 Success And the response "data[0].type" is equal to "manage_tags" + @generated @skip @team:DataDog/metrics-experience + Scenario: Get a tag indexing rule exemption returns "Bad Request" response + Given a valid "appKeyAuth" key in the system + And new "GetTagIndexingRuleExemption" request + And request contains "metric_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/metrics-experience + Scenario: Get a tag indexing rule exemption returns "Not Found" response + Given a valid "appKeyAuth" key in the system + And new "GetTagIndexingRuleExemption" request + And request contains "metric_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/metrics-experience + Scenario: Get a tag indexing rule exemption returns "OK" response + Given a valid "appKeyAuth" key in the system + And new "GetTagIndexingRuleExemption" request + And request contains "metric_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/metrics-experience + Scenario: Get a tag indexing rule returns "Bad Request" response + Given a valid "appKeyAuth" key in the system + And new "GetTagIndexingRule" 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/metrics-experience + Scenario: Get a tag indexing rule returns "Not Found" response + Given a valid "appKeyAuth" key in the system + And new "GetTagIndexingRule" 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/metrics-experience + Scenario: Get a tag indexing rule returns "OK" response + Given a valid "appKeyAuth" key in the system + And new "GetTagIndexingRule" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/metrics-experience Scenario: Get tag key cardinality details returns "Bad Request" response Given a valid "appKeyAuth" key in the system @@ -249,6 +363,36 @@ Feature: Metrics Then the response status is 200 Success And the response "data.id" has the same value as "metric_tag_configuration.data.id" + @generated @skip @team:DataDog/metrics-experience + Scenario: List tag indexing rules for a metric returns "Bad Request" response + Given a valid "appKeyAuth" key in the system + And new "ListTagIndexingRulesForMetric" request + And request contains "metric_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/metrics-experience + Scenario: List tag indexing rules for a metric returns "OK" response + Given a valid "appKeyAuth" key in the system + And new "ListTagIndexingRulesForMetric" request + And request contains "metric_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/metrics-experience + Scenario: List tag indexing rules returns "Bad Request" response + Given a valid "appKeyAuth" key in the system + And new "ListTagIndexingRules" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/metrics-experience + Scenario: List tag indexing rules returns "OK" response + Given a valid "appKeyAuth" key in the system + And new "ListTagIndexingRules" request + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/metrics-experience Scenario: List tags by metric name returns "Bad Request" response Given a valid "appKeyAuth" key in the system @@ -326,6 +470,30 @@ Feature: Metrics And the response "data.type" is equal to "metrics" And the response "data.id" is equal to "system.cpu.user" + @generated @skip @team:DataDog/metrics-experience + Scenario: Reorder tag indexing rules returns "Bad Request" response + Given a valid "appKeyAuth" key in the system + And new "ReorderTagIndexingRules" request + And body with value {"data": {"attributes": {"rule_ids": ["00000000-0000-0000-0000-000000000001", "00000000-0000-0000-0000-000000000002"]}, "type": "tag_indexing_rules"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/metrics-experience + Scenario: Reorder tag indexing rules returns "No Content" response + Given a valid "appKeyAuth" key in the system + And new "ReorderTagIndexingRules" request + And body with value {"data": {"attributes": {"rule_ids": ["00000000-0000-0000-0000-000000000001", "00000000-0000-0000-0000-000000000002"]}, "type": "tag_indexing_rules"}} + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/metrics-experience + Scenario: Reorder tag indexing rules returns "Not Found" response + Given a valid "appKeyAuth" key in the system + And new "ReorderTagIndexingRules" request + And body with value {"data": {"attributes": {"rule_ids": ["00000000-0000-0000-0000-000000000001", "00000000-0000-0000-0000-000000000002"]}, "type": "tag_indexing_rules"}} + When the request is sent + Then the response status is 404 Not Found + @team:Datadog/timeseries-query Scenario: Scalar cross product query returns "Bad Request" response Given a valid "appKeyAuth" key in the system @@ -786,3 +954,39 @@ Feature: Metrics And body with value {"data": {"attributes": {"group_by": ["app", "datacenter"], "include_percentiles": false}, "id": "http.endpoint.request", "type": "manage_tags"}} When the request is sent Then the response status is 422 Unprocessable Entity + + @generated @skip @team:DataDog/metrics-experience + Scenario: Update a tag indexing rule returns "Bad Request" response + Given a valid "appKeyAuth" key in the system + And new "UpdateTagIndexingRule" request + And request contains "id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"ignored_metric_name_matches": [], "metric_name_matches": ["dd.test.*"], "name": "my-indexing-rule", "options": {"data": {"dynamic_tags": {"queried_tags_window_seconds": 3600, "related_asset_tags": false}, "manage_preexisting_metrics": true, "metric_match": {"queried_window_seconds": 3600}, "override_previous_rules": false}, "version": 1}, "rule_order": 2, "tags": ["env", "service"]}, "type": "tag_indexing_rules"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/metrics-experience + Scenario: Update a tag indexing rule returns "Conflict" response + Given a valid "appKeyAuth" key in the system + And new "UpdateTagIndexingRule" request + And request contains "id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"ignored_metric_name_matches": [], "metric_name_matches": ["dd.test.*"], "name": "my-indexing-rule", "options": {"data": {"dynamic_tags": {"queried_tags_window_seconds": 3600, "related_asset_tags": false}, "manage_preexisting_metrics": true, "metric_match": {"queried_window_seconds": 3600}, "override_previous_rules": false}, "version": 1}, "rule_order": 2, "tags": ["env", "service"]}, "type": "tag_indexing_rules"}} + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:DataDog/metrics-experience + Scenario: Update a tag indexing rule returns "Not Found" response + Given a valid "appKeyAuth" key in the system + And new "UpdateTagIndexingRule" request + And request contains "id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"ignored_metric_name_matches": [], "metric_name_matches": ["dd.test.*"], "name": "my-indexing-rule", "options": {"data": {"dynamic_tags": {"queried_tags_window_seconds": 3600, "related_asset_tags": false}, "manage_preexisting_metrics": true, "metric_match": {"queried_window_seconds": 3600}, "override_previous_rules": false}, "version": 1}, "rule_order": 2, "tags": ["env", "service"]}, "type": "tag_indexing_rules"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/metrics-experience + Scenario: Update a tag indexing rule returns "OK" response + Given a valid "appKeyAuth" key in the system + And new "UpdateTagIndexingRule" request + And request contains "id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"ignored_metric_name_matches": [], "metric_name_matches": ["dd.test.*"], "name": "my-indexing-rule", "options": {"data": {"dynamic_tags": {"queried_tags_window_seconds": 3600, "related_asset_tags": false}, "manage_preexisting_metrics": true, "metric_match": {"queried_window_seconds": 3600}, "override_previous_rules": false}, "version": 1}, "rule_order": 2, "tags": ["env", "service"]}, "type": "tag_indexing_rules"}} + 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 f60cf1a2f731..8f4b86a996b9 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -4576,6 +4576,49 @@ "type": "unsafe" } }, + "ListTagIndexingRules": { + "tag": "Metrics", + "undo": { + "type": "safe" + } + }, + "CreateTagIndexingRule": { + "tag": "Metrics", + "undo": { + "operationId": "DeleteTagIndexingRule", + "parameters": [ + { + "name": "id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "ReorderTagIndexingRules": { + "tag": "Metrics", + "undo": { + "type": "idempotent" + } + }, + "DeleteTagIndexingRule": { + "tag": "Metrics", + "undo": { + "type": "idempotent" + } + }, + "GetTagIndexingRule": { + "tag": "Metrics", + "undo": { + "type": "safe" + } + }, + "UpdateTagIndexingRule": { + "tag": "Metrics", + "undo": { + "type": "idempotent" + } + }, "ListActiveMetricConfigurations": { "tag": "Metrics", "undo": { @@ -4606,6 +4649,37 @@ "type": "safe" } }, + "DeleteTagIndexingRuleExemption": { + "tag": "Metrics", + "undo": { + "type": "idempotent" + } + }, + "GetTagIndexingRuleExemption": { + "tag": "Metrics", + "undo": { + "type": "safe" + } + }, + "CreateTagIndexingRuleExemption": { + "tag": "Metrics", + "undo": { + "operationId": "DeleteTagIndexingRuleExemption", + "parameters": [ + { + "name": "metric_name", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "ListTagIndexingRulesForMetric": { + "tag": "Metrics", + "undo": { + "type": "safe" + } + }, "DeleteTagConfiguration": { "tag": "Metrics", "undo": { diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 838c1450b433..1a98ed78d712 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -6712,6 +6712,32 @@ def overrides "v2.table_row_resource_identifier" => "TableRowResourceIdentifier", "v2.tag_data" => "TagData", "v2.tag_data_type" => "TagDataType", + "v2.tag_indexing_rule_attributes" => "TagIndexingRuleAttributes", + "v2.tag_indexing_rule_create_attributes" => "TagIndexingRuleCreateAttributes", + "v2.tag_indexing_rule_create_data" => "TagIndexingRuleCreateData", + "v2.tag_indexing_rule_create_request" => "TagIndexingRuleCreateRequest", + "v2.tag_indexing_rule_data" => "TagIndexingRuleData", + "v2.tag_indexing_rule_dynamic_tags" => "TagIndexingRuleDynamicTags", + "v2.tag_indexing_rule_exemption_attributes" => "TagIndexingRuleExemptionAttributes", + "v2.tag_indexing_rule_exemption_create_attributes" => "TagIndexingRuleExemptionCreateAttributes", + "v2.tag_indexing_rule_exemption_create_data" => "TagIndexingRuleExemptionCreateData", + "v2.tag_indexing_rule_exemption_create_request" => "TagIndexingRuleExemptionCreateRequest", + "v2.tag_indexing_rule_exemption_data" => "TagIndexingRuleExemptionData", + "v2.tag_indexing_rule_exemption_response" => "TagIndexingRuleExemptionResponse", + "v2.tag_indexing_rule_exemption_type" => "TagIndexingRuleExemptionType", + "v2.tag_indexing_rule_metric_match" => "TagIndexingRuleMetricMatch", + "v2.tag_indexing_rule_options" => "TagIndexingRuleOptions", + "v2.tag_indexing_rule_options_data" => "TagIndexingRuleOptionsData", + "v2.tag_indexing_rule_order_attributes" => "TagIndexingRuleOrderAttributes", + "v2.tag_indexing_rule_order_data" => "TagIndexingRuleOrderData", + "v2.tag_indexing_rule_order_request" => "TagIndexingRuleOrderRequest", + "v2.tag_indexing_rule_response" => "TagIndexingRuleResponse", + "v2.tag_indexing_rules_response" => "TagIndexingRulesResponse", + "v2.tag_indexing_rules_response_meta" => "TagIndexingRulesResponseMeta", + "v2.tag_indexing_rule_type" => "TagIndexingRuleType", + "v2.tag_indexing_rule_update_attributes" => "TagIndexingRuleUpdateAttributes", + "v2.tag_indexing_rule_update_data" => "TagIndexingRuleUpdateData", + "v2.tag_indexing_rule_update_request" => "TagIndexingRuleUpdateRequest", "v2.targeting_rule" => "TargetingRule", "v2.targeting_rule_request" => "TargetingRuleRequest", "v2.team" => "Team", diff --git a/lib/datadog_api_client/v2/api/metrics_api.rb b/lib/datadog_api_client/v2/api/metrics_api.rb index 5afd81ac2bd9..9ba4035fcf97 100644 --- a/lib/datadog_api_client/v2/api/metrics_api.rb +++ b/lib/datadog_api_client/v2/api/metrics_api.rb @@ -172,6 +172,148 @@ def create_tag_configuration_with_http_info(metric_name, body, opts = {}) return data, status_code, headers end + # Create a tag indexing rule. + # + # @see #create_tag_indexing_rule_with_http_info + def create_tag_indexing_rule(body, opts = {}) + data, _status_code, _headers = create_tag_indexing_rule_with_http_info(body, opts) + data + end + + # Create a tag indexing rule. + # + # Create a tag indexing rule for the org. `rule_order` is assigned server-side as max+1 + # among existing rules; use the reorder endpoint to change the evaluation order. + # Requires the `Manage Tags for Metrics` permission. + # + # @param body [TagIndexingRuleCreateRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(TagIndexingRuleResponse, Integer, Hash)>] TagIndexingRuleResponse data, response status code and response headers + def create_tag_indexing_rule_with_http_info(body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MetricsAPI.create_tag_indexing_rule ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling MetricsAPI.create_tag_indexing_rule" + end + # resource path + local_var_path = '/api/v2/metrics/tag-indexing-rules' + + # 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']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'TagIndexingRuleResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :create_tag_indexing_rule, + :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::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MetricsAPI#create_tag_indexing_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Create a tag indexing rule exemption. + # + # @see #create_tag_indexing_rule_exemption_with_http_info + def create_tag_indexing_rule_exemption(metric_name, body, opts = {}) + data, _status_code, _headers = create_tag_indexing_rule_exemption_with_http_info(metric_name, body, opts) + data + end + + # Create a tag indexing rule exemption. + # + # Exempt a metric from all tag indexing rules. The response includes the created + # exemption resource. Requires the `Manage Tags for Metrics` permission. + # + # @param metric_name [String] The name of the metric. + # @param body [TagIndexingRuleExemptionCreateRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(TagIndexingRuleExemptionResponse, Integer, Hash)>] TagIndexingRuleExemptionResponse data, response status code and response headers + def create_tag_indexing_rule_exemption_with_http_info(metric_name, body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MetricsAPI.create_tag_indexing_rule_exemption ...' + end + # verify the required parameter 'metric_name' is set + if @api_client.config.client_side_validation && metric_name.nil? + fail ArgumentError, "Missing the required parameter 'metric_name' when calling MetricsAPI.create_tag_indexing_rule_exemption" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling MetricsAPI.create_tag_indexing_rule_exemption" + end + # resource path + local_var_path = '/api/v2/metrics/{metric_name}/tag-indexing-rule-exemptions'.sub('{metric_name}', CGI.escape(metric_name.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']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'TagIndexingRuleExemptionResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :create_tag_indexing_rule_exemption, + :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::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MetricsAPI#create_tag_indexing_rule_exemption\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Delete tags for multiple metrics. # # @see #delete_bulk_tags_metrics_configuration_with_http_info @@ -309,6 +451,140 @@ def delete_tag_configuration_with_http_info(metric_name, opts = {}) return data, status_code, headers end + # Delete a tag indexing rule. + # + # @see #delete_tag_indexing_rule_with_http_info + def delete_tag_indexing_rule(id, opts = {}) + delete_tag_indexing_rule_with_http_info(id, opts) + nil + end + + # Delete a tag indexing rule. + # + # Soft-delete a tag indexing rule. Idempotent: returns 204 whether the rule existed or was already deleted. + # Remaining rules in the org are automatically re-sequenced to keep `rule_order` dense and 1-based. + # Requires the `Manage Tags for Metrics` permission. + # + # @param id [String] ID of the tag indexing rule. + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_tag_indexing_rule_with_http_info(id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MetricsAPI.delete_tag_indexing_rule ...' + 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 MetricsAPI.delete_tag_indexing_rule" + end + # resource path + local_var_path = '/api/v2/metrics/tag-indexing-rules/{id}'.sub('{id}', CGI.escape(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(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :delete_tag_indexing_rule, + :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::Delete, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MetricsAPI#delete_tag_indexing_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete a tag indexing rule exemption. + # + # @see #delete_tag_indexing_rule_exemption_with_http_info + def delete_tag_indexing_rule_exemption(metric_name, opts = {}) + delete_tag_indexing_rule_exemption_with_http_info(metric_name, opts) + nil + end + + # Delete a tag indexing rule exemption. + # + # Remove a metric's exemption from tag indexing rules. Idempotent: returns 204 whether or not + # an exemption existed. Any associated legacy tag configuration record is also removed. + # Requires the `Manage Tags for Metrics` permission. + # + # @param metric_name [String] The name of the metric. + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_tag_indexing_rule_exemption_with_http_info(metric_name, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MetricsAPI.delete_tag_indexing_rule_exemption ...' + end + # verify the required parameter 'metric_name' is set + if @api_client.config.client_side_validation && metric_name.nil? + fail ArgumentError, "Missing the required parameter 'metric_name' when calling MetricsAPI.delete_tag_indexing_rule_exemption" + end + # resource path + local_var_path = '/api/v2/metrics/{metric_name}/tag-indexing-rule-exemptions'.sub('{metric_name}', CGI.escape(metric_name.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(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :delete_tag_indexing_rule_exemption, + :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::Delete, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MetricsAPI#delete_tag_indexing_rule_exemption\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Tag Configuration Cardinality Estimator. # # @see #estimate_metrics_output_series_with_http_info @@ -321,45 +597,175 @@ def estimate_metrics_output_series(metric_name, opts = {}) # # Returns the estimated cardinality for a metric with a given tag, percentile and number of aggregations configuration using Metrics without Limits™. # - # @param metric_name [String] The name of the metric. + # @param metric_name [String] The name of the metric. + # @param opts [Hash] the optional parameters + # @option opts [String] :filter_groups Comma-separated list of tag keys that the metric is configured to query with. For example: `filter[groups]=app,host`. + # @option opts [Integer] :filter_hours_ago The number of hours of look back (from now) to estimate cardinality with. If unspecified, it defaults to 0 hours. + # @option opts [Integer] :filter_num_aggregations Deprecated. Number of aggregations has no impact on volume. + # @option opts [Boolean] :filter_pct A boolean, for distribution metrics only, to estimate cardinality if the metric includes additional percentile aggregators. + # @option opts [Integer] :filter_timespan_h A window, in hours, from the look back to estimate cardinality with. The minimum and default is 1 hour. + # @return [Array<(MetricEstimateResponse, Integer, Hash)>] MetricEstimateResponse data, response status code and response headers + def estimate_metrics_output_series_with_http_info(metric_name, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MetricsAPI.estimate_metrics_output_series ...' + end + # verify the required parameter 'metric_name' is set + if @api_client.config.client_side_validation && metric_name.nil? + fail ArgumentError, "Missing the required parameter 'metric_name' when calling MetricsAPI.estimate_metrics_output_series" + end + if @api_client.config.client_side_validation && !opts[:'filter_hours_ago'].nil? && opts[:'filter_hours_ago'] > 2147483647 + fail ArgumentError, 'invalid value for "opts[:"filter_hours_ago"]" when calling MetricsAPI.estimate_metrics_output_series, must be smaller than or equal to 2147483647.' + end + if @api_client.config.client_side_validation && !opts[:'filter_hours_ago'].nil? && opts[:'filter_hours_ago'] < 49 + fail ArgumentError, 'invalid value for "opts[:"filter_hours_ago"]" when calling MetricsAPI.estimate_metrics_output_series, must be greater than or equal to 49.' + end + if @api_client.config.client_side_validation && !opts[:'filter_num_aggregations'].nil? && opts[:'filter_num_aggregations'] > 9 + fail ArgumentError, 'invalid value for "opts[:"filter_num_aggregations"]" when calling MetricsAPI.estimate_metrics_output_series, must be smaller than or equal to 9.' + end + if @api_client.config.client_side_validation && !opts[:'filter_timespan_h'].nil? && opts[:'filter_timespan_h'] > 2147483647 + fail ArgumentError, 'invalid value for "opts[:"filter_timespan_h"]" when calling MetricsAPI.estimate_metrics_output_series, must be smaller than or equal to 2147483647.' + end + # resource path + local_var_path = '/api/v2/metrics/{metric_name}/estimate'.sub('{metric_name}', CGI.escape(metric_name.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'filter[groups]'] = opts[:'filter_groups'] if !opts[:'filter_groups'].nil? + query_params[:'filter[hours_ago]'] = opts[:'filter_hours_ago'] if !opts[:'filter_hours_ago'].nil? + query_params[:'filter[num_aggregations]'] = opts[:'filter_num_aggregations'] if !opts[:'filter_num_aggregations'].nil? + query_params[:'filter[pct]'] = opts[:'filter_pct'] if !opts[:'filter_pct'].nil? + query_params[:'filter[timespan_h]'] = opts[:'filter_timespan_h'] if !opts[:'filter_timespan_h'].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] || 'MetricEstimateResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :estimate_metrics_output_series, + :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: MetricsAPI#estimate_metrics_output_series\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get tag key cardinality details. + # + # @see #get_metric_tag_cardinality_details_with_http_info + def get_metric_tag_cardinality_details(metric_name, opts = {}) + data, _status_code, _headers = get_metric_tag_cardinality_details_with_http_info(metric_name, opts) + data + end + + # Get tag key cardinality details. + # + # Returns the cardinality details of tags for a specific metric. + # + # @param metric_name [String] The name of the metric. + # @param opts [Hash] the optional parameters + # @return [Array<(MetricTagCardinalitiesResponse, Integer, Hash)>] MetricTagCardinalitiesResponse data, response status code and response headers + def get_metric_tag_cardinality_details_with_http_info(metric_name, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MetricsAPI.get_metric_tag_cardinality_details ...' + end + # verify the required parameter 'metric_name' is set + if @api_client.config.client_side_validation && metric_name.nil? + fail ArgumentError, "Missing the required parameter 'metric_name' when calling MetricsAPI.get_metric_tag_cardinality_details" + end + # resource path + local_var_path = '/api/v2/metrics/{metric_name}/tag-cardinalities'.sub('{metric_name}', CGI.escape(metric_name.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] || 'MetricTagCardinalitiesResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :get_metric_tag_cardinality_details, + :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: MetricsAPI#get_metric_tag_cardinality_details\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get a tag indexing rule. + # + # @see #get_tag_indexing_rule_with_http_info + def get_tag_indexing_rule(id, opts = {}) + data, _status_code, _headers = get_tag_indexing_rule_with_http_info(id, opts) + data + end + + # Get a tag indexing rule. + # + # Get a single tag indexing rule by its UUID. + # + # @param id [String] ID of the tag indexing rule. # @param opts [Hash] the optional parameters - # @option opts [String] :filter_groups Comma-separated list of tag keys that the metric is configured to query with. For example: `filter[groups]=app,host`. - # @option opts [Integer] :filter_hours_ago The number of hours of look back (from now) to estimate cardinality with. If unspecified, it defaults to 0 hours. - # @option opts [Integer] :filter_num_aggregations Deprecated. Number of aggregations has no impact on volume. - # @option opts [Boolean] :filter_pct A boolean, for distribution metrics only, to estimate cardinality if the metric includes additional percentile aggregators. - # @option opts [Integer] :filter_timespan_h A window, in hours, from the look back to estimate cardinality with. The minimum and default is 1 hour. - # @return [Array<(MetricEstimateResponse, Integer, Hash)>] MetricEstimateResponse data, response status code and response headers - def estimate_metrics_output_series_with_http_info(metric_name, opts = {}) + # @return [Array<(TagIndexingRuleResponse, Integer, Hash)>] TagIndexingRuleResponse data, response status code and response headers + def get_tag_indexing_rule_with_http_info(id, opts = {}) if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: MetricsAPI.estimate_metrics_output_series ...' - end - # verify the required parameter 'metric_name' is set - if @api_client.config.client_side_validation && metric_name.nil? - fail ArgumentError, "Missing the required parameter 'metric_name' when calling MetricsAPI.estimate_metrics_output_series" - end - if @api_client.config.client_side_validation && !opts[:'filter_hours_ago'].nil? && opts[:'filter_hours_ago'] > 2147483647 - fail ArgumentError, 'invalid value for "opts[:"filter_hours_ago"]" when calling MetricsAPI.estimate_metrics_output_series, must be smaller than or equal to 2147483647.' + @api_client.config.logger.debug 'Calling API: MetricsAPI.get_tag_indexing_rule ...' end - if @api_client.config.client_side_validation && !opts[:'filter_hours_ago'].nil? && opts[:'filter_hours_ago'] < 49 - fail ArgumentError, 'invalid value for "opts[:"filter_hours_ago"]" when calling MetricsAPI.estimate_metrics_output_series, must be greater than or equal to 49.' - end - if @api_client.config.client_side_validation && !opts[:'filter_num_aggregations'].nil? && opts[:'filter_num_aggregations'] > 9 - fail ArgumentError, 'invalid value for "opts[:"filter_num_aggregations"]" when calling MetricsAPI.estimate_metrics_output_series, must be smaller than or equal to 9.' - end - if @api_client.config.client_side_validation && !opts[:'filter_timespan_h'].nil? && opts[:'filter_timespan_h'] > 2147483647 - fail ArgumentError, 'invalid value for "opts[:"filter_timespan_h"]" when calling MetricsAPI.estimate_metrics_output_series, must be smaller than or equal to 2147483647.' + # 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 MetricsAPI.get_tag_indexing_rule" end # resource path - local_var_path = '/api/v2/metrics/{metric_name}/estimate'.sub('{metric_name}', CGI.escape(metric_name.to_s).gsub('%2F', '/')) + local_var_path = '/api/v2/metrics/tag-indexing-rules/{id}'.sub('{id}', CGI.escape(id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} - query_params[:'filter[groups]'] = opts[:'filter_groups'] if !opts[:'filter_groups'].nil? - query_params[:'filter[hours_ago]'] = opts[:'filter_hours_ago'] if !opts[:'filter_hours_ago'].nil? - query_params[:'filter[num_aggregations]'] = opts[:'filter_num_aggregations'] if !opts[:'filter_num_aggregations'].nil? - query_params[:'filter[pct]'] = opts[:'filter_pct'] if !opts[:'filter_pct'].nil? - query_params[:'filter[timespan_h]'] = opts[:'filter_timespan_h'] if !opts[:'filter_timespan_h'].nil? # header parameters header_params = opts[:header_params] || {} @@ -373,13 +779,13 @@ def estimate_metrics_output_series_with_http_info(metric_name, opts = {}) post_body = opts[:debug_body] # return_type - return_type = opts[:debug_return_type] || 'MetricEstimateResponse' + return_type = opts[:debug_return_type] || 'TagIndexingRuleResponse' # auth_names - auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] new_options = opts.merge( - :operation => :estimate_metrics_output_series, + :operation => :get_tag_indexing_rule, :header_params => header_params, :query_params => query_params, :form_params => form_params, @@ -391,37 +797,40 @@ def estimate_metrics_output_series_with_http_info(metric_name, opts = {}) 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: MetricsAPI#estimate_metrics_output_series\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: MetricsAPI#get_tag_indexing_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end - # Get tag key cardinality details. + # Get a tag indexing rule exemption. # - # @see #get_metric_tag_cardinality_details_with_http_info - def get_metric_tag_cardinality_details(metric_name, opts = {}) - data, _status_code, _headers = get_metric_tag_cardinality_details_with_http_info(metric_name, opts) + # @see #get_tag_indexing_rule_exemption_with_http_info + def get_tag_indexing_rule_exemption(metric_name, opts = {}) + data, _status_code, _headers = get_tag_indexing_rule_exemption_with_http_info(metric_name, opts) data end - # Get tag key cardinality details. + # Get a tag indexing rule exemption. # - # Returns the cardinality details of tags for a specific metric. + # Returns why a metric is excluded from tag indexing rules. + # Returns 200 with `kind=exemption` when an explicit exemption exists, 200 with + # `kind=legacy_tag_configuration` when the metric has a legacy tag configuration acting as an + # implicit exclusion, or 404 when neither applies. # # @param metric_name [String] The name of the metric. # @param opts [Hash] the optional parameters - # @return [Array<(MetricTagCardinalitiesResponse, Integer, Hash)>] MetricTagCardinalitiesResponse data, response status code and response headers - def get_metric_tag_cardinality_details_with_http_info(metric_name, opts = {}) + # @return [Array<(TagIndexingRuleExemptionResponse, Integer, Hash)>] TagIndexingRuleExemptionResponse data, response status code and response headers + def get_tag_indexing_rule_exemption_with_http_info(metric_name, opts = {}) if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: MetricsAPI.get_metric_tag_cardinality_details ...' + @api_client.config.logger.debug 'Calling API: MetricsAPI.get_tag_indexing_rule_exemption ...' end # verify the required parameter 'metric_name' is set if @api_client.config.client_side_validation && metric_name.nil? - fail ArgumentError, "Missing the required parameter 'metric_name' when calling MetricsAPI.get_metric_tag_cardinality_details" + fail ArgumentError, "Missing the required parameter 'metric_name' when calling MetricsAPI.get_tag_indexing_rule_exemption" end # resource path - local_var_path = '/api/v2/metrics/{metric_name}/tag-cardinalities'.sub('{metric_name}', CGI.escape(metric_name.to_s).gsub('%2F', '/')) + local_var_path = '/api/v2/metrics/{metric_name}/tag-indexing-rule-exemptions'.sub('{metric_name}', CGI.escape(metric_name.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} @@ -438,13 +847,13 @@ def get_metric_tag_cardinality_details_with_http_info(metric_name, opts = {}) post_body = opts[:debug_body] # return_type - return_type = opts[:debug_return_type] || 'MetricTagCardinalitiesResponse' + return_type = opts[:debug_return_type] || 'TagIndexingRuleExemptionResponse' # auth_names - auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] new_options = opts.merge( - :operation => :get_metric_tag_cardinality_details, + :operation => :get_tag_indexing_rule_exemption, :header_params => header_params, :query_params => query_params, :form_params => form_params, @@ -456,7 +865,7 @@ def get_metric_tag_cardinality_details_with_http_info(metric_name, opts = {}) 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: MetricsAPI#get_metric_tag_cardinality_details\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: MetricsAPI#get_tag_indexing_rule_exemption\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end @@ -785,6 +1194,138 @@ def list_tag_configurations_with_pagination(opts = {}) end end + # List tag indexing rules. + # + # @see #list_tag_indexing_rules_with_http_info + def list_tag_indexing_rules(opts = {}) + data, _status_code, _headers = list_tag_indexing_rules_with_http_info(opts) + data + end + + # List tag indexing rules. + # + # List tag indexing rules for an org, sorted by `rule_order`, with offset/limit pagination. + # + # @param opts [Hash] the optional parameters + # @option opts [Integer] :page_limit Page size (1–1000, default 100). + # @option opts [Integer] :page_offset Page offset from the start of the list (default 0). + # @option opts [String] :search Substring filter on rule name. + # @return [Array<(TagIndexingRulesResponse, Integer, Hash)>] TagIndexingRulesResponse data, response status code and response headers + def list_tag_indexing_rules_with_http_info(opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MetricsAPI.list_tag_indexing_rules ...' + end + # resource path + local_var_path = '/api/v2/metrics/tag-indexing-rules' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page[limit]'] = opts[:'page_limit'] if !opts[:'page_limit'].nil? + query_params[:'page[offset]'] = opts[:'page_offset'] if !opts[:'page_offset'].nil? + query_params[:'search'] = opts[:'search'] if !opts[:'search'].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] || 'TagIndexingRulesResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :list_tag_indexing_rules, + :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: MetricsAPI#list_tag_indexing_rules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List tag indexing rules for a metric. + # + # @see #list_tag_indexing_rules_for_metric_with_http_info + def list_tag_indexing_rules_for_metric(metric_name, opts = {}) + data, _status_code, _headers = list_tag_indexing_rules_for_metric_with_http_info(metric_name, opts) + data + end + + # List tag indexing rules for a metric. + # + # List the tag indexing rules that apply to a given metric, sorted by `rule_order`. + # Matching is performed server-side using each rule's `metric_name_matches` glob patterns. + # + # @param metric_name [String] The name of the metric. + # @param opts [Hash] the optional parameters + # @return [Array<(TagIndexingRulesResponse, Integer, Hash)>] TagIndexingRulesResponse data, response status code and response headers + def list_tag_indexing_rules_for_metric_with_http_info(metric_name, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MetricsAPI.list_tag_indexing_rules_for_metric ...' + end + # verify the required parameter 'metric_name' is set + if @api_client.config.client_side_validation && metric_name.nil? + fail ArgumentError, "Missing the required parameter 'metric_name' when calling MetricsAPI.list_tag_indexing_rules_for_metric" + end + # resource path + local_var_path = '/api/v2/metrics/{metric_name}/tag-indexing-rules'.sub('{metric_name}', CGI.escape(metric_name.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] || 'TagIndexingRulesResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :list_tag_indexing_rules_for_metric, + :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: MetricsAPI#list_tag_indexing_rules_for_metric\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # List tags by metric name. # # @see #list_tags_by_metric_name_with_http_info @@ -1075,6 +1616,75 @@ def query_timeseries_data_with_http_info(body, opts = {}) return data, status_code, headers end + # Reorder tag indexing rules. + # + # @see #reorder_tag_indexing_rules_with_http_info + def reorder_tag_indexing_rules(body, opts = {}) + reorder_tag_indexing_rules_with_http_info(body, opts) + nil + end + + # Reorder tag indexing rules. + # + # Atomically re-sequence the tag indexing rules for an org to match the supplied list of rule UUIDs. + # The server assigns `rule_order` 1, 2, … matching each rule UUID by position in the list. + # Requires the `Manage Tags for Metrics` permission. + # + # @param body [TagIndexingRuleOrderRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def reorder_tag_indexing_rules_with_http_info(body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MetricsAPI.reorder_tag_indexing_rules ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling MetricsAPI.reorder_tag_indexing_rules" + end + # resource path + local_var_path = '/api/v2/metrics/tag-indexing-rules/order' + + # 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(['*/*']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :reorder_tag_indexing_rules, + :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::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MetricsAPI#reorder_tag_indexing_rules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Submit metrics. # # @see #submit_metrics_with_http_info @@ -1234,5 +1844,79 @@ def update_tag_configuration_with_http_info(metric_name, body, opts = {}) end return data, status_code, headers end + + # Update a tag indexing rule. + # + # @see #update_tag_indexing_rule_with_http_info + def update_tag_indexing_rule(id, body, opts = {}) + data, _status_code, _headers = update_tag_indexing_rule_with_http_info(id, body, opts) + data + end + + # Update a tag indexing rule. + # + # Partially update a tag indexing rule. Fields omitted from the request body are left unchanged. + # Setting `rule_order` to a value already used by another rule returns 409; use the + # reorder endpoint for atomic re-sequencing. Requires the `Manage Tags for Metrics` permission. + # + # @param id [String] ID of the tag indexing rule. + # @param body [TagIndexingRuleUpdateRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(TagIndexingRuleResponse, Integer, Hash)>] TagIndexingRuleResponse data, response status code and response headers + def update_tag_indexing_rule_with_http_info(id, body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MetricsAPI.update_tag_indexing_rule ...' + 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 MetricsAPI.update_tag_indexing_rule" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling MetricsAPI.update_tag_indexing_rule" + end + # resource path + local_var_path = '/api/v2/metrics/tag-indexing-rules/{id}'.sub('{id}', CGI.escape(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']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'TagIndexingRuleResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :update_tag_indexing_rule, + :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::Put, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MetricsAPI#update_tag_indexing_rule\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/tag_indexing_rule_attributes.rb b/lib/datadog_api_client/v2/models/tag_indexing_rule_attributes.rb new file mode 100644 index 000000000000..c392061d7be1 --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_indexing_rule_attributes.rb @@ -0,0 +1,211 @@ +=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 + # Attributes of a tag indexing rule. + class TagIndexingRuleAttributes + include BaseGenericModel + + # Timestamp when the rule was created. + attr_accessor :created_at + + # Handle of the user who created the rule. + attr_accessor :created_by_handle + + # When true, the rule excludes the listed tags and indexes all others. When false (default), the rule includes only the listed tags. + attr_accessor :exclude_tags_mode + + # Metric name prefixes excluded from the rule's scope. + attr_accessor :ignored_metric_name_matches + + # Metric name prefixes (glob patterns) this rule applies to. + attr_accessor :metric_name_matches + + # Timestamp when the rule was last modified. + attr_accessor :modified_at + + # Handle of the user who last modified the rule. + attr_accessor :modified_by_handle + + # Human-readable name for the rule. + attr_accessor :name + + # Versioned configuration options for a tag indexing rule. + attr_accessor :options + + # Evaluation order within the org. Lower values are evaluated first. Assigned server-side on create (max+1); pass on update to change the rule's position. + attr_accessor :rule_order + + # Tag keys managed by this rule. + attr_accessor :tags + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'created_at' => :'created_at', + :'created_by_handle' => :'created_by_handle', + :'exclude_tags_mode' => :'exclude_tags_mode', + :'ignored_metric_name_matches' => :'ignored_metric_name_matches', + :'metric_name_matches' => :'metric_name_matches', + :'modified_at' => :'modified_at', + :'modified_by_handle' => :'modified_by_handle', + :'name' => :'name', + :'options' => :'options', + :'rule_order' => :'rule_order', + :'tags' => :'tags' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'created_at' => :'Time', + :'created_by_handle' => :'String', + :'exclude_tags_mode' => :'Boolean', + :'ignored_metric_name_matches' => :'Array', + :'metric_name_matches' => :'Array', + :'modified_at' => :'Time', + :'modified_by_handle' => :'String', + :'name' => :'String', + :'options' => :'TagIndexingRuleOptions', + :'rule_order' => :'Integer', + :'tags' => :'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::TagIndexingRuleAttributes` 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?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'created_by_handle') + self.created_by_handle = attributes[:'created_by_handle'] + end + + if attributes.key?(:'exclude_tags_mode') + self.exclude_tags_mode = attributes[:'exclude_tags_mode'] + end + + if attributes.key?(:'ignored_metric_name_matches') + if (value = attributes[:'ignored_metric_name_matches']).is_a?(Array) + self.ignored_metric_name_matches = value + end + end + + if attributes.key?(:'metric_name_matches') + if (value = attributes[:'metric_name_matches']).is_a?(Array) + self.metric_name_matches = value + end + end + + if attributes.key?(:'modified_at') + self.modified_at = attributes[:'modified_at'] + end + + if attributes.key?(:'modified_by_handle') + self.modified_by_handle = attributes[:'modified_by_handle'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'options') + self.options = attributes[:'options'] + end + + if attributes.key?(:'rule_order') + self.rule_order = attributes[:'rule_order'] + end + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + 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 && + created_at == o.created_at && + created_by_handle == o.created_by_handle && + exclude_tags_mode == o.exclude_tags_mode && + ignored_metric_name_matches == o.ignored_metric_name_matches && + metric_name_matches == o.metric_name_matches && + modified_at == o.modified_at && + modified_by_handle == o.modified_by_handle && + name == o.name && + options == o.options && + rule_order == o.rule_order && + tags == o.tags && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [created_at, created_by_handle, exclude_tags_mode, ignored_metric_name_matches, metric_name_matches, modified_at, modified_by_handle, name, options, rule_order, tags, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/tag_indexing_rule_create_attributes.rb b/lib/datadog_api_client/v2/models/tag_indexing_rule_create_attributes.rb new file mode 100644 index 000000000000..792a3f085c29 --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_indexing_rule_create_attributes.rb @@ -0,0 +1,190 @@ +=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 + # Attributes for creating a tag indexing rule. + class TagIndexingRuleCreateAttributes + include BaseGenericModel + + # When true, the rule excludes the listed tags and indexes all others. When false (default), the rule includes only the listed tags. + attr_accessor :exclude_tags_mode + + # Metric name prefixes excluded from the rule's scope. + attr_accessor :ignored_metric_name_matches + + # Metric name prefixes (glob patterns) this rule applies to. + attr_reader :metric_name_matches + + # Human-readable name for the rule. + attr_reader :name + + # Versioned configuration options for a tag indexing rule. + attr_accessor :options + + # Tag keys managed by this rule. + attr_accessor :tags + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'exclude_tags_mode' => :'exclude_tags_mode', + :'ignored_metric_name_matches' => :'ignored_metric_name_matches', + :'metric_name_matches' => :'metric_name_matches', + :'name' => :'name', + :'options' => :'options', + :'tags' => :'tags' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'exclude_tags_mode' => :'Boolean', + :'ignored_metric_name_matches' => :'Array', + :'metric_name_matches' => :'Array', + :'name' => :'String', + :'options' => :'TagIndexingRuleOptions', + :'tags' => :'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::TagIndexingRuleCreateAttributes` 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?(:'exclude_tags_mode') + self.exclude_tags_mode = attributes[:'exclude_tags_mode'] + end + + if attributes.key?(:'ignored_metric_name_matches') + if (value = attributes[:'ignored_metric_name_matches']).is_a?(Array) + self.ignored_metric_name_matches = value + end + end + + if attributes.key?(:'metric_name_matches') + if (value = attributes[:'metric_name_matches']).is_a?(Array) + self.metric_name_matches = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'options') + self.options = attributes[:'options'] + end + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = 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 @metric_name_matches.nil? + return false if @name.nil? + true + end + + # Custom attribute writer method with validation + # @param metric_name_matches [Object] Object to be assigned + # @!visibility private + def metric_name_matches=(metric_name_matches) + if metric_name_matches.nil? + fail ArgumentError, 'invalid value for "metric_name_matches", metric_name_matches cannot be nil.' + end + @metric_name_matches = metric_name_matches + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + 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 && + exclude_tags_mode == o.exclude_tags_mode && + ignored_metric_name_matches == o.ignored_metric_name_matches && + metric_name_matches == o.metric_name_matches && + name == o.name && + options == o.options && + tags == o.tags && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [exclude_tags_mode, ignored_metric_name_matches, metric_name_matches, name, options, tags, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/tag_indexing_rule_create_data.rb b/lib/datadog_api_client/v2/models/tag_indexing_rule_create_data.rb new file mode 100644 index 000000000000..e54953cf756e --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_indexing_rule_create_data.rb @@ -0,0 +1,144 @@ +=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 + # Data object for creating a tag indexing rule. + class TagIndexingRuleCreateData + include BaseGenericModel + + # Attributes for creating a tag indexing rule. + attr_reader :attributes + + # The tag indexing rule 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', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'TagIndexingRuleCreateAttributes', + :'type' => :'TagIndexingRuleType' + } + 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::TagIndexingRuleCreateData` 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?(:'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 @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 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 && + 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, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/tag_indexing_rule_create_request.rb b/lib/datadog_api_client/v2/models/tag_indexing_rule_create_request.rb new file mode 100644 index 000000000000..ec78a829b5b2 --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_indexing_rule_create_request.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 + # Request body for creating a tag indexing rule. + class TagIndexingRuleCreateRequest + include BaseGenericModel + + # Data object for creating a tag indexing rule. + 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' => :'TagIndexingRuleCreateData' + } + 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::TagIndexingRuleCreateRequest` 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/tag_indexing_rule_data.rb b/lib/datadog_api_client/v2/models/tag_indexing_rule_data.rb new file mode 100644 index 000000000000..73484d958680 --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_indexing_rule_data.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 + # A tag indexing rule resource object. + class TagIndexingRuleData + include BaseGenericModel + + # Attributes of a tag indexing rule. + attr_accessor :attributes + + # The unique identifier (UUID) of the tag indexing rule. + attr_accessor :id + + # The tag indexing rule resource type. + attr_accessor :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' => :'TagIndexingRuleAttributes', + :'id' => :'String', + :'type' => :'TagIndexingRuleType' + } + 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::TagIndexingRuleData` 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 + + # 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/tag_indexing_rule_dynamic_tags.rb b/lib/datadog_api_client/v2/models/tag_indexing_rule_dynamic_tags.rb new file mode 100644 index 000000000000..3e8e296e4030 --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_indexing_rule_dynamic_tags.rb @@ -0,0 +1,115 @@ +=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 + # Configuration for including dynamically queried tags. + class TagIndexingRuleDynamicTags + include BaseGenericModel + + # Window in seconds for evaluating queried tags. + attr_accessor :queried_tags_window_seconds + + # When true, tags from related assets are included. + attr_accessor :related_asset_tags + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'queried_tags_window_seconds' => :'queried_tags_window_seconds', + :'related_asset_tags' => :'related_asset_tags' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'queried_tags_window_seconds' => :'Integer', + :'related_asset_tags' => :'Boolean' + } + 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::TagIndexingRuleDynamicTags` 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?(:'queried_tags_window_seconds') + self.queried_tags_window_seconds = attributes[:'queried_tags_window_seconds'] + end + + if attributes.key?(:'related_asset_tags') + self.related_asset_tags = attributes[:'related_asset_tags'] + 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 && + queried_tags_window_seconds == o.queried_tags_window_seconds && + related_asset_tags == o.related_asset_tags && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [queried_tags_window_seconds, related_asset_tags, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/tag_indexing_rule_exemption_attributes.rb b/lib/datadog_api_client/v2/models/tag_indexing_rule_exemption_attributes.rb new file mode 100644 index 000000000000..1edfd6b79c47 --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_indexing_rule_exemption_attributes.rb @@ -0,0 +1,135 @@ +=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 + # Attributes of a tag indexing rule exemption. + class TagIndexingRuleExemptionAttributes + include BaseGenericModel + + # Timestamp when the exemption was created. + attr_accessor :created_at + + # Handle of the user who created the exemption. + attr_accessor :created_by_handle + + # Discriminates between an explicit exemption (`exemption`) and a pre-existing legacy tag configuration acting as an implicit exclusion (`legacy_tag_configuration`). + attr_accessor :kind + + # The reason the metric is exempt from tag indexing rules. + attr_accessor :reason + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'created_at' => :'created_at', + :'created_by_handle' => :'created_by_handle', + :'kind' => :'kind', + :'reason' => :'reason' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'created_at' => :'Time', + :'created_by_handle' => :'String', + :'kind' => :'String', + :'reason' => :'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::TagIndexingRuleExemptionAttributes` 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?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'created_by_handle') + self.created_by_handle = attributes[:'created_by_handle'] + end + + if attributes.key?(:'kind') + self.kind = attributes[:'kind'] + end + + if attributes.key?(:'reason') + self.reason = attributes[:'reason'] + 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 && + created_at == o.created_at && + created_by_handle == o.created_by_handle && + kind == o.kind && + reason == o.reason && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [created_at, created_by_handle, kind, reason, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/tag_indexing_rule_exemption_create_attributes.rb b/lib/datadog_api_client/v2/models/tag_indexing_rule_exemption_create_attributes.rb new file mode 100644 index 000000000000..62114ffd21f6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_indexing_rule_exemption_create_attributes.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 + # Attributes for creating a tag indexing rule exemption. + class TagIndexingRuleExemptionCreateAttributes + include BaseGenericModel + + # The reason the metric is exempt from tag indexing rules. + attr_reader :reason + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'reason' => :'reason' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'reason' => :'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::TagIndexingRuleExemptionCreateAttributes` 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?(:'reason') + self.reason = attributes[:'reason'] + 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 @reason.nil? + true + end + + # Custom attribute writer method with validation + # @param reason [Object] Object to be assigned + # @!visibility private + def reason=(reason) + if reason.nil? + fail ArgumentError, 'invalid value for "reason", reason cannot be nil.' + end + @reason = reason + 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 && + reason == o.reason && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [reason, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/tag_indexing_rule_exemption_create_data.rb b/lib/datadog_api_client/v2/models/tag_indexing_rule_exemption_create_data.rb new file mode 100644 index 000000000000..c5f69f78836a --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_indexing_rule_exemption_create_data.rb @@ -0,0 +1,144 @@ +=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 + # Data object for creating a tag indexing rule exemption. + class TagIndexingRuleExemptionCreateData + include BaseGenericModel + + # Attributes for creating a tag indexing rule exemption. + attr_reader :attributes + + # The tag indexing rule exemption 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', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'TagIndexingRuleExemptionCreateAttributes', + :'type' => :'TagIndexingRuleExemptionType' + } + 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::TagIndexingRuleExemptionCreateData` 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?(:'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 @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 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 && + 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, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/tag_indexing_rule_exemption_create_request.rb b/lib/datadog_api_client/v2/models/tag_indexing_rule_exemption_create_request.rb new file mode 100644 index 000000000000..ec6882296b51 --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_indexing_rule_exemption_create_request.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 + # Request body for creating a tag indexing rule exemption. + class TagIndexingRuleExemptionCreateRequest + include BaseGenericModel + + # Data object for creating a tag indexing rule exemption. + 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' => :'TagIndexingRuleExemptionCreateData' + } + 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::TagIndexingRuleExemptionCreateRequest` 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/tag_indexing_rule_exemption_data.rb b/lib/datadog_api_client/v2/models/tag_indexing_rule_exemption_data.rb new file mode 100644 index 000000000000..f4902087dd49 --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_indexing_rule_exemption_data.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 + # A tag indexing rule exemption resource object. + class TagIndexingRuleExemptionData + include BaseGenericModel + + # Attributes of a tag indexing rule exemption. + attr_accessor :attributes + + # The metric name, used as the resource ID. + attr_accessor :id + + # The tag indexing rule exemption resource type. + attr_accessor :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' => :'TagIndexingRuleExemptionAttributes', + :'id' => :'String', + :'type' => :'TagIndexingRuleExemptionType' + } + 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::TagIndexingRuleExemptionData` 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 + + # 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/tag_indexing_rule_exemption_response.rb b/lib/datadog_api_client/v2/models/tag_indexing_rule_exemption_response.rb new file mode 100644 index 000000000000..691d139088d6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_indexing_rule_exemption_response.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 containing a tag indexing rule exemption. + class TagIndexingRuleExemptionResponse + include BaseGenericModel + + # A tag indexing rule exemption resource object. + attr_accessor :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' => :'TagIndexingRuleExemptionData' + } + 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::TagIndexingRuleExemptionResponse` 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 + + # 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/tag_indexing_rule_exemption_type.rb b/lib/datadog_api_client/v2/models/tag_indexing_rule_exemption_type.rb new file mode 100644 index 000000000000..4de080eff43b --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_indexing_rule_exemption_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 tag indexing rule exemption resource type. + class TagIndexingRuleExemptionType + include BaseEnumModel + + TAG_INDEXING_RULE_EXEMPTIONS = "tag_indexing_rule_exemptions".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/tag_indexing_rule_metric_match.rb b/lib/datadog_api_client/v2/models/tag_indexing_rule_metric_match.rb new file mode 100644 index 000000000000..a1c32d6918d8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_indexing_rule_metric_match.rb @@ -0,0 +1,145 @@ +=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 + # Criteria for matching metrics based on query state. + class TagIndexingRuleMetricMatch + include BaseGenericModel + + # Match metrics that are being queried. + attr_accessor :is_queried + + # Match metrics that are not being queried. + attr_accessor :not_queried + + # Match metrics not used in any dashboards or monitors. + attr_accessor :not_used_in_assets + + # Window in seconds for evaluating query state. + attr_accessor :queried_window_seconds + + # Match metrics used in dashboards or monitors. + attr_accessor :used_in_assets + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'is_queried' => :'is_queried', + :'not_queried' => :'not_queried', + :'not_used_in_assets' => :'not_used_in_assets', + :'queried_window_seconds' => :'queried_window_seconds', + :'used_in_assets' => :'used_in_assets' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'is_queried' => :'Boolean', + :'not_queried' => :'Boolean', + :'not_used_in_assets' => :'Boolean', + :'queried_window_seconds' => :'Integer', + :'used_in_assets' => :'Boolean' + } + 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::TagIndexingRuleMetricMatch` 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?(:'is_queried') + self.is_queried = attributes[:'is_queried'] + end + + if attributes.key?(:'not_queried') + self.not_queried = attributes[:'not_queried'] + end + + if attributes.key?(:'not_used_in_assets') + self.not_used_in_assets = attributes[:'not_used_in_assets'] + end + + if attributes.key?(:'queried_window_seconds') + self.queried_window_seconds = attributes[:'queried_window_seconds'] + end + + if attributes.key?(:'used_in_assets') + self.used_in_assets = attributes[:'used_in_assets'] + 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 && + is_queried == o.is_queried && + not_queried == o.not_queried && + not_used_in_assets == o.not_used_in_assets && + queried_window_seconds == o.queried_window_seconds && + used_in_assets == o.used_in_assets && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [is_queried, not_queried, not_used_in_assets, queried_window_seconds, used_in_assets, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/tag_indexing_rule_options.rb b/lib/datadog_api_client/v2/models/tag_indexing_rule_options.rb new file mode 100644 index 000000000000..d4f18fb3701a --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_indexing_rule_options.rb @@ -0,0 +1,115 @@ +=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 + # Versioned configuration options for a tag indexing rule. + class TagIndexingRuleOptions + include BaseGenericModel + + # Data payload for tag indexing rule options. + attr_accessor :data + + # Options schema version. Only `1` is supported. + attr_accessor :version + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'version' => :'version' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'TagIndexingRuleOptionsData', + :'version' => :'Integer' + } + 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::TagIndexingRuleOptions` 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 + + if attributes.key?(:'version') + self.version = attributes[:'version'] + 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 && + data == o.data && + version == o.version && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, version, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/tag_indexing_rule_options_data.rb b/lib/datadog_api_client/v2/models/tag_indexing_rule_options_data.rb new file mode 100644 index 000000000000..277bc0925a98 --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_indexing_rule_options_data.rb @@ -0,0 +1,135 @@ +=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 + # Data payload for tag indexing rule options. + class TagIndexingRuleOptionsData + include BaseGenericModel + + # Configuration for including dynamically queried tags. + attr_accessor :dynamic_tags + + # When true, the rule applies to metrics that were ingested before the rule was created. + attr_accessor :manage_preexisting_metrics + + # Criteria for matching metrics based on query state. + attr_accessor :metric_match + + # When true, this rule's tag list overrides tags configured by earlier rules for the same metric. When false (default), tags from all matching rules are combined. + attr_accessor :override_previous_rules + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'dynamic_tags' => :'dynamic_tags', + :'manage_preexisting_metrics' => :'manage_preexisting_metrics', + :'metric_match' => :'metric_match', + :'override_previous_rules' => :'override_previous_rules' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'dynamic_tags' => :'TagIndexingRuleDynamicTags', + :'manage_preexisting_metrics' => :'Boolean', + :'metric_match' => :'TagIndexingRuleMetricMatch', + :'override_previous_rules' => :'Boolean' + } + 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::TagIndexingRuleOptionsData` 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?(:'dynamic_tags') + self.dynamic_tags = attributes[:'dynamic_tags'] + end + + if attributes.key?(:'manage_preexisting_metrics') + self.manage_preexisting_metrics = attributes[:'manage_preexisting_metrics'] + end + + if attributes.key?(:'metric_match') + self.metric_match = attributes[:'metric_match'] + end + + if attributes.key?(:'override_previous_rules') + self.override_previous_rules = attributes[:'override_previous_rules'] + 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 && + dynamic_tags == o.dynamic_tags && + manage_preexisting_metrics == o.manage_preexisting_metrics && + metric_match == o.metric_match && + override_previous_rules == o.override_previous_rules && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [dynamic_tags, manage_preexisting_metrics, metric_match, override_previous_rules, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/tag_indexing_rule_order_attributes.rb b/lib/datadog_api_client/v2/models/tag_indexing_rule_order_attributes.rb new file mode 100644 index 000000000000..2daea2f3c212 --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_indexing_rule_order_attributes.rb @@ -0,0 +1,107 @@ +=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 + # Attributes for the reorder operation. + class TagIndexingRuleOrderAttributes + include BaseGenericModel + + # Ordered list of tag indexing rule UUIDs. The server assigns rule_order 1, 2, … matching position in this list. + attr_accessor :rule_ids + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'rule_ids' => :'rule_ids' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'rule_ids' => :'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::TagIndexingRuleOrderAttributes` 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?(:'rule_ids') + if (value = attributes[:'rule_ids']).is_a?(Array) + self.rule_ids = value + end + 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 && + rule_ids == o.rule_ids && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [rule_ids, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/tag_indexing_rule_order_data.rb b/lib/datadog_api_client/v2/models/tag_indexing_rule_order_data.rb new file mode 100644 index 000000000000..dd2a1d1baf34 --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_indexing_rule_order_data.rb @@ -0,0 +1,144 @@ +=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 + # Data object for the reorder operation. + class TagIndexingRuleOrderData + include BaseGenericModel + + # Attributes for the reorder operation. + attr_reader :attributes + + # The tag indexing rule 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', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'TagIndexingRuleOrderAttributes', + :'type' => :'TagIndexingRuleType' + } + 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::TagIndexingRuleOrderData` 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?(:'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 @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 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 && + 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, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/tag_indexing_rule_order_request.rb b/lib/datadog_api_client/v2/models/tag_indexing_rule_order_request.rb new file mode 100644 index 000000000000..7d117b3a08de --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_indexing_rule_order_request.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 + # Request body for reordering tag indexing rules. + class TagIndexingRuleOrderRequest + include BaseGenericModel + + # Data object for the reorder operation. + 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' => :'TagIndexingRuleOrderData' + } + 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::TagIndexingRuleOrderRequest` 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/tag_indexing_rule_response.rb b/lib/datadog_api_client/v2/models/tag_indexing_rule_response.rb new file mode 100644 index 000000000000..25579b66ae5c --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_indexing_rule_response.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 containing a single tag indexing rule. + class TagIndexingRuleResponse + include BaseGenericModel + + # A tag indexing rule resource object. + attr_accessor :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' => :'TagIndexingRuleData' + } + 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::TagIndexingRuleResponse` 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 + + # 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/tag_indexing_rule_type.rb b/lib/datadog_api_client/v2/models/tag_indexing_rule_type.rb new file mode 100644 index 000000000000..0e68863fdac0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_indexing_rule_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 tag indexing rule resource type. + class TagIndexingRuleType + include BaseEnumModel + + TAG_INDEXING_RULES = "tag_indexing_rules".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/tag_indexing_rule_update_attributes.rb b/lib/datadog_api_client/v2/models/tag_indexing_rule_update_attributes.rb new file mode 100644 index 000000000000..388e60256cff --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_indexing_rule_update_attributes.rb @@ -0,0 +1,171 @@ +=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 + # Attributes for updating a tag indexing rule. All fields are optional; omitted fields are unchanged. + class TagIndexingRuleUpdateAttributes + include BaseGenericModel + + # When true, the rule excludes the listed tags and indexes all others. + attr_accessor :exclude_tags_mode + + # Metric name prefixes excluded from the rule's scope. + attr_accessor :ignored_metric_name_matches + + # Metric name prefixes (glob patterns) this rule applies to. + attr_accessor :metric_name_matches + + # Human-readable name for the rule. + attr_accessor :name + + # Versioned configuration options for a tag indexing rule. + attr_accessor :options + + # Desired evaluation order. Returns 409 if the value conflicts with another rule; use POST /api/v2/metrics/tag-indexing-rules/order for atomic re-sequencing. + attr_accessor :rule_order + + # Tag keys managed by this rule. + attr_accessor :tags + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'exclude_tags_mode' => :'exclude_tags_mode', + :'ignored_metric_name_matches' => :'ignored_metric_name_matches', + :'metric_name_matches' => :'metric_name_matches', + :'name' => :'name', + :'options' => :'options', + :'rule_order' => :'rule_order', + :'tags' => :'tags' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'exclude_tags_mode' => :'Boolean', + :'ignored_metric_name_matches' => :'Array', + :'metric_name_matches' => :'Array', + :'name' => :'String', + :'options' => :'TagIndexingRuleOptions', + :'rule_order' => :'Integer', + :'tags' => :'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::TagIndexingRuleUpdateAttributes` 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?(:'exclude_tags_mode') + self.exclude_tags_mode = attributes[:'exclude_tags_mode'] + end + + if attributes.key?(:'ignored_metric_name_matches') + if (value = attributes[:'ignored_metric_name_matches']).is_a?(Array) + self.ignored_metric_name_matches = value + end + end + + if attributes.key?(:'metric_name_matches') + if (value = attributes[:'metric_name_matches']).is_a?(Array) + self.metric_name_matches = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'options') + self.options = attributes[:'options'] + end + + if attributes.key?(:'rule_order') + self.rule_order = attributes[:'rule_order'] + end + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + 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 && + exclude_tags_mode == o.exclude_tags_mode && + ignored_metric_name_matches == o.ignored_metric_name_matches && + metric_name_matches == o.metric_name_matches && + name == o.name && + options == o.options && + rule_order == o.rule_order && + tags == o.tags && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [exclude_tags_mode, ignored_metric_name_matches, metric_name_matches, name, options, rule_order, tags, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/tag_indexing_rule_update_data.rb b/lib/datadog_api_client/v2/models/tag_indexing_rule_update_data.rb new file mode 100644 index 000000000000..cf88e51c90f8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_indexing_rule_update_data.rb @@ -0,0 +1,133 @@ +=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 + # Data object for updating a tag indexing rule. + class TagIndexingRuleUpdateData + include BaseGenericModel + + # Attributes for updating a tag indexing rule. All fields are optional; omitted fields are unchanged. + attr_accessor :attributes + + # The tag indexing rule 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', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'TagIndexingRuleUpdateAttributes', + :'type' => :'TagIndexingRuleType' + } + 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::TagIndexingRuleUpdateData` 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?(:'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 @type.nil? + true + 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 && + 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, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/tag_indexing_rule_update_request.rb b/lib/datadog_api_client/v2/models/tag_indexing_rule_update_request.rb new file mode 100644 index 000000000000..d560398480a2 --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_indexing_rule_update_request.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 + # Request body for updating a tag indexing rule. + class TagIndexingRuleUpdateRequest + include BaseGenericModel + + # Data object for updating a tag indexing rule. + 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' => :'TagIndexingRuleUpdateData' + } + 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::TagIndexingRuleUpdateRequest` 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/tag_indexing_rules_response.rb b/lib/datadog_api_client/v2/models/tag_indexing_rules_response.rb new file mode 100644 index 000000000000..93a63c293c80 --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_indexing_rules_response.rb @@ -0,0 +1,117 @@ +=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 a page of tag indexing rules. + class TagIndexingRulesResponse + include BaseGenericModel + + # Array of tag indexing rule objects. + attr_accessor :data + + # Pagination metadata for a list of tag indexing rules. + 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', + :'meta' => :'meta' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array', + :'meta' => :'TagIndexingRulesResponseMeta' + } + 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::TagIndexingRulesResponse` 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?(:'meta') + self.meta = attributes[:'meta'] + 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 && + data == o.data && + meta == o.meta && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, meta, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/tag_indexing_rules_response_meta.rb b/lib/datadog_api_client/v2/models/tag_indexing_rules_response_meta.rb new file mode 100644 index 000000000000..6b5fd473a0eb --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_indexing_rules_response_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 + # Pagination metadata for a list of tag indexing rules. + class TagIndexingRulesResponseMeta + include BaseGenericModel + + # Total number of tag indexing rules in the org. + attr_accessor :total + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'total' => :'total' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'total' => :'Integer' + } + 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::TagIndexingRulesResponseMeta` 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?(:'total') + self.total = attributes[:'total'] + 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 && + total == o.total && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [total, additional_properties].hash + end + end +end