From 50783e27a63205dcc826aa66c347db48116f3d38 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 13 Nov 2026 10:58:58 +0000 Subject: [PATCH] Regenerate client from commit dc703f1 of spec repo --- .generator/schemas/v2/openapi.yaml | 446 +++++++++++++++++- .../v2/ai-gateway/CreateAiGatewayRateLimit.rb | 9 + .../GetAiGatewayRateLimitInstancesSummary.rb | 9 + .../ListAiGatewayRateLimitInstances.rb | 9 + features/scenarios_model_mapping.rb | 11 + features/v2/ai_gateway.feature | 54 ++- features/v2/undo.json | 12 + lib/datadog_api_client/configuration.rb | 2 + lib/datadog_api_client/inflector.rb | 10 + .../v2/api/ai_gateway_api.rb | 171 ++++++- .../ai_gateway_rate_limit_attributes.rb | 43 +- ...ai_gateway_rate_limit_create_attributes.rb | 15 +- ..._gateway_rate_limit_instance_attributes.rb | 394 ++++++++++++++++ ...teway_rate_limit_instance_list_response.rb | 125 +++++ ...ai_gateway_rate_limit_instance_resource.rb | 165 +++++++ .../ai_gateway_rate_limit_instance_sort.rb | 28 ++ .../ai_gateway_rate_limit_instance_type.rb | 26 + ...rate_limit_instances_summary_attributes.rb | 258 ++++++++++ ...y_rate_limit_instances_summary_resource.rb | 165 +++++++ ...y_rate_limit_instances_summary_response.rb | 123 +++++ ...teway_rate_limit_instances_summary_type.rb | 26 + .../ai_gateway_rate_limit_selector_entry.rb | 167 +++++++ 22 files changed, 2253 insertions(+), 15 deletions(-) create mode 100644 examples/v2/ai-gateway/GetAiGatewayRateLimitInstancesSummary.rb create mode 100644 examples/v2/ai-gateway/ListAiGatewayRateLimitInstances.rb create mode 100644 lib/datadog_api_client/v2/models/ai_gateway_rate_limit_instance_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/ai_gateway_rate_limit_instance_list_response.rb create mode 100644 lib/datadog_api_client/v2/models/ai_gateway_rate_limit_instance_resource.rb create mode 100644 lib/datadog_api_client/v2/models/ai_gateway_rate_limit_instance_sort.rb create mode 100644 lib/datadog_api_client/v2/models/ai_gateway_rate_limit_instance_type.rb create mode 100644 lib/datadog_api_client/v2/models/ai_gateway_rate_limit_instances_summary_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/ai_gateway_rate_limit_instances_summary_resource.rb create mode 100644 lib/datadog_api_client/v2/models/ai_gateway_rate_limit_instances_summary_response.rb create mode 100644 lib/datadog_api_client/v2/models/ai_gateway_rate_limit_instances_summary_type.rb create mode 100644 lib/datadog_api_client/v2/models/ai_gateway_rate_limit_selector_entry.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 0e7b8a86740e..54ca38f72fdd 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -325,6 +325,47 @@ components: schema: format: uuid type: string + AiGatewayRateLimitInstanceLimit: + description: Maximum number of rate limit counters to return. + in: query + name: limit + required: false + schema: + default: 50 + format: int64 + maximum: 500 + minimum: 1 + type: integer + AiGatewayRateLimitInstanceOffset: + description: Number of rate limit counters to skip. + in: query + name: offset + required: false + schema: + default: 0 + format: int64 + minimum: 0 + type: integer + AiGatewayRateLimitInstanceSort: + description: Sort order for rate limit counters. + in: query + name: sort + required: false + schema: + $ref: "#/components/schemas/AiGatewayRateLimitInstanceSort" + AiGatewayRateLimitInstanceSplitDim: + description: Keep only counters whose split dimension equals a value, written as `=`, such as `split_dim=user_id=&split_dim=model=gpt-4o`. Dimensions use the `split_dims` names `user_id`, `team_id`, `model`, `provider`, and `tag:`. Repeat the parameter to filter on several dimensions; a counter must match all of them. Each dimension may appear once and must be a per-value dimension of the rate limit. + example: + - user_id=11111111-1111-1111-1111-111111111111 + explode: true + in: query + name: split_dim + required: false + schema: + items: + type: string + type: array + style: form AiGatewayRoutingRuleForceDelete: description: Delete referencing tiers and recursively delete parent rules left without tiers. in: query @@ -11329,13 +11370,17 @@ components: example: true type: boolean input_tokens_per_minute: - description: Maximum input tokens per rolling minute shared by all matching traffic. Null when this rule does not limit input tokens. + description: Maximum input tokens per rolling minute shared by all matching traffic, or per counter for a template rate limit. Null when this rule does not limit input tokens. example: 500000 format: int64 maximum: 100000000000 minimum: 1 nullable: true type: integer + is_template: + description: Whether the selector gives each matching value its own allowance, that is, whether it has at least one per_value entry. Returned even when scope_restricted hides the selector. + example: false + type: boolean mode: $ref: "#/components/schemas/AiGatewayRateLimitMode" monitor_id: @@ -11349,7 +11394,7 @@ components: example: Default rate limit type: string output_tokens_per_minute: - description: Maximum output tokens per rolling minute shared by all matching traffic. Null when this rule does not limit output tokens. + description: Maximum output tokens per rolling minute shared by all matching traffic, or per counter for a template rate limit. Null when this rule does not limit output tokens. example: 200000 format: int64 maximum: 100000000000 @@ -11357,7 +11402,7 @@ components: nullable: true type: integer requests_per_minute: - description: Maximum requests per rolling minute shared by all matching traffic. Null when this rule does not limit requests. + description: Maximum requests per rolling minute shared by all matching traffic, or per counter for a template rate limit. Null when this rule does not limit requests. example: 1000 format: int64 maximum: 10000000 @@ -11373,6 +11418,8 @@ components: description: Whether provider or model scope metadata was withheld. Omit unchanged scope fields on an unrelated update to preserve their saved values. example: false type: boolean + selector: + $ref: "#/components/schemas/AiGatewayRateLimitSelector" tags: additionalProperties: type: string @@ -11386,6 +11433,13 @@ components: format: uuid nullable: true type: string + template_split_dims: + description: Dimensions of the selector's per_value entries, such as user_id or tag:env, each matching value of which gets its own allowance. Empty unless is_template is true. Returned even when scope_restricted hides the selector. + example: [] + items: + description: A selector dimension, such as user_id, team_id, model, provider, or tag:. + type: string + type: array updated_at: description: Last modification timestamp. example: "2026-09-15T14:30:00Z" @@ -11444,6 +11498,8 @@ components: minimum: 1 nullable: true type: integer + selector: + $ref: "#/components/schemas/AiGatewayRateLimitSelector" tags: additionalProperties: type: string @@ -11481,6 +11537,236 @@ components: required: - data type: object + AiGatewayRateLimitInstanceAttributes: + description: One counter of a template rate limit and its live usage. + properties: + first_seen: + description: When the gateway first recorded a request for this counter. + example: "2026-10-28T10:00:00Z" + format: date-time + type: string + input_tokens: + description: Input tokens counted in the rolling one-minute window. + example: 15000 + format: int64 + type: integer + input_tokens_per_minute: + description: The rate limit's per-counter input token limit. Null when it doesn't limit input tokens. + example: 100000 + format: int64 + nullable: true + type: integer + instance_key: + description: Opaque canonical key identifying the counter. + example: "v1|7:user_id=36:11111111-1111-1111-1111-111111111111" + type: string + last_seen: + description: When the gateway last recorded a request for this counter; up to a few minutes behind live traffic. + example: "2026-10-28T10:05:00Z" + format: date-time + type: string + limited_requests: + description: Requests this counter rejected in the last 15 minutes (ENFORCE). + example: 0 + format: int64 + type: integer + output_tokens: + description: Output tokens counted in the rolling one-minute window. + example: 4000 + format: int64 + type: integer + output_tokens_per_minute: + description: The rate limit's per-counter output token limit. Null when it doesn't limit output tokens. + example: 20000 + format: int64 + nullable: true + type: integer + rate_limit_id: + description: Rate limit UUID. + example: 33333333-3333-3333-3333-333333333333 + format: uuid + type: string + requests: + description: Requests counted in the rolling one-minute window. + example: 42 + format: int64 + type: integer + requests_per_minute: + description: The rate limit's per-counter request limit. Null when it doesn't limit requests. + example: 60 + format: int64 + nullable: true + type: integer + split_dims: + additionalProperties: + type: string + description: The counter's value for each per-value dimension. user_id and team_id values are raw UUIDs. + example: + user_id: 11111111-1111-1111-1111-111111111111 + type: object + usage_known: + description: False when this counter's usage wasn't read because the request already read the most counters it may. Its usage then reads as zero. + example: true + type: boolean + utilization: + description: The fullest of the rate limit's limits in the rolling window, as a fraction. 1 or more means the counter is at its limit. + example: 0.7 + format: double + type: number + would_limit_requests: + description: Requests this counter would have rejected in the last 15 minutes (ALERT). + example: 0 + format: int64 + type: integer + required: + - rate_limit_id + - instance_key + - split_dims + - first_seen + - last_seen + - requests + - input_tokens + - output_tokens + - limited_requests + - would_limit_requests + - utilization + - usage_known + type: object + AiGatewayRateLimitInstanceListResponse: + description: Response containing counters of a template rate limit. + properties: + data: + items: + $ref: "#/components/schemas/AiGatewayRateLimitInstanceResource" + description: One counter of a template rate limit. + type: array + required: + - data + type: object + AiGatewayRateLimitInstanceResource: + description: One counter of a template rate limit. + properties: + attributes: + $ref: "#/components/schemas/AiGatewayRateLimitInstanceAttributes" + id: + description: Counter ID, the rate limit UUID and instance key joined by `|`. + example: "33333333-3333-3333-3333-333333333333|v1|7:user_id=36:11111111-1111-1111-1111-111111111111" + type: string + type: + $ref: "#/components/schemas/AiGatewayRateLimitInstanceType" + required: + - type + - id + - attributes + type: object + AiGatewayRateLimitInstanceSort: + default: utilization_desc + description: Sort order for rate limit counters. + enum: + - utilization_desc + - last_seen_desc + - key_asc + example: utilization_desc + type: string + x-enum-varnames: + - UTILIZATION_DESC + - LAST_SEEN_DESC + - KEY_ASC + AiGatewayRateLimitInstanceType: + description: AI Gateway rate limit counter resource type. + enum: + - rate-limit-instances + example: rate-limit-instances + type: string + x-enum-varnames: + - RATE_LIMIT_INSTANCES + AiGatewayRateLimitInstancesSummaryAttributes: + description: Aggregate of a template rate limit's counters. + properties: + instance_count: + description: Number of counters. + example: 14 + format: int64 + type: integer + limited_requests: + description: Requests the counters rejected in the last 15 minutes (ENFORCE), totaled over the counters whose usage was read. + example: 25 + format: int64 + type: integer + limiting_count: + description: Counters that limited, or would have limited, a request in the last 15 minutes. + example: 2 + format: int64 + type: integer + max_utilization: + description: Utilization of the fullest counter. + example: 1.2 + format: double + type: number + near_limit_count: + description: Counters at 80% or more of a limit in the rolling window. + example: 3 + format: int64 + type: integer + rate_limit_id: + description: Rate limit UUID. + example: 33333333-3333-3333-3333-333333333333 + format: uuid + type: string + scope_restricted: + description: True when the caller can't see the template's selector because it lists a provider or model the caller can't access. The counters are then hidden, and every count is zero. + example: false + type: boolean + truncated: + description: True when some recently active counters' usage wasn't read, so the counts may be low. + example: false + type: boolean + would_limit_requests: + description: Requests the counters would have rejected in the last 15 minutes (ALERT), totaled over the counters whose usage was read. + example: 0 + format: int64 + type: integer + required: + - rate_limit_id + - instance_count + - near_limit_count + - limiting_count + - max_utilization + - truncated + type: object + AiGatewayRateLimitInstancesSummaryResource: + description: Aggregate of a template rate limit's counters. + properties: + attributes: + $ref: "#/components/schemas/AiGatewayRateLimitInstancesSummaryAttributes" + id: + description: Rate limit UUID. + example: 33333333-3333-3333-3333-333333333333 + format: uuid + type: string + type: + $ref: "#/components/schemas/AiGatewayRateLimitInstancesSummaryType" + required: + - type + - id + - attributes + type: object + AiGatewayRateLimitInstancesSummaryResponse: + description: Response containing the aggregate of a template rate limit's counters. + properties: + data: + $ref: "#/components/schemas/AiGatewayRateLimitInstancesSummaryResource" + required: + - data + type: object + AiGatewayRateLimitInstancesSummaryType: + description: AI Gateway rate limit counter summary resource type. + enum: + - rate-limit-instances-summary + example: rate-limit-instances-summary + type: string + x-enum-varnames: + - RATE_LIMIT_INSTANCES_SUMMARY AiGatewayRateLimitListResponse: description: Response containing AI Gateway rate limits. properties: @@ -11527,6 +11813,36 @@ components: required: - data type: object + AiGatewayRateLimitSelector: + description: Dimension rules for a template rate limit, which gives each matched user, Team, or value its own allowance with the rule's limits. Can't be combined with user_id, team_id, or tags, and can't be changed after creation. Omit for a rule with one shared allowance. + items: + $ref: "#/components/schemas/AiGatewayRateLimitSelectorEntry" + nullable: true + type: array + AiGatewayRateLimitSelectorEntry: + description: One dimension rule in a template rate limit selector. + properties: + dim: + description: "Dimension to match: user_id, team_id, model, provider, or tag:. Reserved metadata tag keys are rejected." + example: user_id + type: string + per_value: + default: false + description: Give each matched value its own allowance when true. Otherwise, matched values share the allowance within the other separated dimensions. + example: true + type: boolean + values: + description: Allowed dimension values. Omit to match any value; with per_value true, a request must still carry the dimension to match. An explicit list must contain at least one value. Listed team_id values must be existing Teams without open membership. + example: + - 11111111-1111-1111-1111-111111111111 + items: + type: string + minItems: 1 + type: array + required: + - dim + - per_value + type: object AiGatewayRateLimitType: description: AI Gateway rate limit resource type. enum: @@ -230678,6 +230994,7 @@ paths: created_by: user@example.com enabled: true input_tokens_per_minute: 500000 + is_template: false mode: ALERT name: Default rate limit output_tokens_per_minute: 200000 @@ -230685,6 +231002,7 @@ paths: revision: 1 tags: provider: openai + template_split_dims: [] updated_at: "2026-09-15T14:30:00Z" updated_by: user@example.com id: 33333333-3333-3333-3333-333333333333 @@ -230710,7 +231028,7 @@ paths: **Note**: This endpoint is in Preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). post: - description: Create a rate limit. All requests matching its scope share one allowance, and every matching rate limit applies. Returns 409 when another active rate limit has the same user, Team, and tags, or when the organization already has the maximum number of rate limits. + description: Create a rate limit. All requests matching its scope share one allowance, unless a selector makes it a template, which gives each matched user, Team, or value its own allowance. Every matching rate limit applies. Returns 409 when another active rate limit has the same user, Team, tags, and selector, or when the organization already has the maximum number of rate limits. operationId: CreateAiGatewayRateLimit requestBody: content: @@ -230731,6 +231049,7 @@ paths: created_by: user@example.com enabled: true input_tokens_per_minute: 500000 + is_template: false mode: ALERT name: Default rate limit output_tokens_per_minute: 200000 @@ -230738,6 +231057,7 @@ paths: revision: 1 tags: provider: openai + template_split_dims: [] updated_at: "2026-09-01T00:00:00Z" updated_by: user@example.com id: 33333333-3333-3333-3333-333333333333 @@ -230869,6 +231189,7 @@ paths: created_by: user@example.com enabled: true input_tokens_per_minute: 500000 + is_template: false mode: ALERT name: Default rate limit output_tokens_per_minute: 200000 @@ -230876,6 +231197,7 @@ paths: revision: 1 tags: provider: openai + template_split_dims: [] updated_at: "2026-09-15T14:30:00Z" updated_by: user@example.com id: 33333333-3333-3333-3333-333333333333 @@ -230903,7 +231225,7 @@ paths: **Note**: This endpoint is in Preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). patch: - description: Update a rate limit. Only the attributes sent are changed. Scope stays editable, and changes never reset current usage. Returns 409 when the rule was changed concurrently or the new scope duplicates another rule. + description: Update a rate limit. Only the attributes sent are changed, and changes never reset current usage. Scope stays editable, except on a template rate limit, whose user_id, team_id, and tags are rejected with 400. Returns 409 when the rule was changed concurrently or the new scope duplicates another rule. operationId: UpdateAiGatewayRateLimit parameters: - $ref: "#/components/parameters/AiGatewayRateLimitID" @@ -230926,6 +231248,7 @@ paths: created_by: user@example.com enabled: true input_tokens_per_minute: 500000 + is_template: false mode: ALERT name: Default rate limit output_tokens_per_minute: 200000 @@ -230933,6 +231256,7 @@ paths: revision: 2 tags: provider: openai + template_split_dims: [] updated_at: "2026-09-15T14:30:00Z" updated_by: user@example.com id: 33333333-3333-3333-3333-333333333333 @@ -230964,6 +231288,118 @@ paths: x-unstable: |- **Note**: This endpoint is in Preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/rate-limits/{id}/instances: + get: + description: List the counters of a template rate limit, one per matched user, Team, or value, with their live usage. Counters appear within a few minutes of their first request and are dropped after 30 days without one. Usage is read for counters seen in the last 20 minutes, at most 200 per request; past that, rows carry usage_known false. Counters for a provider or model the caller can't see are left out, and when the caller can't see the template's selector, the list is empty. A rate limit with one shared allowance, including one whose selector has no per_value entry, returns an empty list. Returns 503 when counter usage can't be read. + operationId: ListAiGatewayRateLimitInstances + parameters: + - $ref: "#/components/parameters/AiGatewayRateLimitID" + - $ref: "#/components/parameters/AiGatewayRateLimitInstanceSplitDim" + - $ref: "#/components/parameters/AiGatewayRateLimitInstanceSort" + - $ref: "#/components/parameters/AiGatewayRateLimitInstanceLimit" + - $ref: "#/components/parameters/AiGatewayRateLimitInstanceOffset" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + first_seen: "2026-10-28T10:00:00Z" + input_tokens: 15000 + input_tokens_per_minute: + instance_key: "v1|7:user_id=36:11111111-1111-1111-1111-111111111111" + last_seen: "2026-10-28T10:05:00Z" + limited_requests: 0 + output_tokens: 4000 + output_tokens_per_minute: + rate_limit_id: 33333333-3333-3333-3333-333333333333 + requests: 42 + requests_per_minute: 60 + split_dims: + user_id: 11111111-1111-1111-1111-111111111111 + usage_known: true + utilization: 0.7 + would_limit_requests: 0 + id: "33333333-3333-3333-3333-333333333333|v1|7:user_id=36:11111111-1111-1111-1111-111111111111" + type: rate-limit-instances + schema: + $ref: "#/components/schemas/AiGatewayRateLimitInstanceListResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - ai_gateway_config_read + summary: List AI Gateway rate limit counters + tags: + - AI Gateway + x-permission: + operator: OR + permissions: + - ai_gateway_config_read + x-unstable: |- + **Note**: This endpoint is in Preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/rate-limits/{id}/instances/summary: + get: + description: Aggregate a template rate limit's counters, including how many there are, how many are near or at their limit, and the fullest counter's utilization. Use split_dim to aggregate only counters that match every given dimension value. When the caller can't see the template's selector, every count is zero and scope_restricted is true. Summaries are cached for up to 15 seconds. Returns 503 when counter usage can't be read. + operationId: GetAiGatewayRateLimitInstancesSummary + parameters: + - $ref: "#/components/parameters/AiGatewayRateLimitID" + - $ref: "#/components/parameters/AiGatewayRateLimitInstanceSplitDim" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + instance_count: 14 + limited_requests: 25 + limiting_count: 2 + max_utilization: 1.2 + near_limit_count: 3 + rate_limit_id: 33333333-3333-3333-3333-333333333333 + scope_restricted: false + truncated: false + would_limit_requests: 0 + id: 33333333-3333-3333-3333-333333333333 + type: rate-limit-instances-summary + schema: + $ref: "#/components/schemas/AiGatewayRateLimitInstancesSummaryResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - ai_gateway_config_read + summary: Get an AI Gateway rate limit counter summary + tags: + - AI Gateway + x-permission: + operator: OR + permissions: + - ai_gateway_config_read + x-unstable: |- + **Note**: This endpoint is in Preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/reference-tables/queries/batch-rows: post: description: >- diff --git a/examples/v2/ai-gateway/CreateAiGatewayRateLimit.rb b/examples/v2/ai-gateway/CreateAiGatewayRateLimit.rb index 220421d5307a..419809d2f2d8 100644 --- a/examples/v2/ai-gateway/CreateAiGatewayRateLimit.rb +++ b/examples/v2/ai-gateway/CreateAiGatewayRateLimit.rb @@ -15,6 +15,15 @@ name: "Default rate limit", output_tokens_per_minute: nil, requests_per_minute: 600, + selector: [ + DatadogAPIClient::V2::AiGatewayRateLimitSelectorEntry.new({ + dim: "user_id", + per_value: true, + values: [ + "11111111-1111-1111-1111-111111111111", + ], + }), + ], team_id: "00000000-0000-4000-8000-000000000002", user_id: "00000000-0000-4000-8000-000000000001", }), diff --git a/examples/v2/ai-gateway/GetAiGatewayRateLimitInstancesSummary.rb b/examples/v2/ai-gateway/GetAiGatewayRateLimitInstancesSummary.rb new file mode 100644 index 000000000000..8307249e99e0 --- /dev/null +++ b/examples/v2/ai-gateway/GetAiGatewayRateLimitInstancesSummary.rb @@ -0,0 +1,9 @@ +# Get an AI Gateway rate limit counter summary returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.access_token = ENV["DD_BEARER_TOKEN"] + config.unstable_operations["v2.get_ai_gateway_rate_limit_instances_summary".to_sym] = true +end +api_instance = DatadogAPIClient::V2::AIGatewayAPI.new +p api_instance.get_ai_gateway_rate_limit_instances_summary("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d") diff --git a/examples/v2/ai-gateway/ListAiGatewayRateLimitInstances.rb b/examples/v2/ai-gateway/ListAiGatewayRateLimitInstances.rb new file mode 100644 index 000000000000..ef4a624faed1 --- /dev/null +++ b/examples/v2/ai-gateway/ListAiGatewayRateLimitInstances.rb @@ -0,0 +1,9 @@ +# List AI Gateway rate limit counters returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.access_token = ENV["DD_BEARER_TOKEN"] + config.unstable_operations["v2.list_ai_gateway_rate_limit_instances".to_sym] = true +end +api_instance = DatadogAPIClient::V2::AIGatewayAPI.new +p api_instance.list_ai_gateway_rate_limit_instances("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d") diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 474cb26a6c04..9967daf7123f 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -1886,6 +1886,17 @@ "id" => "UUID", "body" => "AiGatewayRateLimitUpdateRequest", }, + "v2.ListAiGatewayRateLimitInstances" => { + "id" => "UUID", + "split_dim" => "Array", + "sort" => "AiGatewayRateLimitInstanceSort", + "limit" => "Integer", + "offset" => "Integer", + }, + "v2.GetAiGatewayRateLimitInstancesSummary" => { + "id" => "UUID", + "split_dim" => "Array", + }, "v2.DeleteAiGatewayRoutingRule" => { "slug" => "String", "force" => "Boolean", diff --git a/features/v2/ai_gateway.feature b/features/v2/ai_gateway.feature index 1036e76dfab4..f3cc5a4ac48f 100644 --- a/features/v2/ai_gateway.feature +++ b/features/v2/ai_gateway.feature @@ -184,7 +184,7 @@ Feature: AI Gateway Scenario: Create an AI Gateway rate limit returns "Bad Request" response Given operation "CreateAiGatewayRateLimit" enabled And new "CreateAiGatewayRateLimit" request - And body with value {"data": {"attributes": {"input_tokens_per_minute": null, "mode": "ALERT", "name": "Default rate limit", "output_tokens_per_minute": null, "requests_per_minute": 600, "team_id": "00000000-0000-4000-8000-000000000002", "user_id": "00000000-0000-4000-8000-000000000001"}, "type": "rate-limits"}} + And body with value {"data": {"attributes": {"input_tokens_per_minute": null, "mode": "ALERT", "name": "Default rate limit", "output_tokens_per_minute": null, "requests_per_minute": 600, "selector": [{"dim": "user_id", "per_value": true, "values": ["11111111-1111-1111-1111-111111111111"]}], "team_id": "00000000-0000-4000-8000-000000000002", "user_id": "00000000-0000-4000-8000-000000000001"}, "type": "rate-limits"}} When the request is sent Then the response status is 400 Bad Request @@ -192,7 +192,7 @@ Feature: AI Gateway Scenario: Create an AI Gateway rate limit returns "Conflict" response Given operation "CreateAiGatewayRateLimit" enabled And new "CreateAiGatewayRateLimit" request - And body with value {"data": {"attributes": {"input_tokens_per_minute": null, "mode": "ALERT", "name": "Default rate limit", "output_tokens_per_minute": null, "requests_per_minute": 600, "team_id": "00000000-0000-4000-8000-000000000002", "user_id": "00000000-0000-4000-8000-000000000001"}, "type": "rate-limits"}} + And body with value {"data": {"attributes": {"input_tokens_per_minute": null, "mode": "ALERT", "name": "Default rate limit", "output_tokens_per_minute": null, "requests_per_minute": 600, "selector": [{"dim": "user_id", "per_value": true, "values": ["11111111-1111-1111-1111-111111111111"]}], "team_id": "00000000-0000-4000-8000-000000000002", "user_id": "00000000-0000-4000-8000-000000000001"}, "type": "rate-limits"}} When the request is sent Then the response status is 409 Conflict @@ -200,7 +200,7 @@ Feature: AI Gateway Scenario: Create an AI Gateway rate limit returns "Created" response Given operation "CreateAiGatewayRateLimit" enabled And new "CreateAiGatewayRateLimit" request - And body with value {"data": {"attributes": {"input_tokens_per_minute": null, "mode": "ALERT", "name": "Default rate limit", "output_tokens_per_minute": null, "requests_per_minute": 600, "team_id": "00000000-0000-4000-8000-000000000002", "user_id": "00000000-0000-4000-8000-000000000001"}, "type": "rate-limits"}} + And body with value {"data": {"attributes": {"input_tokens_per_minute": null, "mode": "ALERT", "name": "Default rate limit", "output_tokens_per_minute": null, "requests_per_minute": 600, "selector": [{"dim": "user_id", "per_value": true, "values": ["11111111-1111-1111-1111-111111111111"]}], "team_id": "00000000-0000-4000-8000-000000000002", "user_id": "00000000-0000-4000-8000-000000000001"}, "type": "rate-limits"}} When the request is sent Then the response status is 201 Created @@ -558,6 +558,30 @@ Feature: AI Gateway When the request is sent Then the response status is 200 OK + @generated @skip @team:ddoghq/frontier-prd-gateway + Scenario: Get an AI Gateway rate limit counter summary returns "Bad Request" response + Given operation "GetAiGatewayRateLimitInstancesSummary" enabled + And new "GetAiGatewayRateLimitInstancesSummary" 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:ddoghq/frontier-prd-gateway + Scenario: Get an AI Gateway rate limit counter summary returns "Not Found" response + Given operation "GetAiGatewayRateLimitInstancesSummary" enabled + And new "GetAiGatewayRateLimitInstancesSummary" 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:ddoghq/frontier-prd-gateway + Scenario: Get an AI Gateway rate limit counter summary returns "OK" response + Given operation "GetAiGatewayRateLimitInstancesSummary" enabled + And new "GetAiGatewayRateLimitInstancesSummary" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:ddoghq/frontier-prd-gateway Scenario: Get an AI Gateway rate limit returns "Not Found" response Given operation "GetAiGatewayRateLimit" enabled @@ -689,6 +713,30 @@ Feature: AI Gateway When the request is sent Then the response status is 200 OK + @generated @skip @team:ddoghq/frontier-prd-gateway + Scenario: List AI Gateway rate limit counters returns "Bad Request" response + Given operation "ListAiGatewayRateLimitInstances" enabled + And new "ListAiGatewayRateLimitInstances" 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:ddoghq/frontier-prd-gateway + Scenario: List AI Gateway rate limit counters returns "Not Found" response + Given operation "ListAiGatewayRateLimitInstances" enabled + And new "ListAiGatewayRateLimitInstances" 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:ddoghq/frontier-prd-gateway + Scenario: List AI Gateway rate limit counters returns "OK" response + Given operation "ListAiGatewayRateLimitInstances" enabled + And new "ListAiGatewayRateLimitInstances" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @team:ddoghq/frontier-prd-gateway Scenario: List AI Gateway rate limits returns "OK" response Given operation "ListAiGatewayRateLimits" enabled diff --git a/features/v2/undo.json b/features/v2/undo.json index 94d2e66680a2..e9fdf58d6dc4 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -7774,6 +7774,18 @@ "type": "idempotent" } }, + "ListAiGatewayRateLimitInstances": { + "tag": "AI Gateway", + "undo": { + "type": "safe" + } + }, + "GetAiGatewayRateLimitInstancesSummary": { + "tag": "AI Gateway", + "undo": { + "type": "safe" + } + }, "BatchRowsQuery": { "tag": "Reference Tables", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index ebd03ac64e14..84d2629b1550 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -324,6 +324,7 @@ def initialize "v2.get_ai_gateway_policy": false, "v2.get_ai_gateway_provider": false, "v2.get_ai_gateway_rate_limit": false, + "v2.get_ai_gateway_rate_limit_instances_summary": false, "v2.get_ai_gateway_rate_limit_usage": false, "v2.get_ai_gateway_routing_rule": false, "v2.list_ai_gateway_budget_instance_dimensions": false, @@ -335,6 +336,7 @@ def initialize "v2.list_ai_gateway_policies": false, "v2.list_ai_gateway_provider_models": false, "v2.list_ai_gateway_providers": false, + "v2.list_ai_gateway_rate_limit_instances": false, "v2.list_ai_gateway_rate_limits": false, "v2.list_ai_gateway_routing_rules": false, "v2.override_ai_gateway_budget_instance_capacity": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 2503a4d6f464..ec87c37d4e82 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1565,10 +1565,20 @@ def overrides "v2.ai_gateway_rate_limit_create_attributes" => "AiGatewayRateLimitCreateAttributes", "v2.ai_gateway_rate_limit_create_data" => "AiGatewayRateLimitCreateData", "v2.ai_gateway_rate_limit_create_request" => "AiGatewayRateLimitCreateRequest", + "v2.ai_gateway_rate_limit_instance_attributes" => "AiGatewayRateLimitInstanceAttributes", + "v2.ai_gateway_rate_limit_instance_list_response" => "AiGatewayRateLimitInstanceListResponse", + "v2.ai_gateway_rate_limit_instance_resource" => "AiGatewayRateLimitInstanceResource", + "v2.ai_gateway_rate_limit_instance_sort" => "AiGatewayRateLimitInstanceSort", + "v2.ai_gateway_rate_limit_instances_summary_attributes" => "AiGatewayRateLimitInstancesSummaryAttributes", + "v2.ai_gateway_rate_limit_instances_summary_resource" => "AiGatewayRateLimitInstancesSummaryResource", + "v2.ai_gateway_rate_limit_instances_summary_response" => "AiGatewayRateLimitInstancesSummaryResponse", + "v2.ai_gateway_rate_limit_instances_summary_type" => "AiGatewayRateLimitInstancesSummaryType", + "v2.ai_gateway_rate_limit_instance_type" => "AiGatewayRateLimitInstanceType", "v2.ai_gateway_rate_limit_list_response" => "AiGatewayRateLimitListResponse", "v2.ai_gateway_rate_limit_mode" => "AiGatewayRateLimitMode", "v2.ai_gateway_rate_limit_resource" => "AiGatewayRateLimitResource", "v2.ai_gateway_rate_limit_response" => "AiGatewayRateLimitResponse", + "v2.ai_gateway_rate_limit_selector_entry" => "AiGatewayRateLimitSelectorEntry", "v2.ai_gateway_rate_limit_type" => "AiGatewayRateLimitType", "v2.ai_gateway_rate_limit_update_attributes" => "AiGatewayRateLimitUpdateAttributes", "v2.ai_gateway_rate_limit_update_data" => "AiGatewayRateLimitUpdateData", diff --git a/lib/datadog_api_client/v2/api/ai_gateway_api.rb b/lib/datadog_api_client/v2/api/ai_gateway_api.rb index 917bde87c24b..ec4bca18d370 100644 --- a/lib/datadog_api_client/v2/api/ai_gateway_api.rb +++ b/lib/datadog_api_client/v2/api/ai_gateway_api.rb @@ -498,7 +498,7 @@ def create_ai_gateway_rate_limit(body, opts = {}) # Create an AI Gateway rate limit. # - # Create a rate limit. All requests matching its scope share one allowance, and every matching rate limit applies. Returns 409 when another active rate limit has the same user, Team, and tags, or when the organization already has the maximum number of rate limits. + # Create a rate limit. All requests matching its scope share one allowance, unless a selector makes it a template, which gives each matched user, Team, or value its own allowance. Every matching rate limit applies. Returns 409 when another active rate limit has the same user, Team, tags, and selector, or when the organization already has the maximum number of rate limits. # # @param body [AiGatewayRateLimitCreateRequest] # @param opts [Hash] the optional parameters @@ -2043,6 +2043,80 @@ def get_ai_gateway_rate_limit_with_http_info(id, opts = {}) return data, status_code, headers end + # Get an AI Gateway rate limit counter summary. + # + # @see #get_ai_gateway_rate_limit_instances_summary_with_http_info + def get_ai_gateway_rate_limit_instances_summary(id, opts = {}) + data, _status_code, _headers = get_ai_gateway_rate_limit_instances_summary_with_http_info(id, opts) + data + end + + # Get an AI Gateway rate limit counter summary. + # + # Aggregate a template rate limit's counters, including how many there are, how many are near or at their limit, and the fullest counter's utilization. Use split_dim to aggregate only counters that match every given dimension value. When the caller can't see the template's selector, every count is zero and scope_restricted is true. Summaries are cached for up to 15 seconds. Returns 503 when counter usage can't be read. + # + # @param id [UUID] Rate limit UUID. + # @param opts [Hash] the optional parameters + # @option opts [Array] :split_dim Keep only counters whose split dimension equals a value, written as `=`, such as `split_dim=user_id=&split_dim=model=gpt-4o`. Dimensions use the `split_dims` names `user_id`, `team_id`, `model`, `provider`, and `tag:`. Repeat the parameter to filter on several dimensions; a counter must match all of them. Each dimension may appear once and must be a per-value dimension of the rate limit. + # @return [Array<(AiGatewayRateLimitInstancesSummaryResponse, Integer, Hash)>] AiGatewayRateLimitInstancesSummaryResponse data, response status code and response headers + def get_ai_gateway_rate_limit_instances_summary_with_http_info(id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_ai_gateway_rate_limit_instances_summary".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_ai_gateway_rate_limit_instances_summary") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_ai_gateway_rate_limit_instances_summary")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: AIGatewayAPI.get_ai_gateway_rate_limit_instances_summary ...' + 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 AIGatewayAPI.get_ai_gateway_rate_limit_instances_summary" + end + # resource path + local_var_path = '/api/v2/rate-limits/{id}/instances/summary'.sub('{id}', CGI.escape(id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'split_dim'] = @api_client.build_collection_param(opts[:'split_dim'], :multi) if !opts[:'split_dim'].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] || 'AiGatewayRateLimitInstancesSummaryResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_ai_gateway_rate_limit_instances_summary, + :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" + ) + new_options[:query_string_normalizer] = HTTParty::Request::NON_RAILS_QUERY_STRING_NORMALIZER + + 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: AIGatewayAPI#get_ai_gateway_rate_limit_instances_summary\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get AI Gateway rate limit usage. # # @see #get_ai_gateway_rate_limit_usage_with_http_info @@ -2864,6 +2938,99 @@ def list_ai_gateway_providers_with_http_info(opts = {}) return data, status_code, headers end + # List AI Gateway rate limit counters. + # + # @see #list_ai_gateway_rate_limit_instances_with_http_info + def list_ai_gateway_rate_limit_instances(id, opts = {}) + data, _status_code, _headers = list_ai_gateway_rate_limit_instances_with_http_info(id, opts) + data + end + + # List AI Gateway rate limit counters. + # + # List the counters of a template rate limit, one per matched user, Team, or value, with their live usage. Counters appear within a few minutes of their first request and are dropped after 30 days without one. Usage is read for counters seen in the last 20 minutes, at most 200 per request; past that, rows carry usage_known false. Counters for a provider or model the caller can't see are left out, and when the caller can't see the template's selector, the list is empty. A rate limit with one shared allowance, including one whose selector has no per_value entry, returns an empty list. Returns 503 when counter usage can't be read. + # + # @param id [UUID] Rate limit UUID. + # @param opts [Hash] the optional parameters + # @option opts [Array] :split_dim Keep only counters whose split dimension equals a value, written as `=`, such as `split_dim=user_id=&split_dim=model=gpt-4o`. Dimensions use the `split_dims` names `user_id`, `team_id`, `model`, `provider`, and `tag:`. Repeat the parameter to filter on several dimensions; a counter must match all of them. Each dimension may appear once and must be a per-value dimension of the rate limit. + # @option opts [AiGatewayRateLimitInstanceSort] :sort Sort order for rate limit counters. + # @option opts [Integer] :limit Maximum number of rate limit counters to return. + # @option opts [Integer] :offset Number of rate limit counters to skip. + # @return [Array<(AiGatewayRateLimitInstanceListResponse, Integer, Hash)>] AiGatewayRateLimitInstanceListResponse data, response status code and response headers + def list_ai_gateway_rate_limit_instances_with_http_info(id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.list_ai_gateway_rate_limit_instances".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_ai_gateway_rate_limit_instances") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_ai_gateway_rate_limit_instances")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: AIGatewayAPI.list_ai_gateway_rate_limit_instances ...' + 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 AIGatewayAPI.list_ai_gateway_rate_limit_instances" + end + allowable_values = ['utilization_desc', 'last_seen_desc', 'key_asc'] + if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort']) + fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}" + end + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 500 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AIGatewayAPI.list_ai_gateway_rate_limit_instances, must be smaller than or equal to 500.' + end + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AIGatewayAPI.list_ai_gateway_rate_limit_instances, must be greater than or equal to 1.' + end + if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0 + fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling AIGatewayAPI.list_ai_gateway_rate_limit_instances, must be greater than or equal to 0.' + end + # resource path + local_var_path = '/api/v2/rate-limits/{id}/instances'.sub('{id}', CGI.escape(id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'split_dim'] = @api_client.build_collection_param(opts[:'split_dim'], :multi) if !opts[:'split_dim'].nil? + query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].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] || 'AiGatewayRateLimitInstanceListResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :list_ai_gateway_rate_limit_instances, + :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" + ) + new_options[:query_string_normalizer] = HTTParty::Request::NON_RAILS_QUERY_STRING_NORMALIZER + + 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: AIGatewayAPI#list_ai_gateway_rate_limit_instances\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # List AI Gateway rate limits. # # @see #list_ai_gateway_rate_limits_with_http_info @@ -3729,7 +3896,7 @@ def update_ai_gateway_rate_limit(id, body, opts = {}) # Update an AI Gateway rate limit. # - # Update a rate limit. Only the attributes sent are changed. Scope stays editable, and changes never reset current usage. Returns 409 when the rule was changed concurrently or the new scope duplicates another rule. + # Update a rate limit. Only the attributes sent are changed, and changes never reset current usage. Scope stays editable, except on a template rate limit, whose user_id, team_id, and tags are rejected with 400. Returns 409 when the rule was changed concurrently or the new scope duplicates another rule. # # @param id [UUID] Rate limit UUID. # @param body [AiGatewayRateLimitUpdateRequest] diff --git a/lib/datadog_api_client/v2/models/ai_gateway_rate_limit_attributes.rb b/lib/datadog_api_client/v2/models/ai_gateway_rate_limit_attributes.rb index e27d585d219e..ca8213e492d3 100644 --- a/lib/datadog_api_client/v2/models/ai_gateway_rate_limit_attributes.rb +++ b/lib/datadog_api_client/v2/models/ai_gateway_rate_limit_attributes.rb @@ -30,9 +30,12 @@ class AiGatewayRateLimitAttributes # Whether this rate limit is active. attr_reader :enabled - # Maximum input tokens per rolling minute shared by all matching traffic. Null when this rule does not limit input tokens. + # Maximum input tokens per rolling minute shared by all matching traffic, or per counter for a template rate limit. Null when this rule does not limit input tokens. attr_reader :input_tokens_per_minute + # Whether the selector gives each matching value its own allowance, that is, whether it has at least one per_value entry. Returned even when scope_restricted hides the selector. + attr_accessor :is_template + # Action taken when request rate exceeds the limit. attr_reader :mode @@ -42,10 +45,10 @@ class AiGatewayRateLimitAttributes # Rate limit name. attr_reader :name - # Maximum output tokens per rolling minute shared by all matching traffic. Null when this rule does not limit output tokens. + # Maximum output tokens per rolling minute shared by all matching traffic, or per counter for a template rate limit. Null when this rule does not limit output tokens. attr_reader :output_tokens_per_minute - # Maximum requests per rolling minute shared by all matching traffic. Null when this rule does not limit requests. + # Maximum requests per rolling minute shared by all matching traffic, or per counter for a template rate limit. Null when this rule does not limit requests. attr_reader :requests_per_minute # Increases on every change to the definition. @@ -54,12 +57,18 @@ class AiGatewayRateLimitAttributes # Whether provider or model scope metadata was withheld. Omit unchanged scope fields on an unrelated update to preserve their saved values. attr_reader :scope_restricted + # Dimension rules for a template rate limit, which gives each matched user, Team, or value its own allowance with the rule's limits. Can't be combined with user_id, team_id, or tags, and can't be changed after creation. Omit for a rule with one shared allowance. + attr_accessor :selector + # Optional scope tags, such as provider, model, ml_app, or custom dimensions. A request matches when it has all of these tags. attr_reader :tags # Optional Team UUID. Count only requests attributed to this Datadog Team. attr_accessor :team_id + # Dimensions of the selector's per_value entries, such as user_id or tag:env, each matching value of which gets its own allowance. Empty unless is_template is true. Returned even when scope_restricted hides the selector. + attr_accessor :template_split_dims + # Last modification timestamp. attr_reader :updated_at @@ -79,6 +88,7 @@ def self.attribute_map :'created_by' => :'created_by', :'enabled' => :'enabled', :'input_tokens_per_minute' => :'input_tokens_per_minute', + :'is_template' => :'is_template', :'mode' => :'mode', :'monitor_id' => :'monitor_id', :'name' => :'name', @@ -86,8 +96,10 @@ def self.attribute_map :'requests_per_minute' => :'requests_per_minute', :'revision' => :'revision', :'scope_restricted' => :'scope_restricted', + :'selector' => :'selector', :'tags' => :'tags', :'team_id' => :'team_id', + :'template_split_dims' => :'template_split_dims', :'updated_at' => :'updated_at', :'updated_by' => :'updated_by', :'user_id' => :'user_id' @@ -102,6 +114,7 @@ def self.openapi_types :'created_by' => :'String', :'enabled' => :'Boolean', :'input_tokens_per_minute' => :'Integer', + :'is_template' => :'Boolean', :'mode' => :'AiGatewayRateLimitMode', :'monitor_id' => :'Integer', :'name' => :'String', @@ -109,8 +122,10 @@ def self.openapi_types :'requests_per_minute' => :'Integer', :'revision' => :'Integer', :'scope_restricted' => :'Boolean', + :'selector' => :'Array', :'tags' => :'Hash', :'team_id' => :'UUID', + :'template_split_dims' => :'Array', :'updated_at' => :'Time', :'updated_by' => :'String', :'user_id' => :'UUID' @@ -125,6 +140,7 @@ def self.openapi_nullable :'monitor_id', :'output_tokens_per_minute', :'requests_per_minute', + :'selector', :'team_id', :'user_id', ]) @@ -164,6 +180,10 @@ def initialize(attributes = {}) self.input_tokens_per_minute = attributes[:'input_tokens_per_minute'] end + if attributes.key?(:'is_template') + self.is_template = attributes[:'is_template'] + end + if attributes.key?(:'mode') self.mode = attributes[:'mode'] end @@ -192,6 +212,12 @@ def initialize(attributes = {}) self.scope_restricted = attributes[:'scope_restricted'] end + if attributes.key?(:'selector') + if (value = attributes[:'selector']).is_a?(Array) + self.selector = value + end + end + if attributes.key?(:'tags') self.tags = attributes[:'tags'] end @@ -200,6 +226,12 @@ def initialize(attributes = {}) self.team_id = attributes[:'team_id'] end + if attributes.key?(:'template_split_dims') + if (value = attributes[:'template_split_dims']).is_a?(Array) + self.template_split_dims = value + end + end + if attributes.key?(:'updated_at') self.updated_at = attributes[:'updated_at'] end @@ -405,6 +437,7 @@ def ==(o) created_by == o.created_by && enabled == o.enabled && input_tokens_per_minute == o.input_tokens_per_minute && + is_template == o.is_template && mode == o.mode && monitor_id == o.monitor_id && name == o.name && @@ -412,8 +445,10 @@ def ==(o) requests_per_minute == o.requests_per_minute && revision == o.revision && scope_restricted == o.scope_restricted && + selector == o.selector && tags == o.tags && team_id == o.team_id && + template_split_dims == o.template_split_dims && updated_at == o.updated_at && updated_by == o.updated_by && user_id == o.user_id && @@ -424,7 +459,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [created_at, created_by, enabled, input_tokens_per_minute, mode, monitor_id, name, output_tokens_per_minute, requests_per_minute, revision, scope_restricted, tags, team_id, updated_at, updated_by, user_id, additional_properties].hash + [created_at, created_by, enabled, input_tokens_per_minute, is_template, mode, monitor_id, name, output_tokens_per_minute, requests_per_minute, revision, scope_restricted, selector, tags, team_id, template_split_dims, updated_at, updated_by, user_id, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/ai_gateway_rate_limit_create_attributes.rb b/lib/datadog_api_client/v2/models/ai_gateway_rate_limit_create_attributes.rb index 7f0d0f4cb64d..148b4334ef76 100644 --- a/lib/datadog_api_client/v2/models/ai_gateway_rate_limit_create_attributes.rb +++ b/lib/datadog_api_client/v2/models/ai_gateway_rate_limit_create_attributes.rb @@ -36,6 +36,9 @@ class AiGatewayRateLimitCreateAttributes # Maximum requests per rolling minute. At least one of `requests_per_minute`, `input_tokens_per_minute`, and `output_tokens_per_minute` is required. attr_reader :requests_per_minute + # Dimension rules for a template rate limit, which gives each matched user, Team, or value its own allowance with the rule's limits. Can't be combined with user_id, team_id, or tags, and can't be changed after creation. Omit for a rule with one shared allowance. + attr_accessor :selector + # Optional scope tags, such as `provider`, `model`, `ml_app`, or custom dimensions. A request matches when it has all of these tags. The reserved metadata keys `name`, `budget_name`, and `span_filter` are rejected. attr_accessor :tags @@ -56,6 +59,7 @@ def self.attribute_map :'name' => :'name', :'output_tokens_per_minute' => :'output_tokens_per_minute', :'requests_per_minute' => :'requests_per_minute', + :'selector' => :'selector', :'tags' => :'tags', :'team_id' => :'team_id', :'user_id' => :'user_id' @@ -71,6 +75,7 @@ def self.openapi_types :'name' => :'String', :'output_tokens_per_minute' => :'Integer', :'requests_per_minute' => :'Integer', + :'selector' => :'Array', :'tags' => :'Hash', :'team_id' => :'UUID', :'user_id' => :'UUID' @@ -84,6 +89,7 @@ def self.openapi_nullable :'input_tokens_per_minute', :'output_tokens_per_minute', :'requests_per_minute', + :'selector', ]) end @@ -125,6 +131,12 @@ def initialize(attributes = {}) self.requests_per_minute = attributes[:'requests_per_minute'] end + if attributes.key?(:'selector') + if (value = attributes[:'selector']).is_a?(Array) + self.selector = value + end + end + if attributes.key?(:'tags') self.tags = attributes[:'tags'] end @@ -232,6 +244,7 @@ def ==(o) name == o.name && output_tokens_per_minute == o.output_tokens_per_minute && requests_per_minute == o.requests_per_minute && + selector == o.selector && tags == o.tags && team_id == o.team_id && user_id == o.user_id && @@ -242,7 +255,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [input_tokens_per_minute, mode, name, output_tokens_per_minute, requests_per_minute, tags, team_id, user_id, additional_properties].hash + [input_tokens_per_minute, mode, name, output_tokens_per_minute, requests_per_minute, selector, tags, team_id, user_id, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/ai_gateway_rate_limit_instance_attributes.rb b/lib/datadog_api_client/v2/models/ai_gateway_rate_limit_instance_attributes.rb new file mode 100644 index 000000000000..8defa0a3d386 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_gateway_rate_limit_instance_attributes.rb @@ -0,0 +1,394 @@ +=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 + # One counter of a template rate limit and its live usage. + class AiGatewayRateLimitInstanceAttributes + include BaseGenericModel + + # When the gateway first recorded a request for this counter. + attr_reader :first_seen + + # Input tokens counted in the rolling one-minute window. + attr_reader :input_tokens + + # The rate limit's per-counter input token limit. Null when it doesn't limit input tokens. + attr_accessor :input_tokens_per_minute + + # Opaque canonical key identifying the counter. + attr_reader :instance_key + + # When the gateway last recorded a request for this counter; up to a few minutes behind live traffic. + attr_reader :last_seen + + # Requests this counter rejected in the last 15 minutes (ENFORCE). + attr_reader :limited_requests + + # Output tokens counted in the rolling one-minute window. + attr_reader :output_tokens + + # The rate limit's per-counter output token limit. Null when it doesn't limit output tokens. + attr_accessor :output_tokens_per_minute + + # Rate limit UUID. + attr_reader :rate_limit_id + + # Requests counted in the rolling one-minute window. + attr_reader :requests + + # The rate limit's per-counter request limit. Null when it doesn't limit requests. + attr_accessor :requests_per_minute + + # The counter's value for each per-value dimension. user_id and team_id values are raw UUIDs. + attr_reader :split_dims + + # False when this counter's usage wasn't read because the request already read the most counters it may. Its usage then reads as zero. + attr_reader :usage_known + + # The fullest of the rate limit's limits in the rolling window, as a fraction. 1 or more means the counter is at its limit. + attr_reader :utilization + + # Requests this counter would have rejected in the last 15 minutes (ALERT). + attr_reader :would_limit_requests + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'first_seen' => :'first_seen', + :'input_tokens' => :'input_tokens', + :'input_tokens_per_minute' => :'input_tokens_per_minute', + :'instance_key' => :'instance_key', + :'last_seen' => :'last_seen', + :'limited_requests' => :'limited_requests', + :'output_tokens' => :'output_tokens', + :'output_tokens_per_minute' => :'output_tokens_per_minute', + :'rate_limit_id' => :'rate_limit_id', + :'requests' => :'requests', + :'requests_per_minute' => :'requests_per_minute', + :'split_dims' => :'split_dims', + :'usage_known' => :'usage_known', + :'utilization' => :'utilization', + :'would_limit_requests' => :'would_limit_requests' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'first_seen' => :'Time', + :'input_tokens' => :'Integer', + :'input_tokens_per_minute' => :'Integer', + :'instance_key' => :'String', + :'last_seen' => :'Time', + :'limited_requests' => :'Integer', + :'output_tokens' => :'Integer', + :'output_tokens_per_minute' => :'Integer', + :'rate_limit_id' => :'UUID', + :'requests' => :'Integer', + :'requests_per_minute' => :'Integer', + :'split_dims' => :'Hash', + :'usage_known' => :'Boolean', + :'utilization' => :'Float', + :'would_limit_requests' => :'Integer' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'input_tokens_per_minute', + :'output_tokens_per_minute', + :'requests_per_minute', + ]) + 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::AiGatewayRateLimitInstanceAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'first_seen') + self.first_seen = attributes[:'first_seen'] + end + + if attributes.key?(:'input_tokens') + self.input_tokens = attributes[:'input_tokens'] + end + + if attributes.key?(:'input_tokens_per_minute') + self.input_tokens_per_minute = attributes[:'input_tokens_per_minute'] + end + + if attributes.key?(:'instance_key') + self.instance_key = attributes[:'instance_key'] + end + + if attributes.key?(:'last_seen') + self.last_seen = attributes[:'last_seen'] + end + + if attributes.key?(:'limited_requests') + self.limited_requests = attributes[:'limited_requests'] + end + + if attributes.key?(:'output_tokens') + self.output_tokens = attributes[:'output_tokens'] + end + + if attributes.key?(:'output_tokens_per_minute') + self.output_tokens_per_minute = attributes[:'output_tokens_per_minute'] + end + + if attributes.key?(:'rate_limit_id') + self.rate_limit_id = attributes[:'rate_limit_id'] + end + + if attributes.key?(:'requests') + self.requests = attributes[:'requests'] + end + + if attributes.key?(:'requests_per_minute') + self.requests_per_minute = attributes[:'requests_per_minute'] + end + + if attributes.key?(:'split_dims') + self.split_dims = attributes[:'split_dims'] + end + + if attributes.key?(:'usage_known') + self.usage_known = attributes[:'usage_known'] + end + + if attributes.key?(:'utilization') + self.utilization = attributes[:'utilization'] + end + + if attributes.key?(:'would_limit_requests') + self.would_limit_requests = attributes[:'would_limit_requests'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @first_seen.nil? + return false if @input_tokens.nil? + return false if @instance_key.nil? + return false if @last_seen.nil? + return false if @limited_requests.nil? + return false if @output_tokens.nil? + return false if @rate_limit_id.nil? + return false if @requests.nil? + return false if @split_dims.nil? + return false if @usage_known.nil? + return false if @utilization.nil? + return false if @would_limit_requests.nil? + true + end + + # Custom attribute writer method with validation + # @param first_seen [Object] Object to be assigned + # @!visibility private + def first_seen=(first_seen) + if first_seen.nil? + fail ArgumentError, 'invalid value for "first_seen", first_seen cannot be nil.' + end + @first_seen = first_seen + end + + # Custom attribute writer method with validation + # @param input_tokens [Object] Object to be assigned + # @!visibility private + def input_tokens=(input_tokens) + if input_tokens.nil? + fail ArgumentError, 'invalid value for "input_tokens", input_tokens cannot be nil.' + end + @input_tokens = input_tokens + end + + # Custom attribute writer method with validation + # @param instance_key [Object] Object to be assigned + # @!visibility private + def instance_key=(instance_key) + if instance_key.nil? + fail ArgumentError, 'invalid value for "instance_key", instance_key cannot be nil.' + end + @instance_key = instance_key + end + + # Custom attribute writer method with validation + # @param last_seen [Object] Object to be assigned + # @!visibility private + def last_seen=(last_seen) + if last_seen.nil? + fail ArgumentError, 'invalid value for "last_seen", last_seen cannot be nil.' + end + @last_seen = last_seen + end + + # Custom attribute writer method with validation + # @param limited_requests [Object] Object to be assigned + # @!visibility private + def limited_requests=(limited_requests) + if limited_requests.nil? + fail ArgumentError, 'invalid value for "limited_requests", limited_requests cannot be nil.' + end + @limited_requests = limited_requests + end + + # Custom attribute writer method with validation + # @param output_tokens [Object] Object to be assigned + # @!visibility private + def output_tokens=(output_tokens) + if output_tokens.nil? + fail ArgumentError, 'invalid value for "output_tokens", output_tokens cannot be nil.' + end + @output_tokens = output_tokens + end + + # Custom attribute writer method with validation + # @param rate_limit_id [Object] Object to be assigned + # @!visibility private + def rate_limit_id=(rate_limit_id) + if rate_limit_id.nil? + fail ArgumentError, 'invalid value for "rate_limit_id", rate_limit_id cannot be nil.' + end + @rate_limit_id = rate_limit_id + end + + # Custom attribute writer method with validation + # @param requests [Object] Object to be assigned + # @!visibility private + def requests=(requests) + if requests.nil? + fail ArgumentError, 'invalid value for "requests", requests cannot be nil.' + end + @requests = requests + end + + # Custom attribute writer method with validation + # @param split_dims [Object] Object to be assigned + # @!visibility private + def split_dims=(split_dims) + if split_dims.nil? + fail ArgumentError, 'invalid value for "split_dims", split_dims cannot be nil.' + end + @split_dims = split_dims + end + + # Custom attribute writer method with validation + # @param usage_known [Object] Object to be assigned + # @!visibility private + def usage_known=(usage_known) + if usage_known.nil? + fail ArgumentError, 'invalid value for "usage_known", usage_known cannot be nil.' + end + @usage_known = usage_known + end + + # Custom attribute writer method with validation + # @param utilization [Object] Object to be assigned + # @!visibility private + def utilization=(utilization) + if utilization.nil? + fail ArgumentError, 'invalid value for "utilization", utilization cannot be nil.' + end + @utilization = utilization + end + + # Custom attribute writer method with validation + # @param would_limit_requests [Object] Object to be assigned + # @!visibility private + def would_limit_requests=(would_limit_requests) + if would_limit_requests.nil? + fail ArgumentError, 'invalid value for "would_limit_requests", would_limit_requests cannot be nil.' + end + @would_limit_requests = would_limit_requests + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + first_seen == o.first_seen && + input_tokens == o.input_tokens && + input_tokens_per_minute == o.input_tokens_per_minute && + instance_key == o.instance_key && + last_seen == o.last_seen && + limited_requests == o.limited_requests && + output_tokens == o.output_tokens && + output_tokens_per_minute == o.output_tokens_per_minute && + rate_limit_id == o.rate_limit_id && + requests == o.requests && + requests_per_minute == o.requests_per_minute && + split_dims == o.split_dims && + usage_known == o.usage_known && + utilization == o.utilization && + would_limit_requests == o.would_limit_requests && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [first_seen, input_tokens, input_tokens_per_minute, instance_key, last_seen, limited_requests, output_tokens, output_tokens_per_minute, rate_limit_id, requests, requests_per_minute, split_dims, usage_known, utilization, would_limit_requests, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ai_gateway_rate_limit_instance_list_response.rb b/lib/datadog_api_client/v2/models/ai_gateway_rate_limit_instance_list_response.rb new file mode 100644 index 000000000000..83f61cb8b425 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_gateway_rate_limit_instance_list_response.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 + # Response containing counters of a template rate limit. + class AiGatewayRateLimitInstanceListResponse + include BaseGenericModel + + # + 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' => :'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::AiGatewayRateLimitInstanceListResponse` 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 + 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/ai_gateway_rate_limit_instance_resource.rb b/lib/datadog_api_client/v2/models/ai_gateway_rate_limit_instance_resource.rb new file mode 100644 index 000000000000..35607b26317f --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_gateway_rate_limit_instance_resource.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # One counter of a template rate limit. + class AiGatewayRateLimitInstanceResource + include BaseGenericModel + + # One counter of a template rate limit and its live usage. + attr_reader :attributes + + # Counter ID, the rate limit UUID and instance key joined by `|`. + attr_reader :id + + # AI Gateway rate limit counter resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'AiGatewayRateLimitInstanceAttributes', + :'id' => :'String', + :'type' => :'AiGatewayRateLimitInstanceType' + } + 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::AiGatewayRateLimitInstanceResource` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ai_gateway_rate_limit_instance_sort.rb b/lib/datadog_api_client/v2/models/ai_gateway_rate_limit_instance_sort.rb new file mode 100644 index 000000000000..f2e46195d50c --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_gateway_rate_limit_instance_sort.rb @@ -0,0 +1,28 @@ +=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 + # Sort order for rate limit counters. + class AiGatewayRateLimitInstanceSort + include BaseEnumModel + + UTILIZATION_DESC = "utilization_desc".freeze + LAST_SEEN_DESC = "last_seen_desc".freeze + KEY_ASC = "key_asc".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/ai_gateway_rate_limit_instance_type.rb b/lib/datadog_api_client/v2/models/ai_gateway_rate_limit_instance_type.rb new file mode 100644 index 000000000000..823cb04e6b2a --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_gateway_rate_limit_instance_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 + # AI Gateway rate limit counter resource type. + class AiGatewayRateLimitInstanceType + include BaseEnumModel + + RATE_LIMIT_INSTANCES = "rate-limit-instances".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/ai_gateway_rate_limit_instances_summary_attributes.rb b/lib/datadog_api_client/v2/models/ai_gateway_rate_limit_instances_summary_attributes.rb new file mode 100644 index 000000000000..059092be7363 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_gateway_rate_limit_instances_summary_attributes.rb @@ -0,0 +1,258 @@ +=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 + # Aggregate of a template rate limit's counters. + class AiGatewayRateLimitInstancesSummaryAttributes + include BaseGenericModel + + # Number of counters. + attr_reader :instance_count + + # Requests the counters rejected in the last 15 minutes (ENFORCE), totaled over the counters whose usage was read. + attr_accessor :limited_requests + + # Counters that limited, or would have limited, a request in the last 15 minutes. + attr_reader :limiting_count + + # Utilization of the fullest counter. + attr_reader :max_utilization + + # Counters at 80% or more of a limit in the rolling window. + attr_reader :near_limit_count + + # Rate limit UUID. + attr_reader :rate_limit_id + + # True when the caller can't see the template's selector because it lists a provider or model the caller can't access. The counters are then hidden, and every count is zero. + attr_accessor :scope_restricted + + # True when some recently active counters' usage wasn't read, so the counts may be low. + attr_reader :truncated + + # Requests the counters would have rejected in the last 15 minutes (ALERT), totaled over the counters whose usage was read. + attr_accessor :would_limit_requests + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'instance_count' => :'instance_count', + :'limited_requests' => :'limited_requests', + :'limiting_count' => :'limiting_count', + :'max_utilization' => :'max_utilization', + :'near_limit_count' => :'near_limit_count', + :'rate_limit_id' => :'rate_limit_id', + :'scope_restricted' => :'scope_restricted', + :'truncated' => :'truncated', + :'would_limit_requests' => :'would_limit_requests' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'instance_count' => :'Integer', + :'limited_requests' => :'Integer', + :'limiting_count' => :'Integer', + :'max_utilization' => :'Float', + :'near_limit_count' => :'Integer', + :'rate_limit_id' => :'UUID', + :'scope_restricted' => :'Boolean', + :'truncated' => :'Boolean', + :'would_limit_requests' => :'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::AiGatewayRateLimitInstancesSummaryAttributes` 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?(:'instance_count') + self.instance_count = attributes[:'instance_count'] + end + + if attributes.key?(:'limited_requests') + self.limited_requests = attributes[:'limited_requests'] + end + + if attributes.key?(:'limiting_count') + self.limiting_count = attributes[:'limiting_count'] + end + + if attributes.key?(:'max_utilization') + self.max_utilization = attributes[:'max_utilization'] + end + + if attributes.key?(:'near_limit_count') + self.near_limit_count = attributes[:'near_limit_count'] + end + + if attributes.key?(:'rate_limit_id') + self.rate_limit_id = attributes[:'rate_limit_id'] + end + + if attributes.key?(:'scope_restricted') + self.scope_restricted = attributes[:'scope_restricted'] + end + + if attributes.key?(:'truncated') + self.truncated = attributes[:'truncated'] + end + + if attributes.key?(:'would_limit_requests') + self.would_limit_requests = attributes[:'would_limit_requests'] + 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 @instance_count.nil? + return false if @limiting_count.nil? + return false if @max_utilization.nil? + return false if @near_limit_count.nil? + return false if @rate_limit_id.nil? + return false if @truncated.nil? + true + end + + # Custom attribute writer method with validation + # @param instance_count [Object] Object to be assigned + # @!visibility private + def instance_count=(instance_count) + if instance_count.nil? + fail ArgumentError, 'invalid value for "instance_count", instance_count cannot be nil.' + end + @instance_count = instance_count + end + + # Custom attribute writer method with validation + # @param limiting_count [Object] Object to be assigned + # @!visibility private + def limiting_count=(limiting_count) + if limiting_count.nil? + fail ArgumentError, 'invalid value for "limiting_count", limiting_count cannot be nil.' + end + @limiting_count = limiting_count + end + + # Custom attribute writer method with validation + # @param max_utilization [Object] Object to be assigned + # @!visibility private + def max_utilization=(max_utilization) + if max_utilization.nil? + fail ArgumentError, 'invalid value for "max_utilization", max_utilization cannot be nil.' + end + @max_utilization = max_utilization + end + + # Custom attribute writer method with validation + # @param near_limit_count [Object] Object to be assigned + # @!visibility private + def near_limit_count=(near_limit_count) + if near_limit_count.nil? + fail ArgumentError, 'invalid value for "near_limit_count", near_limit_count cannot be nil.' + end + @near_limit_count = near_limit_count + end + + # Custom attribute writer method with validation + # @param rate_limit_id [Object] Object to be assigned + # @!visibility private + def rate_limit_id=(rate_limit_id) + if rate_limit_id.nil? + fail ArgumentError, 'invalid value for "rate_limit_id", rate_limit_id cannot be nil.' + end + @rate_limit_id = rate_limit_id + end + + # Custom attribute writer method with validation + # @param truncated [Object] Object to be assigned + # @!visibility private + def truncated=(truncated) + if truncated.nil? + fail ArgumentError, 'invalid value for "truncated", truncated cannot be nil.' + end + @truncated = truncated + 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 && + instance_count == o.instance_count && + limited_requests == o.limited_requests && + limiting_count == o.limiting_count && + max_utilization == o.max_utilization && + near_limit_count == o.near_limit_count && + rate_limit_id == o.rate_limit_id && + scope_restricted == o.scope_restricted && + truncated == o.truncated && + would_limit_requests == o.would_limit_requests && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [instance_count, limited_requests, limiting_count, max_utilization, near_limit_count, rate_limit_id, scope_restricted, truncated, would_limit_requests, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ai_gateway_rate_limit_instances_summary_resource.rb b/lib/datadog_api_client/v2/models/ai_gateway_rate_limit_instances_summary_resource.rb new file mode 100644 index 000000000000..2f31533c951b --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_gateway_rate_limit_instances_summary_resource.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Aggregate of a template rate limit's counters. + class AiGatewayRateLimitInstancesSummaryResource + include BaseGenericModel + + # Aggregate of a template rate limit's counters. + attr_reader :attributes + + # Rate limit UUID. + attr_reader :id + + # AI Gateway rate limit counter summary resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'AiGatewayRateLimitInstancesSummaryAttributes', + :'id' => :'UUID', + :'type' => :'AiGatewayRateLimitInstancesSummaryType' + } + 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::AiGatewayRateLimitInstancesSummaryResource` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ai_gateway_rate_limit_instances_summary_response.rb b/lib/datadog_api_client/v2/models/ai_gateway_rate_limit_instances_summary_response.rb new file mode 100644 index 000000000000..5a1b2f53bb0e --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_gateway_rate_limit_instances_summary_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing the aggregate of a template rate limit's counters. + class AiGatewayRateLimitInstancesSummaryResponse + include BaseGenericModel + + # Aggregate of a template rate limit's counters. + 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' => :'AiGatewayRateLimitInstancesSummaryResource' + } + 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::AiGatewayRateLimitInstancesSummaryResponse` 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/ai_gateway_rate_limit_instances_summary_type.rb b/lib/datadog_api_client/v2/models/ai_gateway_rate_limit_instances_summary_type.rb new file mode 100644 index 000000000000..8a8382f7ef1e --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_gateway_rate_limit_instances_summary_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 + # AI Gateway rate limit counter summary resource type. + class AiGatewayRateLimitInstancesSummaryType + include BaseEnumModel + + RATE_LIMIT_INSTANCES_SUMMARY = "rate-limit-instances-summary".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/ai_gateway_rate_limit_selector_entry.rb b/lib/datadog_api_client/v2/models/ai_gateway_rate_limit_selector_entry.rb new file mode 100644 index 000000000000..4f366c7017c3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_gateway_rate_limit_selector_entry.rb @@ -0,0 +1,167 @@ +=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 + # One dimension rule in a template rate limit selector. + class AiGatewayRateLimitSelectorEntry + include BaseGenericModel + + # Dimension to match: user_id, team_id, model, provider, or tag:. Reserved metadata tag keys are rejected. + attr_reader :dim + + # Give each matched value its own allowance when true. Otherwise, matched values share the allowance within the other separated dimensions. + attr_reader :per_value + + # Allowed dimension values. Omit to match any value; with per_value true, a request must still carry the dimension to match. An explicit list must contain at least one value. Listed team_id values must be existing Teams without open membership. + attr_reader :values + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'dim' => :'dim', + :'per_value' => :'per_value', + :'values' => :'values' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'dim' => :'String', + :'per_value' => :'Boolean', + :'values' => :'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::AiGatewayRateLimitSelectorEntry` 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?(:'dim') + self.dim = attributes[:'dim'] + end + + if attributes.key?(:'per_value') + self.per_value = attributes[:'per_value'] + end + + if attributes.key?(:'values') + if (value = attributes[:'values']).is_a?(Array) + self.values = 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 @dim.nil? + return false if @per_value.nil? + return false if !@values.nil? && @values.length < 1 + true + end + + # Custom attribute writer method with validation + # @param dim [Object] Object to be assigned + # @!visibility private + def dim=(dim) + if dim.nil? + fail ArgumentError, 'invalid value for "dim", dim cannot be nil.' + end + @dim = dim + end + + # Custom attribute writer method with validation + # @param per_value [Object] Object to be assigned + # @!visibility private + def per_value=(per_value) + if per_value.nil? + fail ArgumentError, 'invalid value for "per_value", per_value cannot be nil.' + end + @per_value = per_value + end + + # Custom attribute writer method with validation + # @param values [Object] Object to be assigned + # @!visibility private + def values=(values) + if !values.nil? && values.length < 1 + fail ArgumentError, 'invalid value for "values", number of items must be greater than or equal to 1.' + end + @values = values + 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 && + dim == o.dim && + per_value == o.per_value && + values == o.values && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [dim, per_value, values, additional_properties].hash + end + end +end