diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index dc42b6b29aad..0516704b1c3e 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -2588,6 +2588,517 @@ components: $ref: "#/components/schemas/JSONAPIErrorResponse" description: The server cannot process the request because it contains invalid data. schemas: + AIGuardAction: + description: The recommended action for the evaluated conversation. + enum: + - ALLOW + - DENY + - ABORT + example: ALLOW + type: string + x-enum-varnames: + - ALLOW + - DENY + - ABORT + AIGuardCodingAgent: + description: |- + The coding agent that produced the conversation. By default, a non-empty + value selects the coding-agent evaluator profile, while an omitted or empty + value selects the default profile. Known identifiers include `claude-code`, + `codex`, `cursor`, and `github-copilot`; other identifiers are accepted. + The coding-agent profile assumes the caller can ask the user to confirm + Supply Chain Firewall warnings; the default profile assumes it cannot. + example: claude-code + type: string + AIGuardConfidenceThreshold: + additionalProperties: + description: The confidence threshold override for the threat tag named by the property. + example: 0.9 + format: double + type: number + description: |- + Request-level confidence threshold override. `flagging_global` is the global + threshold applied to every threat category. Any other property is a + per-category override keyed by an AI Guard threat tag; per-category values + take precedence over `flagging_global`, and categories without an entry fall + back to it. When this object omits flagging_global, the fallback is `0.5`. + Recognized category keys include policy-evasion, indirect-prompt-injection, + system-and-capability-discovery, credential-access, sensitive-data-collection, + privilege-escalation, malicious-execution, private-network-target, + destructive-or-resource-abuse, tool-abuse, poisoning-or-persistence, and + `data-exfiltration`. Unknown category keys are ignored. + example: + flagging_global: 0.6 + policy-evasion: 0.9 + properties: + flagging_global: + description: The global confidence threshold applied to categories without a specific override. + example: 0.6 + format: double + type: number + type: object + AIGuardConfidenceThresholdOverride: + description: |- + Request-only confidence threshold override. A number sets the threshold + for every threat category; an object supplies a global threshold and + optional per-category overrides. Omit this field to use the stored + sensitivity policy. This field is not returned in evaluation responses. + oneOf: + - $ref: "#/components/schemas/AIGuardGlobalConfidenceThreshold" + - $ref: "#/components/schemas/AIGuardConfidenceThreshold" + AIGuardContentPart: + description: |- + One part of multipart message content, following the OpenAI content part + format. For user, system, developer, and tool messages, a text part must + include non-empty `text`, and an image part must include `image_url` with + a non-empty `url`. These content-part checks do not apply to assistant messages. + properties: + image_url: + $ref: "#/components/schemas/AIGuardImageURL" + text: + description: The text content, required and non-empty when `type` is `text` in a user, system, developer, or tool message. + example: What is the weather like today? + type: string + type: + $ref: "#/components/schemas/AIGuardContentPartType" + required: + - type + type: object + AIGuardContentPartType: + description: The type of the content part. + enum: + - text + - image_url + example: text + type: string + x-enum-varnames: + - TEXT + - IMAGE_URL + AIGuardEvaluateAttributesResponse: + description: The evaluation result with the recommended action and detected threat information. + properties: + action: + $ref: "#/components/schemas/AIGuardAction" + global_prob: + description: The global threat probability, between `0` and `1`. Included only when computed. + example: 0.005218505859375 + format: double + type: number + is_blocking_enabled: + description: Whether blocking is enabled for the organization. + example: false + type: boolean + reason: + description: The explanation for the recommended action, for logging rather than user-facing display. + example: No rule match. + type: string + redaction_replacements: + description: The redacted replacements computed for the request. Included only when redaction applies. + items: + $ref: "#/components/schemas/AIGuardRedactionReplacement" + type: array + scfw_findings: + $ref: "#/components/schemas/AIGuardScfwFindings" + sds_findings: + description: The sensitive data findings from the Sensitive Data Scanner. Included only when findings exist. + items: + $ref: "#/components/schemas/AIGuardSdsFinding" + type: array + tag_probs: + additionalProperties: + description: The detection confidence for the threat tag named by the property. + example: 0.97 + format: double + type: number + description: The detection confidence for each threat tag, between `0` and `1`. May be null when the evaluation does not produce per-category scores. + example: + nullable: true + type: object + tags: + description: The threat tags detected in the conversation. + example: [] + items: + description: A detected threat tag. + example: destructive-or-resource-abuse + type: string + type: array + required: + - action + - reason + - tags + - tag_probs + - is_blocking_enabled + type: object + AIGuardEvaluateDataResponse: + description: The JSON:API evaluation resource. + properties: + attributes: + $ref: "#/components/schemas/AIGuardEvaluateAttributesResponse" + id: + description: The unique identifier of the evaluation. + example: a76a703c-324f-42ed-af33-9b17d65e28af + type: string + type: + $ref: "#/components/schemas/AIGuardEvaluationType" + required: + - id + - type + - attributes + type: object + AIGuardEvaluateRequest: + description: The request to evaluate a conversation for security threats. + example: + data: + attributes: + messages: + - content: Hello world! + role: user + meta: + confidence_threshold: 0.8 + type: evaluations + properties: + data: + $ref: "#/components/schemas/AIGuardEvaluateRequestData" + required: + - data + type: object + AIGuardEvaluateRequestData: + description: The JSON:API request envelope for an AI Guard evaluation. + properties: + attributes: + $ref: "#/components/schemas/AIGuardEvaluateRequestDataAttributes" + type: + $ref: "#/components/schemas/AIGuardEvaluationType" + required: + - type + - attributes + type: object + AIGuardEvaluateRequestDataAttributes: + description: The conversation to evaluate and its metadata. + properties: + messages: + description: The messages of the conversation to evaluate, in order. Must contain at least one message. + items: + $ref: "#/components/schemas/AIGuardMessage" + minItems: 1 + type: array + meta: + $ref: "#/components/schemas/AIGuardMeta" + required: + - messages + type: object + AIGuardEvaluateResponse: + description: The response containing the evaluation result. + properties: + data: + $ref: "#/components/schemas/AIGuardEvaluateDataResponse" + required: + - data + type: object + AIGuardEvaluationType: + description: |- + The JSON:API resource type for AI Guard evaluation requests and responses. + Its value is `evaluations` for the action endpoint `/api/v2/ai-guard/evaluate`. + enum: + - evaluations + example: evaluations + type: string + x-enum-varnames: + - EVALUATIONS + AIGuardGlobalConfidenceThreshold: + description: The global confidence threshold applied to every threat category. + example: 0.8 + format: double + type: number + AIGuardImageURL: + description: An image referenced by URL in a message content part. + properties: + url: + description: The image URL or a data URI with an `image/png`, `image/jpeg`, `image/gif`, or `image/webp` MIME type. + example: https://example.com/image.png + type: string + required: + - url + type: object + AIGuardMessage: + description: |- + A message in the conversation. Content is required for user, system, + developer, and tool messages, but may be omitted for assistant messages. + For those non-assistant roles, a plain content string may be empty, but a + multipart content array must contain at least one valid content part. + Only assistant messages may contain tool calls, and tool call entries must + not be null. Tool messages must include a non-empty `tool_call_id`; other + message roles must not include a non-empty `tool_call_id`. + properties: + content: + $ref: "#/components/schemas/AIGuardMessageContent" + role: + $ref: "#/components/schemas/AIGuardMessageRole" + tool_call_id: + description: The identifier of the tool call this message responds to, present on tool result messages. + example: call_1 + type: string + tool_calls: + description: The tool calls emitted by the assistant, present on assistant messages that call tools. + items: + $ref: "#/components/schemas/AIGuardToolCall" + type: array + required: + - role + type: object + AIGuardMessageContent: + description: The content of a message, either a plain string or a list of OpenAI-style content parts. + oneOf: + - $ref: "#/components/schemas/AIGuardMessageContentText" + - $ref: "#/components/schemas/AIGuardMessageContentParts" + AIGuardMessageContentParts: + description: The message content as a list of content parts. The list must be non-empty for user, system, developer, and tool messages. + items: + $ref: "#/components/schemas/AIGuardContentPart" + type: array + AIGuardMessageContentText: + description: The message content as a plain string. + example: What is the weather like today? + type: string + AIGuardMessageRole: + description: The role of the message author in the conversation. + enum: + - user + - assistant + - system + - developer + - tool + example: user + type: string + x-enum-varnames: + - USER + - ASSISTANT + - SYSTEM + - DEVELOPER + - TOOL + AIGuardMeta: + description: Metadata about the evaluated conversation, used to select the policy and evaluator behavior. + properties: + coding_agent: + $ref: "#/components/schemas/AIGuardCodingAgent" + confidence_threshold: + $ref: "#/components/schemas/AIGuardConfidenceThresholdOverride" + env: + description: The environment the conversation belongs to. + example: production + type: string + is_sds_enabled_override: + description: Whether to run the Sensitive Data Scanner for this request, overriding the stored policy. + example: true + type: boolean + service: + description: The name of the service the conversation belongs to. + example: my-web-app + type: string + tool_policies: + additionalProperties: + $ref: "#/components/schemas/AIGuardToolPolicyAction" + description: |- + A non-empty map replaces stored tool policies for this request only, + keyed by tool name. Any called tool not present resolves to EVALUATE. + Only takes effect when tool policies are enabled for the organization. + example: + shell: BLOCK + type: object + type: object + AIGuardRedactionReplacement: + description: The fully redacted content for one path in the request. + properties: + path: + description: The path of the redacted content relative to the request attributes. + example: messages[0].content + type: string + replacement: + description: The redacted replacement content. + example: "[REDACTED]" + type: string + required: + - path + - replacement + type: object + AIGuardScfwFindings: + description: |- + The Supply Chain Firewall verdict for the version-pinned install packages + found in the request. Evaluation requires Supply Chain Firewall to be enabled + for the organization and the caller to have the `appsec_vm_read` permission. + Without that permission, Supply Chain Firewall evaluation is skipped; the + AI Guard evaluation request itself is not rejected. Findings are omitted + when Supply Chain Firewall does not produce a result. + The recommended action combines the package outcomes. + Confirmation support is inferred from the evaluator profile, not from a + separate confirmation-capability flag. By default, a non-empty + `meta.coding_agent` selects the coding-agent profile, which assumes the caller + can ask for confirmation and retains WARN in `recommended_action`. + Omitting `meta.coding_agent` or setting it to an empty string selects the + default profile, which assumes the caller cannot ask for confirmation and + returns ALLOW instead of WARN in `recommended_action`. Package outcomes + still retain WARN, and BLOCK is never changed to ALLOW by this rule. + properties: + packages: + description: The packages the firewall evaluated, `ALLOW` ones included. + items: + $ref: "#/components/schemas/AIGuardScfwPackageFinding" + type: array + recommended_action: + $ref: "#/components/schemas/AIGuardScfwOutcome" + required: + - recommended_action + type: object + AIGuardScfwMatchedRule: + description: One rule the Supply Chain Firewall matched on a package, with the outcome the rule reached. + properties: + outcome: + $ref: "#/components/schemas/AIGuardScfwOutcome" + rule: + description: The rule text the firewall reported, or the policy type when no text was reported. + example: "Disallow install commands" + type: string + required: + - rule + - outcome + type: object + AIGuardScfwOutcome: + description: The Supply Chain Firewall outcome for a package, a matched rule, or the whole request. + enum: + - ALLOW + - WARN + - BLOCK + example: BLOCK + type: string + x-enum-descriptions: + - Proceed with the install. + - Confirm with the user before installing. + - Do not install. + x-enum-varnames: + - ALLOW + - WARN + - BLOCK + AIGuardScfwPackageFinding: + description: One package the Supply Chain Firewall evaluated, with the outcome and every matched rule. + properties: + ecosystem: + description: The package ecosystem the firewall evaluated, such as `PyPI`, `npm`, or `crates.io`. + example: npm + type: string + matched_rules: + description: Every rule the firewall matched on the package. + items: + $ref: "#/components/schemas/AIGuardScfwMatchedRule" + type: array + name: + description: The name of the package. + example: left-pad + type: string + outcome: + $ref: "#/components/schemas/AIGuardScfwOutcome" + version: + description: The version of the package. + example: 1.3.0 + type: string + required: + - ecosystem + - name + - version + - outcome + type: object + AIGuardSdsFinding: + description: A sensitive data finding from the Sensitive Data Scanner. + properties: + category: + description: The category of the sensitive data found. + example: financial + type: string + location: + $ref: "#/components/schemas/AIGuardSdsFindingLocation" + rule_display_name: + description: The display name of the SDS rule that matched. + example: Credit Card Number + type: string + rule_tag: + description: The tag of the SDS rule that matched. + example: credit-card + type: string + required: + - rule_display_name + - rule_tag + - category + - location + type: object + AIGuardSdsFindingLocation: + description: The location of a sensitive data match within the request. + properties: + end_index_exclusive: + description: The exclusive end index of the match within the located content. + example: 42 + format: int64 + type: integer + path: + description: The path of the match relative to the request attributes. + example: messages[0].content + type: string + start_index: + description: The start index of the match within the located content. + example: 12 + format: int64 + type: integer + required: + - path + - start_index + - end_index_exclusive + type: object + AIGuardToolCall: + description: A tool call emitted by the assistant. + properties: + function: + $ref: "#/components/schemas/AIGuardToolCallFunction" + id: + description: The identifier of the tool call. + example: call_1 + type: string + required: + - id + - function + type: object + AIGuardToolCallFunction: + description: The function invoked by a tool call. + properties: + arguments: + description: The arguments of the function call, serialized as a JSON string. + example: '{"command":"shutdown"}' + type: string + name: + description: The name of the function to call. + example: shell + type: string + required: + - name + - arguments + type: object + AIGuardToolPolicyAction: + description: |- + The policy action for a tool named by the property. Tool policies override + the recommendation after evaluation; they do not skip evaluation. + Any BLOCK takes precedence over PASS and EVALUATE. The Supply Chain Firewall + is applied afterward and can still return DENY. + enum: + - PASS + - BLOCK + - EVALUATE + example: EVALUATE + type: string + x-enum-descriptions: + - Recommend ALLOW when all called tools use PASS, overriding the evaluation result. + - Recommend DENY if any called tool uses BLOCK, overriding the evaluation result. + - Use the evaluation result unless another called tool uses BLOCK. + x-enum-varnames: + - PASS + - BLOCK + - EVALUATE AIImpactUserActivityAttributes: additionalProperties: false description: |- @@ -145100,6 +145611,7 @@ components: ai_gateway_config_read: View AI Gateway configuration. ai_gateway_config_write: Create, update, and delete AI Gateway configuration. ai_gateway_usage: Use AI Gateway and view configuration applicable to the authenticated user. + ai_guard_evaluate: Evaluate conversations for security threats with AI Guard. apm_api_catalog_read: View API catalog and API definitions. apm_api_catalog_write: Add, modify, and delete API catalog definitions. apm_read: Read and query APM and Trace Analytics. @@ -148247,6 +148759,125 @@ paths: operator: OR permissions: - security_monitoring_findings_read + /api/v2/ai-guard/evaluate: + post: + description: |- + Analyzes a conversation for security threats such as prompt injection, + jailbreak attempts, and other AI-specific attacks. Returns an action + recommendation (`ALLOW`, `DENY`, or `ABORT`) along with the detected threat + tags and their confidence scores. + AI Guard must be activated for the organization, and the calling user or + application key requires the `ai_guard_evaluate` permission. The action is a + recommendation for the caller to enforce: ALLOW permits the interaction, + DENY blocks the interaction, and ABORT terminates the workflow. + This endpoint is rate limited to `700` requests per minute per organization. + Organization token limits can also result in a 429 response. + Malformed messages return a 400 response. Requests exceeding the raw-input + limit of 1,000,000 tokens return a 413 response; this limit applies to the + input context, not only the size of the HTTP request body. + operationId: EvaluateAIGuardRequest + requestBody: + content: + application/json: + examples: + default: + summary: Evaluate a user message + value: + data: + attributes: + messages: + - content: Hello world! + role: user + meta: + confidence_threshold: 0.8 + type: evaluations + per_category_threshold: + summary: Evaluate with per-category confidence thresholds + value: + data: + attributes: + messages: + - content: Hello world! + role: user + meta: + confidence_threshold: + flagging_global: 0.6 + indirect-prompt-injection: 0.4 + policy-evasion: 0.9 + type: evaluations + schema: + $ref: "#/components/schemas/AIGuardEvaluateRequest" + description: The conversation to evaluate for security threats. + required: true + responses: + "200": + content: + application/json: + examples: + default: + summary: Evaluation of a benign user message + value: + data: + attributes: + action: ALLOW + global_prob: 0.005218505859375 + is_blocking_enabled: false + reason: No rule match. + tag_probs: + tags: [] + id: a76a703c-324f-42ed-af33-9b17d65e28af + type: evaluations + schema: + $ref: "#/components/schemas/AIGuardEvaluateResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "408": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Request Timeout + "413": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Payload Too Large + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - ai_guard_evaluate + summary: Evaluate an AI Guard request + tags: + - AI Guard + x-codegen-request-body-name: body + x-permission: + operator: AND + permissions: + - ai_guard_evaluate + 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/ai_impact/user_activity: post: description: |- @@ -256357,6 +256988,8 @@ servers: default: api description: The subdomain where the API is deployed. tags: + - description: Evaluate LLM interactions for security threats such as prompt injection and jailbreak attempts. + name: AI Guard - description: |- Configure your API endpoints through the Datadog API. name: API Management diff --git a/examples/v2/ai-guard/EvaluateAIGuardRequest.rb b/examples/v2/ai-guard/EvaluateAIGuardRequest.rb new file mode 100644 index 000000000000..75fc836bc5e3 --- /dev/null +++ b/examples/v2/ai-guard/EvaluateAIGuardRequest.rb @@ -0,0 +1,26 @@ +# Evaluate an AI Guard request returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.access_token = ENV["DD_BEARER_TOKEN"] + config.unstable_operations["v2.evaluate_ai_guard_request".to_sym] = true +end +api_instance = DatadogAPIClient::V2::AIGuardAPI.new + +body = DatadogAPIClient::V2::AIGuardEvaluateRequest.new({ + data: DatadogAPIClient::V2::AIGuardEvaluateRequestData.new({ + type: DatadogAPIClient::V2::AIGuardEvaluationType::EVALUATIONS, + attributes: DatadogAPIClient::V2::AIGuardEvaluateRequestDataAttributes.new({ + messages: [ + DatadogAPIClient::V2::AIGuardMessage.new({ + content: "Hello world!", + role: DatadogAPIClient::V2::AIGuardMessageRole::USER, + }), + ], + meta: DatadogAPIClient::V2::AIGuardMeta.new({ + confidence_threshold: 0.8, + }), + }), + }), +}) +p api_instance.evaluate_ai_guard_request(body) diff --git a/examples/v2/ai-guard/EvaluateAIGuardRequest_1377048937.rb b/examples/v2/ai-guard/EvaluateAIGuardRequest_1377048937.rb new file mode 100644 index 000000000000..67c77b12afab --- /dev/null +++ b/examples/v2/ai-guard/EvaluateAIGuardRequest_1377048937.rb @@ -0,0 +1,29 @@ +# Evaluate an AI Guard request with per-category confidence thresholds + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.access_token = ENV["DD_BEARER_TOKEN"] + config.unstable_operations["v2.evaluate_ai_guard_request".to_sym] = true +end +api_instance = DatadogAPIClient::V2::AIGuardAPI.new + +body = DatadogAPIClient::V2::AIGuardEvaluateRequest.new({ + data: DatadogAPIClient::V2::AIGuardEvaluateRequestData.new({ + type: DatadogAPIClient::V2::AIGuardEvaluationType::EVALUATIONS, + attributes: DatadogAPIClient::V2::AIGuardEvaluateRequestDataAttributes.new({ + messages: [ + DatadogAPIClient::V2::AIGuardMessage.new({ + role: DatadogAPIClient::V2::AIGuardMessageRole::USER, + content: "Hello world!", + }), + ], + meta: DatadogAPIClient::V2::AIGuardMeta.new({ + confidence_threshold: DatadogAPIClient::V2::AIGuardConfidenceThreshold.new({ + flagging_global: 0.6, + "policy-evasion" => 0.9, "indirect-prompt-injection" => 0.4, + }), + }), + }), + }), +}) +p api_instance.evaluate_ai_guard_request(body) diff --git a/examples/v2/ai-guard/EvaluateAIGuardRequest_3923646360.rb b/examples/v2/ai-guard/EvaluateAIGuardRequest_3923646360.rb new file mode 100644 index 000000000000..6b4ab619acbb --- /dev/null +++ b/examples/v2/ai-guard/EvaluateAIGuardRequest_3923646360.rb @@ -0,0 +1,26 @@ +# Evaluate an AI Guard request with a numeric confidence threshold + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.access_token = ENV["DD_BEARER_TOKEN"] + config.unstable_operations["v2.evaluate_ai_guard_request".to_sym] = true +end +api_instance = DatadogAPIClient::V2::AIGuardAPI.new + +body = DatadogAPIClient::V2::AIGuardEvaluateRequest.new({ + data: DatadogAPIClient::V2::AIGuardEvaluateRequestData.new({ + type: DatadogAPIClient::V2::AIGuardEvaluationType::EVALUATIONS, + attributes: DatadogAPIClient::V2::AIGuardEvaluateRequestDataAttributes.new({ + messages: [ + DatadogAPIClient::V2::AIGuardMessage.new({ + role: DatadogAPIClient::V2::AIGuardMessageRole::USER, + content: "Hello world!", + }), + ], + meta: DatadogAPIClient::V2::AIGuardMeta.new({ + confidence_threshold: 0.8, + }), + }), + }), +}) +p api_instance.evaluate_ai_guard_request(body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index a4fb7ff0dd4f..aa0c5e019906 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -1340,6 +1340,9 @@ "v2.GetAwsOnDemandTask" => { "task_id" => "String", }, + "v2.EvaluateAIGuardRequest" => { + "body" => "AIGuardEvaluateRequest", + }, "v2.CreateAIImpactUserActivity" => { "body" => "AIImpactUserActivityRequest", }, diff --git a/features/v2/ai_guard.feature b/features/v2/ai_guard.feature new file mode 100644 index 000000000000..b205d90c0951 --- /dev/null +++ b/features/v2/ai_guard.feature @@ -0,0 +1,71 @@ +@endpoint(ai-guard) @endpoint(ai-guard-v2) +Feature: AI Guard + Evaluate LLM interactions for security threats such as prompt injection + and jailbreak attempts. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "AIGuard" API + And operation "EvaluateAIGuardRequest" enabled + And new "EvaluateAIGuardRequest" request + + @team:ddoghq/k9-ai-guard + Scenario: Evaluate an AI Guard request rejects empty multipart user content + Given body with value {"data":{"type":"evaluations","attributes":{"messages":[{"role":"user","content":[]}]}}} + When the request is sent + Then the response status is 400 Bad Request + + @team:ddoghq/k9-ai-guard + Scenario: Evaluate an AI Guard request rejects image parts without a URL + Given body with value {"data":{"type":"evaluations","attributes":{"messages":[{"role":"user","content":[{"type":"image_url","image_url":{"url":""}}]}]}}} + When the request is sent + Then the response status is 400 Bad Request + + @team:ddoghq/k9-ai-guard + Scenario: Evaluate an AI Guard request rejects text parts without text + Given body with value {"data":{"type":"evaluations","attributes":{"messages":[{"role":"user","content":[{"type":"text"}]}]}}} + When the request is sent + Then the response status is 400 Bad Request + + @team:ddoghq/k9-ai-guard + Scenario: Evaluate an AI Guard request returns "Bad Request" response + Given body with value {"data":{"type":"evaluations","attributes":{"messages":[{"role":"user"}]}}} + When the request is sent + Then the response status is 400 Bad Request + + @team:ddoghq/k9-ai-guard + Scenario: Evaluate an AI Guard request returns "OK" response + Given body with value {"data": {"type": "evaluations", "attributes": {"messages": [{"content": "Hello world!", "role": "user"}], "meta": {"confidence_threshold": 0.8}}}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:ddoghq/k9-ai-guard + Scenario: Evaluate an AI Guard request returns "Payload Too Large" response + Given body with value {"data": {"attributes": {"messages": [{"content": "Hello world!", "role": "user"}], "meta": {"confidence_threshold": 0.8}}, "type": "evaluations"}} + When the request is sent + Then the response status is 413 Payload Too Large + + @generated @skip @team:ddoghq/k9-ai-guard + Scenario: Evaluate an AI Guard request returns "Request Timeout" response + Given body with value {"data": {"attributes": {"messages": [{"content": "Hello world!", "role": "user"}], "meta": {"confidence_threshold": 0.8}}, "type": "evaluations"}} + When the request is sent + Then the response status is 408 Request Timeout + + @team:ddoghq/k9-ai-guard + Scenario: Evaluate an AI Guard request with a numeric confidence threshold + Given body with value {"data":{"type":"evaluations","attributes":{"messages":[{"role":"user","content":"Hello world!"}],"meta":{"confidence_threshold":0.8}}}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "evaluations" + And the response "data.attributes" has field "action" + And the response "data.attributes" has field "is_blocking_enabled" + + @team:ddoghq/k9-ai-guard + Scenario: Evaluate an AI Guard request with per-category confidence thresholds + Given body with value {"data":{"type":"evaluations","attributes":{"messages":[{"role":"user","content":"Hello world!"}],"meta":{"confidence_threshold":{"flagging_global":0.6,"policy-evasion":0.9,"indirect-prompt-injection":0.4}}}}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "evaluations" + And the response "data.attributes" has field "action" + And the response "data.attributes" has field "is_blocking_enabled" diff --git a/features/v2/undo.json b/features/v2/undo.json index 45b82eb3cd77..c644e09b5777 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -374,6 +374,12 @@ "type": "safe" } }, + "EvaluateAIGuardRequest": { + "tag": "AI Guard", + "undo": { + "type": "safe" + } + }, "CreateAIImpactUserActivity": { "tag": "Delivery Performance", "undo": { diff --git a/generated-test/test-runner-data/manifest.json b/generated-test/test-runner-data/manifest.json index c050f4092502..577c2e270526 100644 --- a/generated-test/test-runner-data/manifest.json +++ b/generated-test/test-runner-data/manifest.json @@ -2793,6 +2793,55 @@ "scenario": "Update GCP scan options returns \"OK\" response", "version": "v2" }, + { + "feature": "AI Guard", + "feature_file": "../../features/v2/ai_guard.feature", + "file": "v2/ai-guard/evaluate-an-ai-guard-request-rejects-empty-multipart-user-content.json", + "scenario": "Evaluate an AI Guard request rejects empty multipart user content", + "version": "v2" + }, + { + "feature": "AI Guard", + "feature_file": "../../features/v2/ai_guard.feature", + "file": "v2/ai-guard/evaluate-an-ai-guard-request-rejects-image-parts-without-a-url.json", + "scenario": "Evaluate an AI Guard request rejects image parts without a URL", + "version": "v2" + }, + { + "feature": "AI Guard", + "feature_file": "../../features/v2/ai_guard.feature", + "file": "v2/ai-guard/evaluate-an-ai-guard-request-rejects-text-parts-without-text.json", + "scenario": "Evaluate an AI Guard request rejects text parts without text", + "version": "v2" + }, + { + "feature": "AI Guard", + "feature_file": "../../features/v2/ai_guard.feature", + "file": "v2/ai-guard/evaluate-an-ai-guard-request-returns-bad-request-response.json", + "scenario": "Evaluate an AI Guard request returns \"Bad Request\" response", + "version": "v2" + }, + { + "feature": "AI Guard", + "feature_file": "../../features/v2/ai_guard.feature", + "file": "v2/ai-guard/evaluate-an-ai-guard-request-returns-ok-response.json", + "scenario": "Evaluate an AI Guard request returns \"OK\" response", + "version": "v2" + }, + { + "feature": "AI Guard", + "feature_file": "../../features/v2/ai_guard.feature", + "file": "v2/ai-guard/evaluate-an-ai-guard-request-with-a-numeric-confidence-threshold.json", + "scenario": "Evaluate an AI Guard request with a numeric confidence threshold", + "version": "v2" + }, + { + "feature": "AI Guard", + "feature_file": "../../features/v2/ai_guard.feature", + "file": "v2/ai-guard/evaluate-an-ai-guard-request-with-per-category-confidence-thresholds.json", + "scenario": "Evaluate an AI Guard request with per-category confidence thresholds", + "version": "v2" + }, { "feature": "Annotations", "feature_file": "../../features/v2/annotations.feature", diff --git a/generated-test/test-runner-data/v2/ai-guard/evaluate-an-ai-guard-request-rejects-empty-multipart-user-content.json b/generated-test/test-runner-data/v2/ai-guard/evaluate-an-ai-guard-request-rejects-empty-multipart-user-content.json new file mode 100644 index 000000000000..b9b5a8a692ca --- /dev/null +++ b/generated-test/test-runner-data/v2/ai-guard/evaluate-an-ai-guard-request-rejects-empty-multipart-user-content.json @@ -0,0 +1,38 @@ +{ + "api": "AIGuard", + "expected_status": 400, + "feature": "AI Guard", + "id": "v2/AI Guard/Evaluate an AI Guard request rejects empty multipart user content", + "operation_id": "EvaluateAIGuardRequest", + "request": { + "body": { + "schema": { + "format": null, + "ref": "AIGuardEvaluateRequest", + "type": "object" + }, + "source": "inline", + "value": { + "data": { + "attributes": { + "messages": [ + { + "content": [], + "role": "user" + } + ] + }, + "type": "evaluations" + } + } + }, + "content_type": "application/json", + "method": "POST", + "pagination": false, + "parameters": [], + "path": "/api/v2/ai-guard/evaluate" + }, + "scenario": "Evaluate an AI Guard request rejects empty multipart user content", + "schema_version": 1, + "version": "v2" +} diff --git a/generated-test/test-runner-data/v2/ai-guard/evaluate-an-ai-guard-request-rejects-image-parts-without-a-url.json b/generated-test/test-runner-data/v2/ai-guard/evaluate-an-ai-guard-request-rejects-image-parts-without-a-url.json new file mode 100644 index 000000000000..b756f693b088 --- /dev/null +++ b/generated-test/test-runner-data/v2/ai-guard/evaluate-an-ai-guard-request-rejects-image-parts-without-a-url.json @@ -0,0 +1,45 @@ +{ + "api": "AIGuard", + "expected_status": 400, + "feature": "AI Guard", + "id": "v2/AI Guard/Evaluate an AI Guard request rejects image parts without a URL", + "operation_id": "EvaluateAIGuardRequest", + "request": { + "body": { + "schema": { + "format": null, + "ref": "AIGuardEvaluateRequest", + "type": "object" + }, + "source": "inline", + "value": { + "data": { + "attributes": { + "messages": [ + { + "content": [ + { + "image_url": { + "url": "" + }, + "type": "image_url" + } + ], + "role": "user" + } + ] + }, + "type": "evaluations" + } + } + }, + "content_type": "application/json", + "method": "POST", + "pagination": false, + "parameters": [], + "path": "/api/v2/ai-guard/evaluate" + }, + "scenario": "Evaluate an AI Guard request rejects image parts without a URL", + "schema_version": 1, + "version": "v2" +} diff --git a/generated-test/test-runner-data/v2/ai-guard/evaluate-an-ai-guard-request-rejects-text-parts-without-text.json b/generated-test/test-runner-data/v2/ai-guard/evaluate-an-ai-guard-request-rejects-text-parts-without-text.json new file mode 100644 index 000000000000..19f085b53e6a --- /dev/null +++ b/generated-test/test-runner-data/v2/ai-guard/evaluate-an-ai-guard-request-rejects-text-parts-without-text.json @@ -0,0 +1,42 @@ +{ + "api": "AIGuard", + "expected_status": 400, + "feature": "AI Guard", + "id": "v2/AI Guard/Evaluate an AI Guard request rejects text parts without text", + "operation_id": "EvaluateAIGuardRequest", + "request": { + "body": { + "schema": { + "format": null, + "ref": "AIGuardEvaluateRequest", + "type": "object" + }, + "source": "inline", + "value": { + "data": { + "attributes": { + "messages": [ + { + "content": [ + { + "type": "text" + } + ], + "role": "user" + } + ] + }, + "type": "evaluations" + } + } + }, + "content_type": "application/json", + "method": "POST", + "pagination": false, + "parameters": [], + "path": "/api/v2/ai-guard/evaluate" + }, + "scenario": "Evaluate an AI Guard request rejects text parts without text", + "schema_version": 1, + "version": "v2" +} diff --git a/generated-test/test-runner-data/v2/ai-guard/evaluate-an-ai-guard-request-returns-bad-request-response.json b/generated-test/test-runner-data/v2/ai-guard/evaluate-an-ai-guard-request-returns-bad-request-response.json new file mode 100644 index 000000000000..120e864d709e --- /dev/null +++ b/generated-test/test-runner-data/v2/ai-guard/evaluate-an-ai-guard-request-returns-bad-request-response.json @@ -0,0 +1,37 @@ +{ + "api": "AIGuard", + "expected_status": 400, + "feature": "AI Guard", + "id": "v2/AI Guard/Evaluate an AI Guard request returns \"Bad Request\" response", + "operation_id": "EvaluateAIGuardRequest", + "request": { + "body": { + "schema": { + "format": null, + "ref": "AIGuardEvaluateRequest", + "type": "object" + }, + "source": "inline", + "value": { + "data": { + "attributes": { + "messages": [ + { + "role": "user" + } + ] + }, + "type": "evaluations" + } + } + }, + "content_type": "application/json", + "method": "POST", + "pagination": false, + "parameters": [], + "path": "/api/v2/ai-guard/evaluate" + }, + "scenario": "Evaluate an AI Guard request returns \"Bad Request\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/generated-test/test-runner-data/v2/ai-guard/evaluate-an-ai-guard-request-returns-ok-response.json b/generated-test/test-runner-data/v2/ai-guard/evaluate-an-ai-guard-request-returns-ok-response.json new file mode 100644 index 000000000000..b28a509acd17 --- /dev/null +++ b/generated-test/test-runner-data/v2/ai-guard/evaluate-an-ai-guard-request-returns-ok-response.json @@ -0,0 +1,41 @@ +{ + "api": "AIGuard", + "expected_status": 200, + "feature": "AI Guard", + "id": "v2/AI Guard/Evaluate an AI Guard request returns \"OK\" response", + "operation_id": "EvaluateAIGuardRequest", + "request": { + "body": { + "schema": { + "format": null, + "ref": "AIGuardEvaluateRequest", + "type": "object" + }, + "source": "inline", + "value": { + "data": { + "attributes": { + "messages": [ + { + "content": "Hello world!", + "role": "user" + } + ], + "meta": { + "confidence_threshold": 0.8 + } + }, + "type": "evaluations" + } + } + }, + "content_type": "application/json", + "method": "POST", + "pagination": false, + "parameters": [], + "path": "/api/v2/ai-guard/evaluate" + }, + "scenario": "Evaluate an AI Guard request returns \"OK\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/generated-test/test-runner-data/v2/ai-guard/evaluate-an-ai-guard-request-with-a-numeric-confidence-threshold.json b/generated-test/test-runner-data/v2/ai-guard/evaluate-an-ai-guard-request-with-a-numeric-confidence-threshold.json new file mode 100644 index 000000000000..e59b768e8df4 --- /dev/null +++ b/generated-test/test-runner-data/v2/ai-guard/evaluate-an-ai-guard-request-with-a-numeric-confidence-threshold.json @@ -0,0 +1,41 @@ +{ + "api": "AIGuard", + "expected_status": 200, + "feature": "AI Guard", + "id": "v2/AI Guard/Evaluate an AI Guard request with a numeric confidence threshold", + "operation_id": "EvaluateAIGuardRequest", + "request": { + "body": { + "schema": { + "format": null, + "ref": "AIGuardEvaluateRequest", + "type": "object" + }, + "source": "inline", + "value": { + "data": { + "attributes": { + "messages": [ + { + "content": "Hello world!", + "role": "user" + } + ], + "meta": { + "confidence_threshold": 0.8 + } + }, + "type": "evaluations" + } + } + }, + "content_type": "application/json", + "method": "POST", + "pagination": false, + "parameters": [], + "path": "/api/v2/ai-guard/evaluate" + }, + "scenario": "Evaluate an AI Guard request with a numeric confidence threshold", + "schema_version": 1, + "version": "v2" +} diff --git a/generated-test/test-runner-data/v2/ai-guard/evaluate-an-ai-guard-request-with-per-category-confidence-thresholds.json b/generated-test/test-runner-data/v2/ai-guard/evaluate-an-ai-guard-request-with-per-category-confidence-thresholds.json new file mode 100644 index 000000000000..1c7389f696c2 --- /dev/null +++ b/generated-test/test-runner-data/v2/ai-guard/evaluate-an-ai-guard-request-with-per-category-confidence-thresholds.json @@ -0,0 +1,45 @@ +{ + "api": "AIGuard", + "expected_status": 200, + "feature": "AI Guard", + "id": "v2/AI Guard/Evaluate an AI Guard request with per-category confidence thresholds", + "operation_id": "EvaluateAIGuardRequest", + "request": { + "body": { + "schema": { + "format": null, + "ref": "AIGuardEvaluateRequest", + "type": "object" + }, + "source": "inline", + "value": { + "data": { + "attributes": { + "messages": [ + { + "content": "Hello world!", + "role": "user" + } + ], + "meta": { + "confidence_threshold": { + "flagging_global": 0.6, + "indirect-prompt-injection": 0.4, + "policy-evasion": 0.9 + } + } + }, + "type": "evaluations" + } + } + }, + "content_type": "application/json", + "method": "POST", + "pagination": false, + "parameters": [], + "path": "/api/v2/ai-guard/evaluate" + }, + "scenario": "Evaluate an AI Guard request with per-category confidence thresholds", + "schema_version": 1, + "version": "v2" +} diff --git a/generated-test/test-server-data/manifest.json b/generated-test/test-server-data/manifest.json index b57e8c66bce0..563b35eb133d 100644 --- a/generated-test/test-server-data/manifest.json +++ b/generated-test/test-server-data/manifest.json @@ -115,6 +115,11 @@ "file": "v1/webhooks-integration.json", "version": "v1" }, + { + "feature": "AI Guard", + "file": "v2/ai-guard.json", + "version": "v2" + }, { "feature": "APM Retention Filters", "file": "v2/apm-retention-filters.json", diff --git a/generated-test/test-server-data/v2/ai-guard.json b/generated-test/test-server-data/v2/ai-guard.json new file mode 100644 index 000000000000..269a7e0d2bd2 --- /dev/null +++ b/generated-test/test-server-data/v2/ai-guard.json @@ -0,0 +1,331 @@ +{ + "feature": "AI Guard", + "recordings": [ + { + "feature": "AI Guard", + "frozen_at": "2026-10-26T11:41:08.575Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "messages": [ + { + "content": [], + "role": "user" + } + ] + }, + "type": "evaluations" + } + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v2/ai-guard/evaluate", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"content parts cannot be empty array for user messages\"}]}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "Bad Request", + "status": 400 + } + } + ], + "scenario": "Evaluate an AI Guard request rejects empty multipart user content", + "version": "v2" + }, + { + "feature": "AI Guard", + "frozen_at": "2026-10-26T11:41:08.682Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "messages": [ + { + "content": [ + { + "image_url": { + "url": "" + }, + "type": "image_url" + } + ], + "role": "user" + } + ] + }, + "type": "evaluations" + } + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v2/ai-guard/evaluate", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"content part 0: image_url is required when type is 'image_url'\"}]}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "Bad Request", + "status": 400 + } + } + ], + "scenario": "Evaluate an AI Guard request rejects image parts without a URL", + "version": "v2" + }, + { + "feature": "AI Guard", + "frozen_at": "2026-10-26T11:41:08.732Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "messages": [ + { + "content": [ + { + "type": "text" + } + ], + "role": "user" + } + ] + }, + "type": "evaluations" + } + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v2/ai-guard/evaluate", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"content part 0: text is required when type is 'text'\"}]}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "Bad Request", + "status": 400 + } + } + ], + "scenario": "Evaluate an AI Guard request rejects text parts without text", + "version": "v2" + }, + { + "feature": "AI Guard", + "frozen_at": "2026-10-26T11:41:08.777Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "messages": [ + { + "role": "user" + } + ] + }, + "type": "evaluations" + } + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v2/ai-guard/evaluate", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"content is required for user messages\"}]}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "Bad Request", + "status": 400 + } + } + ], + "scenario": "Evaluate an AI Guard request returns \"Bad Request\" response", + "version": "v2" + }, + { + "feature": "AI Guard", + "frozen_at": "2026-10-26T11:41:08.830Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "messages": [ + { + "content": "Hello world!", + "role": "user" + } + ], + "meta": { + "confidence_threshold": 0.8 + } + }, + "type": "evaluations" + } + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v2/ai-guard/evaluate", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":{\"id\":\"a76a703c-324f-42ed-af33-9b17d65e28af\",\"type\":\"evaluations\",\"attributes\":{\"action\":\"ALLOW\",\"global_prob\":0.005218505859375,\"is_blocking_enabled\":false,\"reason\":\"No rule match.\",\"tag_probs\":null,\"tags\":[]}}}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "OK", + "status": 200 + } + } + ], + "scenario": "Evaluate an AI Guard request returns \"OK\" response", + "version": "v2" + }, + { + "feature": "AI Guard", + "frozen_at": "2026-10-26T11:41:08.905Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "messages": [ + { + "content": "Hello world!", + "role": "user" + } + ], + "meta": { + "confidence_threshold": 0.8 + } + }, + "type": "evaluations" + } + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v2/ai-guard/evaluate", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":{\"id\":\"645e547e-1430-41df-a7e5-7cee63a8110e\",\"type\":\"evaluations\",\"attributes\":{\"action\":\"ALLOW\",\"global_prob\":0.005218505859375,\"is_blocking_enabled\":false,\"reason\":\"No rule match.\",\"tag_probs\":null,\"tags\":[]}}}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "OK", + "status": 200 + } + } + ], + "scenario": "Evaluate an AI Guard request with a numeric confidence threshold", + "version": "v2" + }, + { + "feature": "AI Guard", + "frozen_at": "2026-10-26T11:41:08.982Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "messages": [ + { + "content": "Hello world!", + "role": "user" + } + ], + "meta": { + "confidence_threshold": { + "flagging_global": 0.6, + "indirect-prompt-injection": 0.4, + "policy-evasion": 0.9 + } + } + }, + "type": "evaluations" + } + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v2/ai-guard/evaluate", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":{\"id\":\"aeeb0cb1-32e2-4efa-82d9-3d8ce357ec72\",\"type\":\"evaluations\",\"attributes\":{\"action\":\"ALLOW\",\"global_prob\":0.005218505859375,\"is_blocking_enabled\":false,\"reason\":\"No rule match.\",\"tag_probs\":null,\"tags\":[]}}}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "OK", + "status": 200 + } + } + ], + "scenario": "Evaluate an AI Guard request with per-category confidence thresholds", + "version": "v2" + } + ], + "schema_version": 1, + "version": "v2" +} diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index b6c563db6935..09944c17d201 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -282,6 +282,7 @@ def initialize "v2.get_execution_policy": false, "v2.list_execution_policies": false, "v2.update_execution_policy": false, + "v2.evaluate_ai_guard_request": false, "v2.create_annotation": false, "v2.delete_annotation": false, "v2.get_page_annotations": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index c0d33615fc42..255635c1a4e3 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1311,6 +1311,33 @@ def overrides "v2.ai_custom_ruleset_update_attributes" => "AiCustomRulesetUpdateAttributes", "v2.ai_custom_ruleset_update_data" => "AiCustomRulesetUpdateData", "v2.ai_custom_ruleset_update_request" => "AiCustomRulesetUpdateRequest", + "v2.ai_guard_action" => "AIGuardAction", + "v2.ai_guard_confidence_threshold" => "AIGuardConfidenceThreshold", + "v2.ai_guard_confidence_threshold_override" => "AIGuardConfidenceThresholdOverride", + "v2.ai_guard_content_part" => "AIGuardContentPart", + "v2.ai_guard_content_part_type" => "AIGuardContentPartType", + "v2.ai_guard_evaluate_attributes_response" => "AIGuardEvaluateAttributesResponse", + "v2.ai_guard_evaluate_data_response" => "AIGuardEvaluateDataResponse", + "v2.ai_guard_evaluate_request" => "AIGuardEvaluateRequest", + "v2.ai_guard_evaluate_request_data" => "AIGuardEvaluateRequestData", + "v2.ai_guard_evaluate_request_data_attributes" => "AIGuardEvaluateRequestDataAttributes", + "v2.ai_guard_evaluate_response" => "AIGuardEvaluateResponse", + "v2.ai_guard_evaluation_type" => "AIGuardEvaluationType", + "v2.ai_guard_image_url" => "AIGuardImageURL", + "v2.ai_guard_message" => "AIGuardMessage", + "v2.ai_guard_message_content" => "AIGuardMessageContent", + "v2.ai_guard_message_role" => "AIGuardMessageRole", + "v2.ai_guard_meta" => "AIGuardMeta", + "v2.ai_guard_redaction_replacement" => "AIGuardRedactionReplacement", + "v2.ai_guard_scfw_findings" => "AIGuardScfwFindings", + "v2.ai_guard_scfw_matched_rule" => "AIGuardScfwMatchedRule", + "v2.ai_guard_scfw_outcome" => "AIGuardScfwOutcome", + "v2.ai_guard_scfw_package_finding" => "AIGuardScfwPackageFinding", + "v2.ai_guard_sds_finding" => "AIGuardSdsFinding", + "v2.ai_guard_sds_finding_location" => "AIGuardSdsFindingLocation", + "v2.ai_guard_tool_call" => "AIGuardToolCall", + "v2.ai_guard_tool_call_function" => "AIGuardToolCallFunction", + "v2.ai_guard_tool_policy_action" => "AIGuardToolPolicyAction", "v2.ai_impact_user_activity_attributes" => "AIImpactUserActivityAttributes", "v2.ai_impact_user_activity_data" => "AIImpactUserActivityData", "v2.ai_impact_user_activity_request" => "AIImpactUserActivityRequest", @@ -9873,6 +9900,7 @@ def overrides "v2.agent_health_api" => "AgentHealthAPI", "v2.agent_observability_api" => "AgentObservabilityAPI", "v2.agentless_scanning_api" => "AgentlessScanningAPI", + "v2.ai_guard_api" => "AIGuardAPI", "v2.annotations_api" => "AnnotationsAPI", "v2.api_management_api" => "APIManagementAPI", "v2.apm_api" => "APMAPI", diff --git a/lib/datadog_api_client/v2/api/ai_guard_api.rb b/lib/datadog_api_client/v2/api/ai_guard_api.rb new file mode 100644 index 000000000000..2cbf4fed9ac6 --- /dev/null +++ b/lib/datadog_api_client/v2/api/ai_guard_api.rb @@ -0,0 +1,111 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'cgi' + +module DatadogAPIClient::V2 + class AIGuardAPI + attr_accessor :api_client + + def initialize(api_client = DatadogAPIClient::APIClient.default) + @api_client = api_client + end + + # Evaluate an AI Guard request. + # + # @see #evaluate_ai_guard_request_with_http_info + def evaluate_ai_guard_request(body, opts = {}) + data, _status_code, _headers = evaluate_ai_guard_request_with_http_info(body, opts) + data + end + + # Evaluate an AI Guard request. + # + # Analyzes a conversation for security threats such as prompt injection, + # jailbreak attempts, and other AI-specific attacks. Returns an action + # recommendation (`ALLOW`, `DENY`, or `ABORT`) along with the detected threat + # tags and their confidence scores. + # AI Guard must be activated for the organization, and the calling user or + # application key requires the `ai_guard_evaluate` permission. The action is a + # recommendation for the caller to enforce: ALLOW permits the interaction, + # DENY blocks the interaction, and ABORT terminates the workflow. + # This endpoint is rate limited to `700` requests per minute per organization. + # Organization token limits can also result in a 429 response. + # Malformed messages return a 400 response. Requests exceeding the raw-input + # limit of 1,000,000 tokens return a 413 response; this limit applies to the + # input context, not only the size of the HTTP request body. + # + # @param body [AIGuardEvaluateRequest] The conversation to evaluate for security threats. + # @param opts [Hash] the optional parameters + # @return [Array<(AIGuardEvaluateResponse, Integer, Hash)>] AIGuardEvaluateResponse data, response status code and response headers + def evaluate_ai_guard_request_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.evaluate_ai_guard_request".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.evaluate_ai_guard_request") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.evaluate_ai_guard_request")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: AIGuardAPI.evaluate_ai_guard_request ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling AIGuardAPI.evaluate_ai_guard_request" + end + # resource path + local_var_path = '/api/v2/ai-guard/evaluate' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'AIGuardEvaluateResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :evaluate_ai_guard_request, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: AIGuardAPI#evaluate_ai_guard_request\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/datadog_api_client/v2/models/ai_guard_action.rb b/lib/datadog_api_client/v2/models/ai_guard_action.rb new file mode 100644 index 000000000000..16d8914948ed --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_guard_action.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 + # The recommended action for the evaluated conversation. + class AIGuardAction + include BaseEnumModel + + ALLOW = "ALLOW".freeze + DENY = "DENY".freeze + ABORT = "ABORT".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/ai_guard_confidence_threshold.rb b/lib/datadog_api_client/v2/models/ai_guard_confidence_threshold.rb new file mode 100644 index 000000000000..bed1b2a010fd --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_guard_confidence_threshold.rb @@ -0,0 +1,114 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request-level confidence threshold override. `flagging_global` is the global + # threshold applied to every threat category. Any other property is a + # per-category override keyed by an AI Guard threat tag; per-category values + # take precedence over `flagging_global`, and categories without an entry fall + # back to it. When this object omits flagging_global, the fallback is `0.5`. + # Recognized category keys include policy-evasion, indirect-prompt-injection, + # system-and-capability-discovery, credential-access, sensitive-data-collection, + # privilege-escalation, malicious-execution, private-network-target, + # destructive-or-resource-abuse, tool-abuse, poisoning-or-persistence, and + # `data-exfiltration`. Unknown category keys are ignored. + class AIGuardConfidenceThreshold + include BaseGenericModel + + # The global confidence threshold applied to categories without a specific override. + attr_accessor :flagging_global + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'flagging_global' => :'flagging_global' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'flagging_global' => :'Float' + } + 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::AIGuardConfidenceThreshold` 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?(:'flagging_global') + self.flagging_global = attributes[:'flagging_global'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + flagging_global == o.flagging_global && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [flagging_global, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ai_guard_confidence_threshold_override.rb b/lib/datadog_api_client/v2/models/ai_guard_confidence_threshold_override.rb new file mode 100644 index 000000000000..f44a76daa09b --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_guard_confidence_threshold_override.rb @@ -0,0 +1,66 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request-only confidence threshold override. A number sets the threshold + # for every threat category; an object supplies a global threshold and + # optional per-category overrides. Omit this field to use the stored + # sensitivity policy. This field is not returned in evaluation responses. + module AIGuardConfidenceThresholdOverride + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'Float', + :'AIGuardConfidenceThreshold' + ] + end + # Builds the object + # @param data [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) + end + end + end + end +end diff --git a/lib/datadog_api_client/v2/models/ai_guard_content_part.rb b/lib/datadog_api_client/v2/models/ai_guard_content_part.rb new file mode 100644 index 000000000000..ecc7c90ba8ab --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_guard_content_part.rb @@ -0,0 +1,146 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # One part of multipart message content, following the OpenAI content part + # format. For user, system, developer, and tool messages, a text part must + # include non-empty `text`, and an image part must include `image_url` with + # a non-empty `url`. These content-part checks do not apply to assistant messages. + class AIGuardContentPart + include BaseGenericModel + + # An image referenced by URL in a message content part. + attr_accessor :image_url + + # The text content, required and non-empty when `type` is `text` in a user, system, developer, or tool message. + attr_accessor :text + + # The type of the content part. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'image_url' => :'image_url', + :'text' => :'text', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'image_url' => :'AIGuardImageURL', + :'text' => :'String', + :'type' => :'AIGuardContentPartType' + } + 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::AIGuardContentPart` 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?(:'image_url') + self.image_url = attributes[:'image_url'] + end + + if attributes.key?(:'text') + self.text = attributes[:'text'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + image_url == o.image_url && + text == o.text && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [image_url, text, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ai_guard_content_part_type.rb b/lib/datadog_api_client/v2/models/ai_guard_content_part_type.rb new file mode 100644 index 000000000000..18ec9800c0a9 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_guard_content_part_type.rb @@ -0,0 +1,27 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The type of the content part. + class AIGuardContentPartType + include BaseEnumModel + + TEXT = "text".freeze + IMAGE_URL = "image_url".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/ai_guard_evaluate_attributes_response.rb b/lib/datadog_api_client/v2/models/ai_guard_evaluate_attributes_response.rb new file mode 100644 index 000000000000..b932e7dfe0bd --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_guard_evaluate_attributes_response.rb @@ -0,0 +1,264 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The evaluation result with the recommended action and detected threat information. + class AIGuardEvaluateAttributesResponse + include BaseGenericModel + + # The recommended action for the evaluated conversation. + attr_reader :action + + # The global threat probability, between `0` and `1`. Included only when computed. + attr_accessor :global_prob + + # Whether blocking is enabled for the organization. + attr_reader :is_blocking_enabled + + # The explanation for the recommended action, for logging rather than user-facing display. + attr_reader :reason + + # The redacted replacements computed for the request. Included only when redaction applies. + attr_accessor :redaction_replacements + + # The Supply Chain Firewall verdict for the version-pinned install packages + # found in the request. Evaluation requires Supply Chain Firewall to be enabled + # for the organization and the caller to have the `appsec_vm_read` permission. + # Without that permission, Supply Chain Firewall evaluation is skipped; the + # AI Guard evaluation request itself is not rejected. Findings are omitted + # when Supply Chain Firewall does not produce a result. + # The recommended action combines the package outcomes. + # Confirmation support is inferred from the evaluator profile, not from a + # separate confirmation-capability flag. By default, a non-empty + # `meta.coding_agent` selects the coding-agent profile, which assumes the caller + # can ask for confirmation and retains WARN in `recommended_action`. + # Omitting `meta.coding_agent` or setting it to an empty string selects the + # default profile, which assumes the caller cannot ask for confirmation and + # returns ALLOW instead of WARN in `recommended_action`. Package outcomes + # still retain WARN, and BLOCK is never changed to ALLOW by this rule. + attr_accessor :scfw_findings + + # The sensitive data findings from the Sensitive Data Scanner. Included only when findings exist. + attr_accessor :sds_findings + + # The detection confidence for each threat tag, between `0` and `1`. May be null when the evaluation does not produce per-category scores. + attr_accessor :tag_probs + + # The threat tags detected in the conversation. + attr_reader :tags + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'action' => :'action', + :'global_prob' => :'global_prob', + :'is_blocking_enabled' => :'is_blocking_enabled', + :'reason' => :'reason', + :'redaction_replacements' => :'redaction_replacements', + :'scfw_findings' => :'scfw_findings', + :'sds_findings' => :'sds_findings', + :'tag_probs' => :'tag_probs', + :'tags' => :'tags' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'action' => :'AIGuardAction', + :'global_prob' => :'Float', + :'is_blocking_enabled' => :'Boolean', + :'reason' => :'String', + :'redaction_replacements' => :'Array', + :'scfw_findings' => :'AIGuardScfwFindings', + :'sds_findings' => :'Array', + :'tag_probs' => :'Hash', + :'tags' => :'Array' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'tag_probs', + ]) + 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::AIGuardEvaluateAttributesResponse` 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?(:'action') + self.action = attributes[:'action'] + end + + if attributes.key?(:'global_prob') + self.global_prob = attributes[:'global_prob'] + end + + if attributes.key?(:'is_blocking_enabled') + self.is_blocking_enabled = attributes[:'is_blocking_enabled'] + end + + if attributes.key?(:'reason') + self.reason = attributes[:'reason'] + end + + if attributes.key?(:'redaction_replacements') + if (value = attributes[:'redaction_replacements']).is_a?(Array) + self.redaction_replacements = value + end + end + + if attributes.key?(:'scfw_findings') + self.scfw_findings = attributes[:'scfw_findings'] + end + + if attributes.key?(:'sds_findings') + if (value = attributes[:'sds_findings']).is_a?(Array) + self.sds_findings = value + end + end + + if attributes.key?(:'tag_probs') + self.tag_probs = attributes[:'tag_probs'] + end + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @action.nil? + return false if @is_blocking_enabled.nil? + return false if @reason.nil? + return false if @tags.nil? + true + end + + # Custom attribute writer method with validation + # @param action [Object] Object to be assigned + # @!visibility private + def action=(action) + if action.nil? + fail ArgumentError, 'invalid value for "action", action cannot be nil.' + end + @action = action + end + + # Custom attribute writer method with validation + # @param is_blocking_enabled [Object] Object to be assigned + # @!visibility private + def is_blocking_enabled=(is_blocking_enabled) + if is_blocking_enabled.nil? + fail ArgumentError, 'invalid value for "is_blocking_enabled", is_blocking_enabled cannot be nil.' + end + @is_blocking_enabled = is_blocking_enabled + end + + # Custom attribute writer method with validation + # @param reason [Object] Object to be assigned + # @!visibility private + def reason=(reason) + if reason.nil? + fail ArgumentError, 'invalid value for "reason", reason cannot be nil.' + end + @reason = reason + end + + # Custom attribute writer method with validation + # @param tags [Object] Object to be assigned + # @!visibility private + def tags=(tags) + if tags.nil? + fail ArgumentError, 'invalid value for "tags", tags cannot be nil.' + end + @tags = tags + 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 && + action == o.action && + global_prob == o.global_prob && + is_blocking_enabled == o.is_blocking_enabled && + reason == o.reason && + redaction_replacements == o.redaction_replacements && + scfw_findings == o.scfw_findings && + sds_findings == o.sds_findings && + tag_probs == o.tag_probs && + tags == o.tags && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [action, global_prob, is_blocking_enabled, reason, redaction_replacements, scfw_findings, sds_findings, tag_probs, tags, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ai_guard_evaluate_data_response.rb b/lib/datadog_api_client/v2/models/ai_guard_evaluate_data_response.rb new file mode 100644 index 000000000000..aeec8444efa5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_guard_evaluate_data_response.rb @@ -0,0 +1,166 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The JSON:API evaluation resource. + class AIGuardEvaluateDataResponse + include BaseGenericModel + + # The evaluation result with the recommended action and detected threat information. + attr_reader :attributes + + # The unique identifier of the evaluation. + attr_reader :id + + # The JSON:API resource type for AI Guard evaluation requests and responses. + # Its value is `evaluations` for the action endpoint `/api/v2/ai-guard/evaluate`. + 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' => :'AIGuardEvaluateAttributesResponse', + :'id' => :'String', + :'type' => :'AIGuardEvaluationType' + } + 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::AIGuardEvaluateDataResponse` 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_guard_evaluate_request.rb b/lib/datadog_api_client/v2/models/ai_guard_evaluate_request.rb new file mode 100644 index 000000000000..400a55a3338d --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_guard_evaluate_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The request to evaluate a conversation for security threats. + class AIGuardEvaluateRequest + include BaseGenericModel + + # The JSON:API request envelope for an AI Guard evaluation. + 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' => :'AIGuardEvaluateRequestData' + } + 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::AIGuardEvaluateRequest` 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_guard_evaluate_request_data.rb b/lib/datadog_api_client/v2/models/ai_guard_evaluate_request_data.rb new file mode 100644 index 000000000000..0fa54f9a7152 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_guard_evaluate_request_data.rb @@ -0,0 +1,145 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The JSON:API request envelope for an AI Guard evaluation. + class AIGuardEvaluateRequestData + include BaseGenericModel + + # The conversation to evaluate and its metadata. + attr_reader :attributes + + # The JSON:API resource type for AI Guard evaluation requests and responses. + # Its value is `evaluations` for the action endpoint `/api/v2/ai-guard/evaluate`. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'AIGuardEvaluateRequestDataAttributes', + :'type' => :'AIGuardEvaluationType' + } + 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::AIGuardEvaluateRequestData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ai_guard_evaluate_request_data_attributes.rb b/lib/datadog_api_client/v2/models/ai_guard_evaluate_request_data_attributes.rb new file mode 100644 index 000000000000..03653571bfb1 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_guard_evaluate_request_data_attributes.rb @@ -0,0 +1,139 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The conversation to evaluate and its metadata. + class AIGuardEvaluateRequestDataAttributes + include BaseGenericModel + + # The messages of the conversation to evaluate, in order. Must contain at least one message. + attr_reader :messages + + # Metadata about the evaluated conversation, used to select the policy and evaluator behavior. + attr_accessor :meta + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'messages' => :'messages', + :'meta' => :'meta' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'messages' => :'Array', + :'meta' => :'AIGuardMeta' + } + 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::AIGuardEvaluateRequestDataAttributes` 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?(:'messages') + if (value = attributes[:'messages']).is_a?(Array) + self.messages = value + end + end + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + 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 @messages.nil? + return false if @messages.length < 1 + true + end + + # Custom attribute writer method with validation + # @param messages [Object] Object to be assigned + # @!visibility private + def messages=(messages) + if messages.nil? + fail ArgumentError, 'invalid value for "messages", messages cannot be nil.' + end + if messages.length < 1 + fail ArgumentError, 'invalid value for "messages", number of items must be greater than or equal to 1.' + end + @messages = messages + 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 && + messages == o.messages && + meta == o.meta && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [messages, meta, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ai_guard_evaluate_response.rb b/lib/datadog_api_client/v2/models/ai_guard_evaluate_response.rb new file mode 100644 index 000000000000..b07370d23f0b --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_guard_evaluate_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 + # The response containing the evaluation result. + class AIGuardEvaluateResponse + include BaseGenericModel + + # The JSON:API evaluation resource. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'AIGuardEvaluateDataResponse' + } + 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::AIGuardEvaluateResponse` 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_guard_evaluation_type.rb b/lib/datadog_api_client/v2/models/ai_guard_evaluation_type.rb new file mode 100644 index 000000000000..c093232798f2 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_guard_evaluation_type.rb @@ -0,0 +1,27 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The JSON:API resource type for AI Guard evaluation requests and responses. + # Its value is `evaluations` for the action endpoint `/api/v2/ai-guard/evaluate`. + class AIGuardEvaluationType + include BaseEnumModel + + EVALUATIONS = "evaluations".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/ai_guard_image_url.rb b/lib/datadog_api_client/v2/models/ai_guard_image_url.rb new file mode 100644 index 000000000000..ac830e157d30 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_guard_image_url.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 + # An image referenced by URL in a message content part. + class AIGuardImageURL + include BaseGenericModel + + # The image URL or a data URI with an `image/png`, `image/jpeg`, `image/gif`, or `image/webp` MIME type. + attr_reader :url + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'url' => :'url' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'url' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AIGuardImageURL` 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?(:'url') + self.url = attributes[:'url'] + 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 @url.nil? + true + end + + # Custom attribute writer method with validation + # @param url [Object] Object to be assigned + # @!visibility private + def url=(url) + if url.nil? + fail ArgumentError, 'invalid value for "url", url cannot be nil.' + end + @url = url + 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 && + url == o.url && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [url, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ai_guard_message.rb b/lib/datadog_api_client/v2/models/ai_guard_message.rb new file mode 100644 index 000000000000..d1147544a93a --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_guard_message.rb @@ -0,0 +1,161 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A message in the conversation. Content is required for user, system, + # developer, and tool messages, but may be omitted for assistant messages. + # For those non-assistant roles, a plain content string may be empty, but a + # multipart content array must contain at least one valid content part. + # Only assistant messages may contain tool calls, and tool call entries must + # not be null. Tool messages must include a non-empty `tool_call_id`; other + # message roles must not include a non-empty `tool_call_id`. + class AIGuardMessage + include BaseGenericModel + + # The content of a message, either a plain string or a list of OpenAI-style content parts. + attr_accessor :content + + # The role of the message author in the conversation. + attr_reader :role + + # The identifier of the tool call this message responds to, present on tool result messages. + attr_accessor :tool_call_id + + # The tool calls emitted by the assistant, present on assistant messages that call tools. + attr_accessor :tool_calls + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'content' => :'content', + :'role' => :'role', + :'tool_call_id' => :'tool_call_id', + :'tool_calls' => :'tool_calls' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'content' => :'AIGuardMessageContent', + :'role' => :'AIGuardMessageRole', + :'tool_call_id' => :'String', + :'tool_calls' => :'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::AIGuardMessage` 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?(:'content') + self.content = attributes[:'content'] + end + + if attributes.key?(:'role') + self.role = attributes[:'role'] + end + + if attributes.key?(:'tool_call_id') + self.tool_call_id = attributes[:'tool_call_id'] + end + + if attributes.key?(:'tool_calls') + if (value = attributes[:'tool_calls']).is_a?(Array) + self.tool_calls = 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 @role.nil? + true + end + + # Custom attribute writer method with validation + # @param role [Object] Object to be assigned + # @!visibility private + def role=(role) + if role.nil? + fail ArgumentError, 'invalid value for "role", role cannot be nil.' + end + @role = role + 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 && + content == o.content && + role == o.role && + tool_call_id == o.tool_call_id && + tool_calls == o.tool_calls && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [content, role, tool_call_id, tool_calls, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ai_guard_message_content.rb b/lib/datadog_api_client/v2/models/ai_guard_message_content.rb new file mode 100644 index 000000000000..47a82ba46df3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_guard_message_content.rb @@ -0,0 +1,63 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The content of a message, either a plain string or a list of OpenAI-style content parts. + module AIGuardMessageContent + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'String', + :'Array' + ] + end + # Builds the object + # @param data [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) + end + end + end + end +end diff --git a/lib/datadog_api_client/v2/models/ai_guard_message_role.rb b/lib/datadog_api_client/v2/models/ai_guard_message_role.rb new file mode 100644 index 000000000000..92bca2041d5c --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_guard_message_role.rb @@ -0,0 +1,30 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The role of the message author in the conversation. + class AIGuardMessageRole + include BaseEnumModel + + USER = "user".freeze + ASSISTANT = "assistant".freeze + SYSTEM = "system".freeze + DEVELOPER = "developer".freeze + TOOL = "tool".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/ai_guard_meta.rb b/lib/datadog_api_client/v2/models/ai_guard_meta.rb new file mode 100644 index 000000000000..6aa7234fbea7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_guard_meta.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 + # Metadata about the evaluated conversation, used to select the policy and evaluator behavior. + class AIGuardMeta + include BaseGenericModel + + # The coding agent that produced the conversation. By default, a non-empty + # value selects the coding-agent evaluator profile, while an omitted or empty + # value selects the default profile. Known identifiers include `claude-code`, + # `codex`, `cursor`, and `github-copilot`; other identifiers are accepted. + # The coding-agent profile assumes the caller can ask the user to confirm + # Supply Chain Firewall warnings; the default profile assumes it cannot. + attr_accessor :coding_agent + + # Request-only confidence threshold override. A number sets the threshold + # for every threat category; an object supplies a global threshold and + # optional per-category overrides. Omit this field to use the stored + # sensitivity policy. This field is not returned in evaluation responses. + attr_accessor :confidence_threshold + + # The environment the conversation belongs to. + attr_accessor :env + + # Whether to run the Sensitive Data Scanner for this request, overriding the stored policy. + attr_accessor :is_sds_enabled_override + + # The name of the service the conversation belongs to. + attr_accessor :service + + # A non-empty map replaces stored tool policies for this request only, + # keyed by tool name. Any called tool not present resolves to EVALUATE. + # Only takes effect when tool policies are enabled for the organization. + attr_accessor :tool_policies + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'coding_agent' => :'coding_agent', + :'confidence_threshold' => :'confidence_threshold', + :'env' => :'env', + :'is_sds_enabled_override' => :'is_sds_enabled_override', + :'service' => :'service', + :'tool_policies' => :'tool_policies' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'coding_agent' => :'String', + :'confidence_threshold' => :'AIGuardConfidenceThresholdOverride', + :'env' => :'String', + :'is_sds_enabled_override' => :'Boolean', + :'service' => :'String', + :'tool_policies' => :'Hash' + } + 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::AIGuardMeta` 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?(:'coding_agent') + self.coding_agent = attributes[:'coding_agent'] + end + + if attributes.key?(:'confidence_threshold') + self.confidence_threshold = attributes[:'confidence_threshold'] + end + + if attributes.key?(:'env') + self.env = attributes[:'env'] + end + + if attributes.key?(:'is_sds_enabled_override') + self.is_sds_enabled_override = attributes[:'is_sds_enabled_override'] + end + + if attributes.key?(:'service') + self.service = attributes[:'service'] + end + + if attributes.key?(:'tool_policies') + self.tool_policies = attributes[:'tool_policies'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + coding_agent == o.coding_agent && + confidence_threshold == o.confidence_threshold && + env == o.env && + is_sds_enabled_override == o.is_sds_enabled_override && + service == o.service && + tool_policies == o.tool_policies && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [coding_agent, confidence_threshold, env, is_sds_enabled_override, service, tool_policies, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ai_guard_redaction_replacement.rb b/lib/datadog_api_client/v2/models/ai_guard_redaction_replacement.rb new file mode 100644 index 000000000000..8ce2f4f4116c --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_guard_redaction_replacement.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The fully redacted content for one path in the request. + class AIGuardRedactionReplacement + include BaseGenericModel + + # The path of the redacted content relative to the request attributes. + attr_reader :path + + # The redacted replacement content. + attr_reader :replacement + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'path' => :'path', + :'replacement' => :'replacement' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'path' => :'String', + :'replacement' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AIGuardRedactionReplacement` 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?(:'path') + self.path = attributes[:'path'] + end + + if attributes.key?(:'replacement') + self.replacement = attributes[:'replacement'] + 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 @path.nil? + return false if @replacement.nil? + true + end + + # Custom attribute writer method with validation + # @param path [Object] Object to be assigned + # @!visibility private + def path=(path) + if path.nil? + fail ArgumentError, 'invalid value for "path", path cannot be nil.' + end + @path = path + end + + # Custom attribute writer method with validation + # @param replacement [Object] Object to be assigned + # @!visibility private + def replacement=(replacement) + if replacement.nil? + fail ArgumentError, 'invalid value for "replacement", replacement cannot be nil.' + end + @replacement = replacement + 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 && + path == o.path && + replacement == o.replacement && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [path, replacement, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ai_guard_scfw_findings.rb b/lib/datadog_api_client/v2/models/ai_guard_scfw_findings.rb new file mode 100644 index 000000000000..ead392fc66a8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_guard_scfw_findings.rb @@ -0,0 +1,149 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The Supply Chain Firewall verdict for the version-pinned install packages + # found in the request. Evaluation requires Supply Chain Firewall to be enabled + # for the organization and the caller to have the `appsec_vm_read` permission. + # Without that permission, Supply Chain Firewall evaluation is skipped; the + # AI Guard evaluation request itself is not rejected. Findings are omitted + # when Supply Chain Firewall does not produce a result. + # The recommended action combines the package outcomes. + # Confirmation support is inferred from the evaluator profile, not from a + # separate confirmation-capability flag. By default, a non-empty + # `meta.coding_agent` selects the coding-agent profile, which assumes the caller + # can ask for confirmation and retains WARN in `recommended_action`. + # Omitting `meta.coding_agent` or setting it to an empty string selects the + # default profile, which assumes the caller cannot ask for confirmation and + # returns ALLOW instead of WARN in `recommended_action`. Package outcomes + # still retain WARN, and BLOCK is never changed to ALLOW by this rule. + class AIGuardScfwFindings + include BaseGenericModel + + # The packages the firewall evaluated, `ALLOW` ones included. + attr_accessor :packages + + # The Supply Chain Firewall outcome for a package, a matched rule, or the whole request. + attr_reader :recommended_action + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'packages' => :'packages', + :'recommended_action' => :'recommended_action' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'packages' => :'Array', + :'recommended_action' => :'AIGuardScfwOutcome' + } + 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::AIGuardScfwFindings` 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?(:'packages') + if (value = attributes[:'packages']).is_a?(Array) + self.packages = value + end + end + + if attributes.key?(:'recommended_action') + self.recommended_action = attributes[:'recommended_action'] + 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 @recommended_action.nil? + true + end + + # Custom attribute writer method with validation + # @param recommended_action [Object] Object to be assigned + # @!visibility private + def recommended_action=(recommended_action) + if recommended_action.nil? + fail ArgumentError, 'invalid value for "recommended_action", recommended_action cannot be nil.' + end + @recommended_action = recommended_action + 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 && + packages == o.packages && + recommended_action == o.recommended_action && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [packages, recommended_action, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ai_guard_scfw_matched_rule.rb b/lib/datadog_api_client/v2/models/ai_guard_scfw_matched_rule.rb new file mode 100644 index 000000000000..f17390ed7c82 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_guard_scfw_matched_rule.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # One rule the Supply Chain Firewall matched on a package, with the outcome the rule reached. + class AIGuardScfwMatchedRule + include BaseGenericModel + + # The Supply Chain Firewall outcome for a package, a matched rule, or the whole request. + attr_reader :outcome + + # The rule text the firewall reported, or the policy type when no text was reported. + attr_reader :rule + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'outcome' => :'outcome', + :'rule' => :'rule' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'outcome' => :'AIGuardScfwOutcome', + :'rule' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AIGuardScfwMatchedRule` 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?(:'outcome') + self.outcome = attributes[:'outcome'] + end + + if attributes.key?(:'rule') + self.rule = attributes[:'rule'] + 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 @outcome.nil? + return false if @rule.nil? + true + end + + # Custom attribute writer method with validation + # @param outcome [Object] Object to be assigned + # @!visibility private + def outcome=(outcome) + if outcome.nil? + fail ArgumentError, 'invalid value for "outcome", outcome cannot be nil.' + end + @outcome = outcome + end + + # Custom attribute writer method with validation + # @param rule [Object] Object to be assigned + # @!visibility private + def rule=(rule) + if rule.nil? + fail ArgumentError, 'invalid value for "rule", rule cannot be nil.' + end + @rule = rule + 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 && + outcome == o.outcome && + rule == o.rule && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [outcome, rule, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ai_guard_scfw_outcome.rb b/lib/datadog_api_client/v2/models/ai_guard_scfw_outcome.rb new file mode 100644 index 000000000000..49b362af1bb0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_guard_scfw_outcome.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 + # The Supply Chain Firewall outcome for a package, a matched rule, or the whole request. + class AIGuardScfwOutcome + include BaseEnumModel + + ALLOW = "ALLOW".freeze + WARN = "WARN".freeze + BLOCK = "BLOCK".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/ai_guard_scfw_package_finding.rb b/lib/datadog_api_client/v2/models/ai_guard_scfw_package_finding.rb new file mode 100644 index 000000000000..6082168e6c0e --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_guard_scfw_package_finding.rb @@ -0,0 +1,198 @@ +=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 package the Supply Chain Firewall evaluated, with the outcome and every matched rule. + class AIGuardScfwPackageFinding + include BaseGenericModel + + # The package ecosystem the firewall evaluated, such as `PyPI`, `npm`, or `crates.io`. + attr_reader :ecosystem + + # Every rule the firewall matched on the package. + attr_accessor :matched_rules + + # The name of the package. + attr_reader :name + + # The Supply Chain Firewall outcome for a package, a matched rule, or the whole request. + attr_reader :outcome + + # The version of the package. + attr_reader :version + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'ecosystem' => :'ecosystem', + :'matched_rules' => :'matched_rules', + :'name' => :'name', + :'outcome' => :'outcome', + :'version' => :'version' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'ecosystem' => :'String', + :'matched_rules' => :'Array', + :'name' => :'String', + :'outcome' => :'AIGuardScfwOutcome', + :'version' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AIGuardScfwPackageFinding` 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?(:'ecosystem') + self.ecosystem = attributes[:'ecosystem'] + end + + if attributes.key?(:'matched_rules') + if (value = attributes[:'matched_rules']).is_a?(Array) + self.matched_rules = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'outcome') + self.outcome = attributes[:'outcome'] + end + + if attributes.key?(:'version') + self.version = attributes[:'version'] + 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 @ecosystem.nil? + return false if @name.nil? + return false if @outcome.nil? + return false if @version.nil? + true + end + + # Custom attribute writer method with validation + # @param ecosystem [Object] Object to be assigned + # @!visibility private + def ecosystem=(ecosystem) + if ecosystem.nil? + fail ArgumentError, 'invalid value for "ecosystem", ecosystem cannot be nil.' + end + @ecosystem = ecosystem + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + end + + # Custom attribute writer method with validation + # @param outcome [Object] Object to be assigned + # @!visibility private + def outcome=(outcome) + if outcome.nil? + fail ArgumentError, 'invalid value for "outcome", outcome cannot be nil.' + end + @outcome = outcome + end + + # Custom attribute writer method with validation + # @param version [Object] Object to be assigned + # @!visibility private + def version=(version) + if version.nil? + fail ArgumentError, 'invalid value for "version", version cannot be nil.' + end + @version = version + 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 && + ecosystem == o.ecosystem && + matched_rules == o.matched_rules && + name == o.name && + outcome == o.outcome && + version == o.version && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [ecosystem, matched_rules, name, outcome, version, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ai_guard_sds_finding.rb b/lib/datadog_api_client/v2/models/ai_guard_sds_finding.rb new file mode 100644 index 000000000000..d1b69fe68fe7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_guard_sds_finding.rb @@ -0,0 +1,186 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A sensitive data finding from the Sensitive Data Scanner. + class AIGuardSdsFinding + include BaseGenericModel + + # The category of the sensitive data found. + attr_reader :category + + # The location of a sensitive data match within the request. + attr_reader :location + + # The display name of the SDS rule that matched. + attr_reader :rule_display_name + + # The tag of the SDS rule that matched. + attr_reader :rule_tag + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'category' => :'category', + :'location' => :'location', + :'rule_display_name' => :'rule_display_name', + :'rule_tag' => :'rule_tag' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'category' => :'String', + :'location' => :'AIGuardSdsFindingLocation', + :'rule_display_name' => :'String', + :'rule_tag' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AIGuardSdsFinding` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'location') + self.location = attributes[:'location'] + end + + if attributes.key?(:'rule_display_name') + self.rule_display_name = attributes[:'rule_display_name'] + end + + if attributes.key?(:'rule_tag') + self.rule_tag = attributes[:'rule_tag'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @category.nil? + return false if @location.nil? + return false if @rule_display_name.nil? + return false if @rule_tag.nil? + true + end + + # Custom attribute writer method with validation + # @param category [Object] Object to be assigned + # @!visibility private + def category=(category) + if category.nil? + fail ArgumentError, 'invalid value for "category", category cannot be nil.' + end + @category = category + end + + # Custom attribute writer method with validation + # @param location [Object] Object to be assigned + # @!visibility private + def location=(location) + if location.nil? + fail ArgumentError, 'invalid value for "location", location cannot be nil.' + end + @location = location + end + + # Custom attribute writer method with validation + # @param rule_display_name [Object] Object to be assigned + # @!visibility private + def rule_display_name=(rule_display_name) + if rule_display_name.nil? + fail ArgumentError, 'invalid value for "rule_display_name", rule_display_name cannot be nil.' + end + @rule_display_name = rule_display_name + end + + # Custom attribute writer method with validation + # @param rule_tag [Object] Object to be assigned + # @!visibility private + def rule_tag=(rule_tag) + if rule_tag.nil? + fail ArgumentError, 'invalid value for "rule_tag", rule_tag cannot be nil.' + end + @rule_tag = rule_tag + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + category == o.category && + location == o.location && + rule_display_name == o.rule_display_name && + rule_tag == o.rule_tag && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [category, location, rule_display_name, rule_tag, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ai_guard_sds_finding_location.rb b/lib/datadog_api_client/v2/models/ai_guard_sds_finding_location.rb new file mode 100644 index 000000000000..d98c86ef4076 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_guard_sds_finding_location.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 + # The location of a sensitive data match within the request. + class AIGuardSdsFindingLocation + include BaseGenericModel + + # The exclusive end index of the match within the located content. + attr_reader :end_index_exclusive + + # The path of the match relative to the request attributes. + attr_reader :path + + # The start index of the match within the located content. + attr_reader :start_index + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'end_index_exclusive' => :'end_index_exclusive', + :'path' => :'path', + :'start_index' => :'start_index' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'end_index_exclusive' => :'Integer', + :'path' => :'String', + :'start_index' => :'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::AIGuardSdsFindingLocation` 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?(:'end_index_exclusive') + self.end_index_exclusive = attributes[:'end_index_exclusive'] + end + + if attributes.key?(:'path') + self.path = attributes[:'path'] + end + + if attributes.key?(:'start_index') + self.start_index = attributes[:'start_index'] + 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 @end_index_exclusive.nil? + return false if @path.nil? + return false if @start_index.nil? + true + end + + # Custom attribute writer method with validation + # @param end_index_exclusive [Object] Object to be assigned + # @!visibility private + def end_index_exclusive=(end_index_exclusive) + if end_index_exclusive.nil? + fail ArgumentError, 'invalid value for "end_index_exclusive", end_index_exclusive cannot be nil.' + end + @end_index_exclusive = end_index_exclusive + end + + # Custom attribute writer method with validation + # @param path [Object] Object to be assigned + # @!visibility private + def path=(path) + if path.nil? + fail ArgumentError, 'invalid value for "path", path cannot be nil.' + end + @path = path + end + + # Custom attribute writer method with validation + # @param start_index [Object] Object to be assigned + # @!visibility private + def start_index=(start_index) + if start_index.nil? + fail ArgumentError, 'invalid value for "start_index", start_index cannot be nil.' + end + @start_index = start_index + 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 && + end_index_exclusive == o.end_index_exclusive && + path == o.path && + start_index == o.start_index && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [end_index_exclusive, path, start_index, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ai_guard_tool_call.rb b/lib/datadog_api_client/v2/models/ai_guard_tool_call.rb new file mode 100644 index 000000000000..2e2130e51609 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_guard_tool_call.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A tool call emitted by the assistant. + class AIGuardToolCall + include BaseGenericModel + + # The function invoked by a tool call. + attr_reader :function + + # The identifier of the tool call. + attr_reader :id + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'function' => :'function', + :'id' => :'id' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'function' => :'AIGuardToolCallFunction', + :'id' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AIGuardToolCall` 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?(:'function') + self.function = attributes[:'function'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + 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 @function.nil? + return false if @id.nil? + true + end + + # Custom attribute writer method with validation + # @param function [Object] Object to be assigned + # @!visibility private + def function=(function) + if function.nil? + fail ArgumentError, 'invalid value for "function", function cannot be nil.' + end + @function = function + 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 + + # 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 && + function == o.function && + id == o.id && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [function, id, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ai_guard_tool_call_function.rb b/lib/datadog_api_client/v2/models/ai_guard_tool_call_function.rb new file mode 100644 index 000000000000..6c8a166d0685 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_guard_tool_call_function.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The function invoked by a tool call. + class AIGuardToolCallFunction + include BaseGenericModel + + # The arguments of the function call, serialized as a JSON string. + attr_reader :arguments + + # The name of the function to call. + attr_reader :name + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'arguments' => :'arguments', + :'name' => :'name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'arguments' => :'String', + :'name' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AIGuardToolCallFunction` 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?(:'arguments') + self.arguments = attributes[:'arguments'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + 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 @arguments.nil? + return false if @name.nil? + true + end + + # Custom attribute writer method with validation + # @param arguments [Object] Object to be assigned + # @!visibility private + def arguments=(arguments) + if arguments.nil? + fail ArgumentError, 'invalid value for "arguments", arguments cannot be nil.' + end + @arguments = arguments + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + arguments == o.arguments && + name == o.name && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [arguments, name, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ai_guard_tool_policy_action.rb b/lib/datadog_api_client/v2/models/ai_guard_tool_policy_action.rb new file mode 100644 index 000000000000..9d39d158643e --- /dev/null +++ b/lib/datadog_api_client/v2/models/ai_guard_tool_policy_action.rb @@ -0,0 +1,31 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The policy action for a tool named by the property. Tool policies override + # the recommendation after evaluation; they do not skip evaluation. + # Any BLOCK takes precedence over PASS and EVALUATE. The Supply Chain Firewall + # is applied afterward and can still return DENY. + class AIGuardToolPolicyAction + include BaseEnumModel + + PASS = "PASS".freeze + BLOCK = "BLOCK".freeze + EVALUATE = "EVALUATE".freeze + end +end