diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 134a7ef0ee..b0d9d61d13 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -67501,6 +67501,569 @@ components: required: - data type: object + OwnershipEvidenceAttributes: + description: The attributes of an ownership evidence response. + properties: + evidence_versions: + $ref: "#/components/schemas/OwnershipEvidenceVersions" + required: + - evidence_versions + type: object + OwnershipEvidenceData: + description: The data wrapper for an ownership evidence response. + properties: + attributes: + $ref: "#/components/schemas/OwnershipEvidenceAttributes" + id: + description: The identifier of the resource the evidence applies to. + example: test-resource + type: string + type: + $ref: "#/components/schemas/OwnershipEvidenceType" + required: + - id + - type + - attributes + type: object + OwnershipEvidenceResponse: + description: The response returned when retrieving the evidence backing an ownership inference for an owner type. + properties: + data: + $ref: "#/components/schemas/OwnershipEvidenceData" + required: + - data + type: object + OwnershipEvidenceType: + default: ownership_evidence + description: The type of the ownership evidence resource. The value should always be `ownership_evidence`. + enum: + - ownership_evidence + example: ownership_evidence + type: string + x-enum-varnames: + - OWNERSHIP_EVIDENCE + OwnershipEvidenceVersion: + additionalProperties: {} + description: A single evidence version entry describing how an inference was produced. + example: + pipeline_id: p1 + version: v3 + type: object + OwnershipEvidenceVersions: + description: The list of evidence versions associated with an inference. + example: + - pipeline_id: p1 + version: v3 + items: + $ref: "#/components/schemas/OwnershipEvidenceVersion" + nullable: true + type: array + OwnershipFeedbackAction: + description: The feedback action to apply to an inference. + enum: + - confirm + - reject + - correct + - persist + example: confirm + type: string + x-enum-varnames: + - CONFIRM + - REJECT + - CORRECT + - PERSIST + OwnershipFeedbackRequest: + description: The request body for submitting ownership feedback. + properties: + data: + $ref: "#/components/schemas/OwnershipFeedbackRequestData" + required: + - data + type: object + OwnershipFeedbackRequestAttributes: + description: The attributes of an ownership feedback request. + properties: + action: + $ref: "#/components/schemas/OwnershipFeedbackAction" + actor_handle: + description: The handle of the actor submitting the feedback. + example: user@example.com + type: string + actor_type: + description: The type of actor submitting the feedback, for example `user` or `service`. + example: user + type: string + corrected_owner_handle: + description: The corrected owner handle. Required when `action` is `correct`. + example: team-b + nullable: true + type: string + corrected_owner_type: + description: The corrected owner type. Required when `action` is `correct`. + example: team + nullable: true + type: string + inference_checksum: + description: The checksum of the inference being acted upon. Must match the current inference checksum or the request returns a conflict. + example: abc123 + type: string + reason: + description: An optional free-form reason explaining the feedback. + example: Confirmed by team lead. + nullable: true + type: string + required: + - action + - actor_handle + - actor_type + - inference_checksum + type: object + OwnershipFeedbackRequestData: + description: The data wrapper for an ownership feedback request. + properties: + attributes: + $ref: "#/components/schemas/OwnershipFeedbackRequestAttributes" + type: + $ref: "#/components/schemas/OwnershipFeedbackType" + required: + - type + - attributes + type: object + OwnershipFeedbackResponse: + description: The response returned after applying ownership feedback to an inference. + properties: + data: + $ref: "#/components/schemas/OwnershipFeedbackResultData" + required: + - data + type: object + OwnershipFeedbackResultAttributes: + description: The attributes of an ownership feedback result. + properties: + action: + $ref: "#/components/schemas/OwnershipFeedbackAction" + checksum: + description: The checksum of the inference after the feedback was applied. + example: abc123 + type: string + new_status: + $ref: "#/components/schemas/OwnershipInferenceStatus" + owner_type: + $ref: "#/components/schemas/OwnershipOwnerType" + previous_status: + $ref: "#/components/schemas/OwnershipInferenceStatus" + primary_contact_ref: + description: The primary contact reference for the inferred owner after the feedback was applied, formatted as `ref:handle/`. + example: ref:handle/team-a + nullable: true + type: string + updated_at: + description: The time when the inference was updated by the feedback. + example: "2026-01-15T10:00:00Z" + format: date-time + type: string + required: + - action + - previous_status + - new_status + - owner_type + - checksum + - updated_at + type: object + OwnershipFeedbackResultData: + description: The data wrapper for an ownership feedback result response. + properties: + attributes: + $ref: "#/components/schemas/OwnershipFeedbackResultAttributes" + id: + description: The identifier of the resource that the feedback was applied to. + example: res-1 + type: string + type: + $ref: "#/components/schemas/OwnershipFeedbackResultType" + required: + - id + - type + - attributes + type: object + OwnershipFeedbackResultType: + default: ownership_feedback_result + description: The type of the ownership feedback result resource. The value should always be `ownership_feedback_result`. + enum: + - ownership_feedback_result + example: ownership_feedback_result + type: string + x-enum-varnames: + - OWNERSHIP_FEEDBACK_RESULT + OwnershipFeedbackType: + default: ownership_feedback + description: The type of the ownership feedback request resource. The value should always be `ownership_feedback`. + enum: + - ownership_feedback + example: ownership_feedback + type: string + x-enum-varnames: + - OWNERSHIP_FEEDBACK + OwnershipHistoryAttributes: + description: The attributes of an ownership history response. + properties: + items: + $ref: "#/components/schemas/OwnershipHistoryItems" + pagination: + $ref: "#/components/schemas/OwnershipHistoryPagination" + required: + - items + - pagination + type: object + OwnershipHistoryData: + description: The data wrapper for an ownership history response. + properties: + attributes: + $ref: "#/components/schemas/OwnershipHistoryAttributes" + id: + description: The resource identifier for which history is returned. + example: res-1 + type: string + type: + $ref: "#/components/schemas/OwnershipHistoryType" + required: + - id + - type + - attributes + type: object + OwnershipHistoryItem: + description: A single ownership inference history entry. + properties: + checksum: + description: A checksum identifying the state of the inference at this point in time. + example: "" + type: string + confidence: + description: The confidence score of the inference, expressed as a numeric string with up to four decimal places. + example: "0.9000" + type: string + created_at: + description: The time this history entry was created. + example: "2026-01-15T10:00:00Z" + format: date-time + type: string + evidence_versions: + $ref: "#/components/schemas/OwnershipEvidenceVersions" + explanation: + description: A human-readable explanation of how the inference was produced. + example: "" + type: string + failed_at: + description: The time when this inference failed, if applicable. + example: "2026-01-15T10:00:00Z" + format: date-time + nullable: true + type: string + failure_reason: + description: The reason why this inference failed, if applicable. + example: missing evidence + nullable: true + type: string + id: + description: The unique identifier of the history entry. + example: 100 + format: int64 + type: integer + owner_type: + $ref: "#/components/schemas/OwnershipOwnerType" + primary_contact_ref: + description: The primary contact reference for the inferred owner, formatted as `ref:handle/`. + example: ref:handle/team-a + nullable: true + type: string + resource_id: + description: The identifier of the resource that the inference applies to. + example: res-1 + type: string + retry_schedule: + description: The scheduled retry time for a failed inference, if applicable. + example: "2026-01-15T11:00:00Z" + format: date-time + nullable: true + type: string + sources: + $ref: "#/components/schemas/OwnershipInferenceSources" + status: + $ref: "#/components/schemas/OwnershipInferenceStatus" + required: + - id + - resource_id + - owner_type + - confidence + - explanation + - evidence_versions + - sources + - checksum + - status + - created_at + type: object + OwnershipHistoryItems: + description: The list of history entries returned for this page. + items: + $ref: "#/components/schemas/OwnershipHistoryItem" + type: array + OwnershipHistoryPagination: + description: Cursor-based pagination metadata for the history response. + properties: + has_more: + description: Whether more history entries are available beyond this page. + example: false + type: boolean + next_cursor: + description: An opaque, base64-encoded cursor token. Pass it as the `cursor` query parameter to retrieve the next page. Absent or `null` when there are no further pages. + example: eyJpZCI6OTh9 + nullable: true + type: string + required: + - has_more + type: object + OwnershipHistoryResponse: + description: The response returned when listing the inference history for a resource. + properties: + data: + $ref: "#/components/schemas/OwnershipHistoryData" + required: + - data + type: object + OwnershipHistoryType: + default: ownership_history + description: The type of the ownership history resource. The value should always be `ownership_history`. + enum: + - ownership_history + example: ownership_history + type: string + x-enum-varnames: + - OWNERSHIP_HISTORY + OwnershipInferenceAttributes: + description: The attributes of a single ownership inference. + properties: + checksum: + description: A checksum that uniquely identifies the current state of the inference. Required when submitting feedback. + example: abc123 + type: string + confidence: + description: The confidence score of the inference, expressed as a numeric string with up to four decimal places. + example: "0.9500" + type: string + created_at: + description: The time when the inference was created. + example: "2026-01-15T10:00:00Z" + format: date-time + type: string + evidence_versions: + $ref: "#/components/schemas/OwnershipEvidenceVersions" + explanation: + description: A human-readable explanation of how the inference was produced. + example: High confidence match + type: string + owner_type: + $ref: "#/components/schemas/OwnershipOwnerType" + primary_contact_ref: + description: The primary contact reference for the inferred owner, formatted as `ref:handle/`. + example: ref:handle/team-a + nullable: true + type: string + sources: + $ref: "#/components/schemas/OwnershipInferenceSources" + status: + $ref: "#/components/schemas/OwnershipInferenceStatus" + updated_at: + description: The time when the inference was last updated. + example: "2026-01-15T10:00:00Z" + format: date-time + type: string + required: + - owner_type + - confidence + - explanation + - evidence_versions + - sources + - status + - checksum + - created_at + - updated_at + type: object + OwnershipInferenceData: + description: The data wrapper for a single ownership inference response. + properties: + attributes: + $ref: "#/components/schemas/OwnershipInferenceAttributes" + id: + description: The identifier of the inference, formatted as `resource_id:owner_type`. + example: test-resource:team + type: string + type: + $ref: "#/components/schemas/OwnershipInferenceType" + required: + - id + - type + - attributes + type: object + OwnershipInferenceItem: + description: A single ownership inference, scoped to a specific owner type. + properties: + checksum: + description: A checksum that uniquely identifies the current state of the inference. Required when submitting feedback. + example: abc123 + type: string + confidence: + description: The confidence score of the inference, expressed as a numeric string with up to four decimal places. + example: "0.9500" + type: string + created_at: + description: The time when the inference was created. + example: "2026-01-15T10:00:00Z" + format: date-time + type: string + evidence_versions: + $ref: "#/components/schemas/OwnershipEvidenceVersions" + explanation: + description: A human-readable explanation of how the inference was produced. + example: High confidence match + type: string + id: + description: The identifier of the inference, formatted as `resource_id:owner_type`. + example: test-resource:team + type: string + owner_type: + $ref: "#/components/schemas/OwnershipOwnerType" + primary_contact_ref: + description: The primary contact reference for the inferred owner, formatted as `ref:handle/`. + example: ref:handle/team-a + nullable: true + type: string + sources: + $ref: "#/components/schemas/OwnershipInferenceSources" + status: + $ref: "#/components/schemas/OwnershipInferenceStatus" + updated_at: + description: The time when the inference was last updated. + example: "2026-01-15T10:00:00Z" + format: date-time + type: string + required: + - id + - owner_type + - confidence + - explanation + - evidence_versions + - sources + - status + - checksum + - created_at + - updated_at + type: object + OwnershipInferenceItems: + description: The list of inferences for a resource, with one inference per owner type. + items: + $ref: "#/components/schemas/OwnershipInferenceItem" + type: array + OwnershipInferenceListAttributes: + description: The attributes of the ownership inferences collection response. + properties: + items: + $ref: "#/components/schemas/OwnershipInferenceItems" + required: + - items + type: object + OwnershipInferenceListData: + description: The data wrapper for the ownership inferences collection response. + properties: + attributes: + $ref: "#/components/schemas/OwnershipInferenceListAttributes" + id: + description: The resource identifier associated with the returned inferences. + example: test-resource + type: string + type: + $ref: "#/components/schemas/OwnershipInferencesType" + required: + - id + - type + - attributes + type: object + OwnershipInferenceListResponse: + description: The response returned when listing all current ownership inferences for a resource. + properties: + data: + $ref: "#/components/schemas/OwnershipInferenceListData" + required: + - data + type: object + OwnershipInferenceResponse: + description: The response returned when retrieving a single ownership inference for an owner type. + properties: + data: + $ref: "#/components/schemas/OwnershipInferenceData" + required: + - data + type: object + OwnershipInferenceSource: + additionalProperties: {} + description: A source describing how an inference was derived. + example: + kind: code_owners + type: object + OwnershipInferenceSources: + description: The list of sources backing an ownership inference. Empty when the inference status is not whitelisted to expose sources. + example: + - kind: code_owners + items: + $ref: "#/components/schemas/OwnershipInferenceSource" + type: array + OwnershipInferenceStatus: + description: The lifecycle status of an ownership inference. + enum: + - suggested + - persisted + - overridden + - failed + - unknown + example: suggested + type: string + x-enum-varnames: + - SUGGESTED + - PERSISTED + - OVERRIDDEN + - FAILED + - UNKNOWN + OwnershipInferenceType: + default: ownership_inference + description: The type of the ownership inference resource. The value should always be `ownership_inference`. + enum: + - ownership_inference + example: ownership_inference + type: string + x-enum-varnames: + - OWNERSHIP_INFERENCE + OwnershipInferencesType: + default: ownership_inferences + description: The type of the ownership inferences collection resource. The value should always be `ownership_inferences`. + enum: + - ownership_inferences + example: ownership_inferences + type: string + x-enum-varnames: + - OWNERSHIP_INFERENCES + OwnershipOwnerType: + description: The owner type for an ownership inference. + enum: + - user + - team + - service + - unknown + example: team + type: string + x-enum-varnames: + - USER + - TEAM + - SERVICE + - UNKNOWN PageAnnotationsAttributes: description: Attributes of the annotations on a page. properties: @@ -120436,6 +120999,494 @@ paths: $ref: "#/components/responses/TooManyRequestsResponse" summary: Get all CSM Serverless Agents tags: ["CSM Agents"] + /api/v2/csm/ownership/{resource_id}: + get: + description: Get all current ownership inferences for a resource, one per owner type (`user`, `team`, `service`, `unknown`). + operationId: ListOwnershipInferences + parameters: + - description: The identifier of the resource to retrieve ownership inferences for. + in: path + name: resource_id + required: true + schema: + example: test-resource + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + items: + - checksum: abc123 + confidence: "0.9500" + created_at: "2026-01-15T10:00:00Z" + evidence_versions: + - pipeline_id: p1 + explanation: High confidence match + id: test-resource:team + owner_type: team + primary_contact_ref: ref:handle/team-a + sources: [] + status: suggested + updated_at: "2026-01-15T10:00:00Z" + id: test-resource + type: ownership_inferences + schema: + $ref: "#/components/schemas/OwnershipInferenceListResponse" + 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 + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: List ownership inferences for a resource + tags: ["CSM Ownership"] + x-unstable: |- + **Note**: This endpoint is in Preview and may be subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/csm/ownership/{resource_id}/history: + get: + description: List inference history entries for a resource across all owner types, ordered from most recent to oldest. Uses cursor-based pagination. + operationId: ListOwnershipHistory + parameters: + - description: The identifier of the resource to retrieve inference history for. + in: path + name: resource_id + required: true + schema: + example: res-1 + type: string + - description: An opaque, base64-encoded cursor token returned by a previous call in `pagination.next_cursor`. Omit to fetch the first page. + in: query + name: cursor + required: false + schema: + example: eyJpZCI6OTh9 + type: string + - description: The maximum number of history entries to return per page. + in: query + name: limit + required: false + schema: + default: 25 + example: 25 + format: int32 + maximum: 100 + minimum: 1 + type: integer + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + items: + - checksum: "" + confidence: "0.9000" + created_at: "2026-01-15T10:00:00Z" + evidence_versions: + explanation: "" + failed_at: + failure_reason: + id: 100 + owner_type: team + primary_contact_ref: ref:handle/team-a + resource_id: res-1 + retry_schedule: + sources: [] + status: suggested + pagination: + has_more: false + next_cursor: + id: res-1 + type: ownership_history + schema: + $ref: "#/components/schemas/OwnershipHistoryResponse" + 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 + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: List ownership inference history for a resource + tags: ["CSM Ownership"] + x-unstable: |- + **Note**: This endpoint is in Preview and may be subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/csm/ownership/{resource_id}/{owner_type}: + get: + description: |- + Get the current ownership inference for a resource for a specific owner type. + + This endpoint supports ETag-based caching. Pass the previously returned `ETag` value in the `If-None-Match` request header to receive a `304 Not Modified` response when the inference has not changed. + operationId: GetOwnershipInference + parameters: + - description: The identifier of the resource to retrieve the ownership inference for. + in: path + name: resource_id + required: true + schema: + example: test-resource + type: string + - description: The owner type of the inference to retrieve. + in: path + name: owner_type + required: true + schema: + $ref: "#/components/schemas/OwnershipOwnerType" + - description: A previously returned `ETag` value. When supplied and the resource has not changed, the endpoint returns `304 Not Modified`. + in: header + name: If-None-Match + required: false + schema: + example: '"abc123"' + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + checksum: abc123 + confidence: "0.9500" + created_at: "2026-01-15T10:00:00Z" + evidence_versions: + - pipeline_id: p1 + explanation: High confidence match + owner_type: team + primary_contact_ref: ref:handle/team-a + sources: [] + status: suggested + updated_at: "2026-01-15T10:00:00Z" + id: test-resource:team + type: ownership_inference + schema: + $ref: "#/components/schemas/OwnershipInferenceResponse" + description: OK + headers: + Cache-Control: + description: The cache control directives applied to the response. + schema: + example: private, max-age=60 + type: string + ETag: + description: A strong validator that identifies the current state of the inference. + schema: + example: '"abc123"' + type: string + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Get an ownership inference by owner type + tags: ["CSM Ownership"] + x-unstable: |- + **Note**: This endpoint is in Preview and may be subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/csm/ownership/{resource_id}/{owner_type}/evidence: + get: + description: |- + Get the evidence versions backing the current ownership inference for a resource and owner type. + + This endpoint supports weak ETag caching. Pass the previously returned `ETag` value in the `If-None-Match` request header to receive a `304 Not Modified` response when the evidence has not changed. + operationId: GetOwnershipEvidence + parameters: + - description: The identifier of the resource to retrieve evidence for. + in: path + name: resource_id + required: true + schema: + example: test-resource + type: string + - description: The owner type of the inference to retrieve evidence for. + in: path + name: owner_type + required: true + schema: + $ref: "#/components/schemas/OwnershipOwnerType" + - description: A previously returned weak `ETag` value. When supplied and the evidence has not changed, the endpoint returns `304 Not Modified`. + in: header + name: If-None-Match + required: false + schema: + example: W/"f2e126916327bda8" + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + evidence_versions: + - pipeline_id: p1 + version: v3 + id: test-resource + type: ownership_evidence + schema: + $ref: "#/components/schemas/OwnershipEvidenceResponse" + description: OK + headers: + ETag: + description: A weak validator that identifies the current state of the evidence. + schema: + example: W/"f2e126916327bda8" + type: string + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Get the evidence for an ownership inference + tags: ["CSM Ownership"] + x-unstable: |- + **Note**: This endpoint is in Preview and may be subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/csm/ownership/{resource_id}/{owner_type}/feedback: + post: + description: |- + Submit feedback on the current ownership inference for a resource and owner type. Valid actions are `confirm`, `reject`, `correct`, and `persist`. + + The request must include the current inference `checksum` in `inference_checksum`. If the checksum does not match the current inference state, the endpoint returns `409 Conflict`. + + When `action` is `correct`, `corrected_owner_handle` and `corrected_owner_type` are required. + operationId: CreateOwnershipFeedback + parameters: + - description: The identifier of the resource that the feedback applies to. + in: path + name: resource_id + required: true + schema: + example: res-1 + type: string + - description: The type of owner that the feedback applies to. + in: path + name: owner_type + required: true + schema: + $ref: "#/components/schemas/OwnershipOwnerType" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + action: confirm + actor_handle: user@example.com + actor_type: user + inference_checksum: abc123 + type: ownership_feedback + schema: + $ref: "#/components/schemas/OwnershipFeedbackRequest" + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + action: confirm + checksum: abc123 + new_status: suggested + owner_type: team + previous_status: suggested + primary_contact_ref: ref:handle/team-a + updated_at: "2026-01-15T10:00:00Z" + id: res-1 + type: ownership_feedback_result + schema: + $ref: "#/components/schemas/OwnershipFeedbackResponse" + description: Created + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/OwnershipInferenceResponse" + description: Conflict + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Submit feedback on an ownership inference + tags: ["CSM Ownership"] + x-unstable: |- + **Note**: This endpoint is in Preview and may be subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/csm/ownership/{resource_id}/{owner_type}/history: + get: + description: List inference history entries for a resource filtered by owner type, ordered from most recent to oldest. Uses cursor-based pagination. + operationId: ListOwnershipHistoryByOwnerType + parameters: + - description: The identifier of the resource to retrieve inference history for. + in: path + name: resource_id + required: true + schema: + example: res-1 + type: string + - description: The owner type to filter history by. + in: path + name: owner_type + required: true + schema: + $ref: "#/components/schemas/OwnershipOwnerType" + - description: An opaque, base64-encoded cursor token returned by a previous call in `pagination.next_cursor`. Omit to fetch the first page. + in: query + name: cursor + required: false + schema: + example: eyJpZCI6OTh9 + type: string + - description: The maximum number of history entries to return per page. + in: query + name: limit + required: false + schema: + default: 25 + example: 25 + format: int32 + maximum: 100 + minimum: 1 + type: integer + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + items: + - checksum: "" + confidence: "0.9000" + created_at: "2026-01-15T10:00:00Z" + evidence_versions: + explanation: "" + failed_at: + failure_reason: + id: 100 + owner_type: team + primary_contact_ref: ref:handle/team-a + resource_id: res-1 + retry_schedule: + sources: [] + status: suggested + pagination: + has_more: false + next_cursor: + id: res-1 + type: ownership_history + schema: + $ref: "#/components/schemas/OwnershipHistoryResponse" + 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 + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: List ownership history by owner type + tags: ["CSM Ownership"] + x-unstable: |- + **Note**: This endpoint is in Preview and may be subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/csm/settings/agentless_hosts: get: description: Get the list of agentless hosts for CSM, with optional pagination and filtering. @@ -182068,6 +183119,13 @@ tags: all in a unified view for seamless collaboration and faster remediation. Go to https://docs.datadoghq.com/security/cloud_security_management to learn more. name: "CSM Coverage Analysis" + - description: |- + Datadog Cloud Security Management (CSM) Ownership infers the most likely owner + for a cloud resource by combining ownership signals from across the platform, + and lets you review the inference, inspect its evidence, and submit feedback to + persist, override, or correct the inferred owner. + For more information, see [Cloud Security Management](https://docs.datadoghq.com/security/cloud_security_management). + name: "CSM Ownership" - description: |- Datadog Cloud Security Management (CSM) Settings APIs allow you to list and filter your cloud hosts monitored by CSM, covering both agentless and agent-based discovery. diff --git a/docs/datadog_api_client.v2.api.rst b/docs/datadog_api_client.v2.api.rst index d5fd8adfcd..8958a3741f 100644 --- a/docs/datadog_api_client.v2.api.rst +++ b/docs/datadog_api_client.v2.api.rst @@ -228,6 +228,13 @@ datadog\_api\_client.v2.api.csm\_coverage\_analysis\_api module :members: :show-inheritance: +datadog\_api\_client.v2.api.csm\_ownership\_api module +------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.api.csm_ownership_api + :members: + :show-inheritance: + datadog\_api\_client.v2.api.csm\_settings\_api module ----------------------------------------------------- diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 26520fda06..f8409caaa4 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -28627,6 +28627,223 @@ datadog\_api\_client.v2.model.overwrite\_allocations\_request module :members: :show-inheritance: +datadog\_api\_client.v2.model.ownership\_evidence\_attributes module +-------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.ownership_evidence_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.ownership\_evidence\_data module +-------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.ownership_evidence_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.ownership\_evidence\_response module +------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.ownership_evidence_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.ownership\_evidence\_type module +-------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.ownership_evidence_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.ownership\_feedback\_action module +---------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.ownership_feedback_action + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.ownership\_feedback\_request module +----------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.ownership_feedback_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.ownership\_feedback\_request\_attributes module +----------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.ownership_feedback_request_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.ownership\_feedback\_request\_data module +----------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.ownership_feedback_request_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.ownership\_feedback\_response module +------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.ownership_feedback_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.ownership\_feedback\_result\_attributes module +---------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.ownership_feedback_result_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.ownership\_feedback\_result\_data module +---------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.ownership_feedback_result_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.ownership\_feedback\_result\_type module +---------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.ownership_feedback_result_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.ownership\_feedback\_type module +-------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.ownership_feedback_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.ownership\_history\_attributes module +------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.ownership_history_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.ownership\_history\_data module +------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.ownership_history_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.ownership\_history\_item module +------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.ownership_history_item + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.ownership\_history\_pagination module +------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.ownership_history_pagination + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.ownership\_history\_response module +----------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.ownership_history_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.ownership\_history\_type module +------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.ownership_history_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.ownership\_inference\_attributes module +--------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.ownership_inference_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.ownership\_inference\_data module +--------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.ownership_inference_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.ownership\_inference\_item module +--------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.ownership_inference_item + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.ownership\_inference\_list\_attributes module +--------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.ownership_inference_list_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.ownership\_inference\_list\_data module +--------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.ownership_inference_list_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.ownership\_inference\_list\_response module +------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.ownership_inference_list_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.ownership\_inference\_response module +------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.ownership_inference_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.ownership\_inference\_source module +----------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.ownership_inference_source + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.ownership\_inference\_status module +----------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.ownership_inference_status + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.ownership\_inference\_type module +--------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.ownership_inference_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.ownership\_inferences\_type module +---------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.ownership_inferences_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.ownership\_owner\_type module +----------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.ownership_owner_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.page\_annotations\_attributes module ------------------------------------------------------------------ diff --git a/examples/v2/csm-ownership/CreateOwnershipFeedback.py b/examples/v2/csm-ownership/CreateOwnershipFeedback.py new file mode 100644 index 0000000000..f440107635 --- /dev/null +++ b/examples/v2/csm-ownership/CreateOwnershipFeedback.py @@ -0,0 +1,37 @@ +""" +Submit feedback on an ownership inference returns "Created" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.csm_ownership_api import CSMOwnershipApi +from datadog_api_client.v2.model.ownership_feedback_action import OwnershipFeedbackAction +from datadog_api_client.v2.model.ownership_feedback_request import OwnershipFeedbackRequest +from datadog_api_client.v2.model.ownership_feedback_request_attributes import OwnershipFeedbackRequestAttributes +from datadog_api_client.v2.model.ownership_feedback_request_data import OwnershipFeedbackRequestData +from datadog_api_client.v2.model.ownership_feedback_type import OwnershipFeedbackType +from datadog_api_client.v2.model.ownership_owner_type import OwnershipOwnerType + +body = OwnershipFeedbackRequest( + data=OwnershipFeedbackRequestData( + attributes=OwnershipFeedbackRequestAttributes( + action=OwnershipFeedbackAction.CONFIRM, + actor_handle="user@example.com", + actor_type="user", + corrected_owner_handle="team-b", + corrected_owner_type="team", + inference_checksum="abc123", + reason="Confirmed by team lead.", + ), + type=OwnershipFeedbackType.OWNERSHIP_FEEDBACK, + ), +) + +configuration = Configuration() +configuration.unstable_operations["create_ownership_feedback"] = True +with ApiClient(configuration) as api_client: + api_instance = CSMOwnershipApi(api_client) + response = api_instance.create_ownership_feedback( + resource_id="res-1", owner_type=OwnershipOwnerType.TEAM, body=body + ) + + print(response) diff --git a/examples/v2/csm-ownership/GetOwnershipEvidence.py b/examples/v2/csm-ownership/GetOwnershipEvidence.py new file mode 100644 index 0000000000..08d80155a1 --- /dev/null +++ b/examples/v2/csm-ownership/GetOwnershipEvidence.py @@ -0,0 +1,18 @@ +""" +Get the evidence for an ownership inference returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.csm_ownership_api import CSMOwnershipApi +from datadog_api_client.v2.model.ownership_owner_type import OwnershipOwnerType + +configuration = Configuration() +configuration.unstable_operations["get_ownership_evidence"] = True +with ApiClient(configuration) as api_client: + api_instance = CSMOwnershipApi(api_client) + response = api_instance.get_ownership_evidence( + resource_id="test-resource", + owner_type=OwnershipOwnerType.TEAM, + ) + + print(response) diff --git a/examples/v2/csm-ownership/GetOwnershipInference.py b/examples/v2/csm-ownership/GetOwnershipInference.py new file mode 100644 index 0000000000..22a2f846c1 --- /dev/null +++ b/examples/v2/csm-ownership/GetOwnershipInference.py @@ -0,0 +1,18 @@ +""" +Get an ownership inference by owner type returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.csm_ownership_api import CSMOwnershipApi +from datadog_api_client.v2.model.ownership_owner_type import OwnershipOwnerType + +configuration = Configuration() +configuration.unstable_operations["get_ownership_inference"] = True +with ApiClient(configuration) as api_client: + api_instance = CSMOwnershipApi(api_client) + response = api_instance.get_ownership_inference( + resource_id="test-resource", + owner_type=OwnershipOwnerType.TEAM, + ) + + print(response) diff --git a/examples/v2/csm-ownership/ListOwnershipHistory.py b/examples/v2/csm-ownership/ListOwnershipHistory.py new file mode 100644 index 0000000000..6acb0c21ad --- /dev/null +++ b/examples/v2/csm-ownership/ListOwnershipHistory.py @@ -0,0 +1,16 @@ +""" +List ownership inference history for a resource returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.csm_ownership_api import CSMOwnershipApi + +configuration = Configuration() +configuration.unstable_operations["list_ownership_history"] = True +with ApiClient(configuration) as api_client: + api_instance = CSMOwnershipApi(api_client) + response = api_instance.list_ownership_history( + resource_id="res-1", + ) + + print(response) diff --git a/examples/v2/csm-ownership/ListOwnershipHistoryByOwnerType.py b/examples/v2/csm-ownership/ListOwnershipHistoryByOwnerType.py new file mode 100644 index 0000000000..5778ba10c0 --- /dev/null +++ b/examples/v2/csm-ownership/ListOwnershipHistoryByOwnerType.py @@ -0,0 +1,18 @@ +""" +List ownership history by owner type returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.csm_ownership_api import CSMOwnershipApi +from datadog_api_client.v2.model.ownership_owner_type import OwnershipOwnerType + +configuration = Configuration() +configuration.unstable_operations["list_ownership_history_by_owner_type"] = True +with ApiClient(configuration) as api_client: + api_instance = CSMOwnershipApi(api_client) + response = api_instance.list_ownership_history_by_owner_type( + resource_id="res-1", + owner_type=OwnershipOwnerType.TEAM, + ) + + print(response) diff --git a/examples/v2/csm-ownership/ListOwnershipInferences.py b/examples/v2/csm-ownership/ListOwnershipInferences.py new file mode 100644 index 0000000000..fba31aac47 --- /dev/null +++ b/examples/v2/csm-ownership/ListOwnershipInferences.py @@ -0,0 +1,16 @@ +""" +List ownership inferences for a resource returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.csm_ownership_api import CSMOwnershipApi + +configuration = Configuration() +configuration.unstable_operations["list_ownership_inferences"] = True +with ApiClient(configuration) as api_client: + api_instance = CSMOwnershipApi(api_client) + response = api_instance.list_ownership_inferences( + resource_id="test-resource", + ) + + print(response) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index bfa06d68f7..24f05b6ad5 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -464,6 +464,12 @@ def __init__( "v2.list_cost_tag_metadata_months": False, "v2.list_cost_tag_metadata_orchestrators": False, "v2.search_cost_recommendations": False, + "v2.create_ownership_feedback": False, + "v2.get_ownership_evidence": False, + "v2.get_ownership_inference": False, + "v2.list_ownership_history": False, + "v2.list_ownership_history_by_owner_type": False, + "v2.list_ownership_inferences": False, "v2.get_csm_agentless_host_facet_info": False, "v2.get_csm_unified_host_facet_info": False, "v2.list_csm_agentless_host_facets": False, diff --git a/src/datadog_api_client/v2/api/csm_ownership_api.py b/src/datadog_api_client/v2/api/csm_ownership_api.py new file mode 100644 index 0000000000..bf7db77ae7 --- /dev/null +++ b/src/datadog_api_client/v2/api/csm_ownership_api.py @@ -0,0 +1,412 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Any, Dict, Union + +from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint +from datadog_api_client.configuration import Configuration +from datadog_api_client.model_utils import ( + UnsetType, + unset, +) +from datadog_api_client.v2.model.ownership_inference_list_response import OwnershipInferenceListResponse +from datadog_api_client.v2.model.ownership_history_response import OwnershipHistoryResponse +from datadog_api_client.v2.model.ownership_inference_response import OwnershipInferenceResponse +from datadog_api_client.v2.model.ownership_owner_type import OwnershipOwnerType +from datadog_api_client.v2.model.ownership_evidence_response import OwnershipEvidenceResponse +from datadog_api_client.v2.model.ownership_feedback_response import OwnershipFeedbackResponse +from datadog_api_client.v2.model.ownership_feedback_request import OwnershipFeedbackRequest + + +class CSMOwnershipApi: + """ + Datadog Cloud Security Management (CSM) Ownership infers the most likely owner + for a cloud resource by combining ownership signals from across the platform, + and lets you review the inference, inspect its evidence, and submit feedback to + persist, override, or correct the inferred owner. + For more information, see `Cloud Security Management `_. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient(Configuration()) + self.api_client = api_client + + self._create_ownership_feedback_endpoint = _Endpoint( + settings={ + "response_type": (OwnershipFeedbackResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/csm/ownership/{resource_id}/{owner_type}/feedback", + "operation_id": "create_ownership_feedback", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "resource_id": { + "required": True, + "openapi_types": (str,), + "attribute": "resource_id", + "location": "path", + }, + "owner_type": { + "required": True, + "openapi_types": (OwnershipOwnerType,), + "attribute": "owner_type", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (OwnershipFeedbackRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + self._get_ownership_evidence_endpoint = _Endpoint( + settings={ + "response_type": (OwnershipEvidenceResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/csm/ownership/{resource_id}/{owner_type}/evidence", + "operation_id": "get_ownership_evidence", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "resource_id": { + "required": True, + "openapi_types": (str,), + "attribute": "resource_id", + "location": "path", + }, + "owner_type": { + "required": True, + "openapi_types": (OwnershipOwnerType,), + "attribute": "owner_type", + "location": "path", + }, + "if_none_match": { + "openapi_types": (str,), + "attribute": "If-None-Match", + "location": "header", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._get_ownership_inference_endpoint = _Endpoint( + settings={ + "response_type": (OwnershipInferenceResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/csm/ownership/{resource_id}/{owner_type}", + "operation_id": "get_ownership_inference", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "resource_id": { + "required": True, + "openapi_types": (str,), + "attribute": "resource_id", + "location": "path", + }, + "owner_type": { + "required": True, + "openapi_types": (OwnershipOwnerType,), + "attribute": "owner_type", + "location": "path", + }, + "if_none_match": { + "openapi_types": (str,), + "attribute": "If-None-Match", + "location": "header", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._list_ownership_history_endpoint = _Endpoint( + settings={ + "response_type": (OwnershipHistoryResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/csm/ownership/{resource_id}/history", + "operation_id": "list_ownership_history", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "resource_id": { + "required": True, + "openapi_types": (str,), + "attribute": "resource_id", + "location": "path", + }, + "cursor": { + "openapi_types": (str,), + "attribute": "cursor", + "location": "query", + }, + "limit": { + "validation": { + "inclusive_maximum": 100, + "inclusive_minimum": 1, + }, + "openapi_types": (int,), + "attribute": "limit", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._list_ownership_history_by_owner_type_endpoint = _Endpoint( + settings={ + "response_type": (OwnershipHistoryResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/csm/ownership/{resource_id}/{owner_type}/history", + "operation_id": "list_ownership_history_by_owner_type", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "resource_id": { + "required": True, + "openapi_types": (str,), + "attribute": "resource_id", + "location": "path", + }, + "owner_type": { + "required": True, + "openapi_types": (OwnershipOwnerType,), + "attribute": "owner_type", + "location": "path", + }, + "cursor": { + "openapi_types": (str,), + "attribute": "cursor", + "location": "query", + }, + "limit": { + "validation": { + "inclusive_maximum": 100, + "inclusive_minimum": 1, + }, + "openapi_types": (int,), + "attribute": "limit", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._list_ownership_inferences_endpoint = _Endpoint( + settings={ + "response_type": (OwnershipInferenceListResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/csm/ownership/{resource_id}", + "operation_id": "list_ownership_inferences", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "resource_id": { + "required": True, + "openapi_types": (str,), + "attribute": "resource_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + def create_ownership_feedback( + self, + resource_id: str, + owner_type: OwnershipOwnerType, + body: OwnershipFeedbackRequest, + ) -> OwnershipFeedbackResponse: + """Submit feedback on an ownership inference. + + Submit feedback on the current ownership inference for a resource and owner type. Valid actions are ``confirm`` , ``reject`` , ``correct`` , and ``persist``. + + The request must include the current inference ``checksum`` in ``inference_checksum``. If the checksum does not match the current inference state, the endpoint returns ``409 Conflict``. + + When ``action`` is ``correct`` , ``corrected_owner_handle`` and ``corrected_owner_type`` are required. + + :param resource_id: The identifier of the resource that the feedback applies to. + :type resource_id: str + :param owner_type: The type of owner that the feedback applies to. + :type owner_type: OwnershipOwnerType + :type body: OwnershipFeedbackRequest + :rtype: OwnershipFeedbackResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["resource_id"] = resource_id + + kwargs["owner_type"] = owner_type + + kwargs["body"] = body + + return self._create_ownership_feedback_endpoint.call_with_http_info(**kwargs) + + def get_ownership_evidence( + self, + resource_id: str, + owner_type: OwnershipOwnerType, + *, + if_none_match: Union[str, UnsetType] = unset, + ) -> OwnershipEvidenceResponse: + """Get the evidence for an ownership inference. + + Get the evidence versions backing the current ownership inference for a resource and owner type. + + This endpoint supports weak ETag caching. Pass the previously returned ``ETag`` value in the ``If-None-Match`` request header to receive a ``304 Not Modified`` response when the evidence has not changed. + + :param resource_id: The identifier of the resource to retrieve evidence for. + :type resource_id: str + :param owner_type: The owner type of the inference to retrieve evidence for. + :type owner_type: OwnershipOwnerType + :param if_none_match: A previously returned weak ``ETag`` value. When supplied and the evidence has not changed, the endpoint returns ``304 Not Modified``. + :type if_none_match: str, optional + :rtype: OwnershipEvidenceResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["resource_id"] = resource_id + + kwargs["owner_type"] = owner_type + + if if_none_match is not unset: + kwargs["if_none_match"] = if_none_match + + return self._get_ownership_evidence_endpoint.call_with_http_info(**kwargs) + + def get_ownership_inference( + self, + resource_id: str, + owner_type: OwnershipOwnerType, + *, + if_none_match: Union[str, UnsetType] = unset, + ) -> OwnershipInferenceResponse: + """Get an ownership inference by owner type. + + Get the current ownership inference for a resource for a specific owner type. + + This endpoint supports ETag-based caching. Pass the previously returned ``ETag`` value in the ``If-None-Match`` request header to receive a ``304 Not Modified`` response when the inference has not changed. + + :param resource_id: The identifier of the resource to retrieve the ownership inference for. + :type resource_id: str + :param owner_type: The owner type of the inference to retrieve. + :type owner_type: OwnershipOwnerType + :param if_none_match: A previously returned ``ETag`` value. When supplied and the resource has not changed, the endpoint returns ``304 Not Modified``. + :type if_none_match: str, optional + :rtype: OwnershipInferenceResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["resource_id"] = resource_id + + kwargs["owner_type"] = owner_type + + if if_none_match is not unset: + kwargs["if_none_match"] = if_none_match + + return self._get_ownership_inference_endpoint.call_with_http_info(**kwargs) + + def list_ownership_history( + self, + resource_id: str, + *, + cursor: Union[str, UnsetType] = unset, + limit: Union[int, UnsetType] = unset, + ) -> OwnershipHistoryResponse: + """List ownership inference history for a resource. + + List inference history entries for a resource across all owner types, ordered from most recent to oldest. Uses cursor-based pagination. + + :param resource_id: The identifier of the resource to retrieve inference history for. + :type resource_id: str + :param cursor: An opaque, base64-encoded cursor token returned by a previous call in ``pagination.next_cursor``. Omit to fetch the first page. + :type cursor: str, optional + :param limit: The maximum number of history entries to return per page. + :type limit: int, optional + :rtype: OwnershipHistoryResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["resource_id"] = resource_id + + if cursor is not unset: + kwargs["cursor"] = cursor + + if limit is not unset: + kwargs["limit"] = limit + + return self._list_ownership_history_endpoint.call_with_http_info(**kwargs) + + def list_ownership_history_by_owner_type( + self, + resource_id: str, + owner_type: OwnershipOwnerType, + *, + cursor: Union[str, UnsetType] = unset, + limit: Union[int, UnsetType] = unset, + ) -> OwnershipHistoryResponse: + """List ownership history by owner type. + + List inference history entries for a resource filtered by owner type, ordered from most recent to oldest. Uses cursor-based pagination. + + :param resource_id: The identifier of the resource to retrieve inference history for. + :type resource_id: str + :param owner_type: The owner type to filter history by. + :type owner_type: OwnershipOwnerType + :param cursor: An opaque, base64-encoded cursor token returned by a previous call in ``pagination.next_cursor``. Omit to fetch the first page. + :type cursor: str, optional + :param limit: The maximum number of history entries to return per page. + :type limit: int, optional + :rtype: OwnershipHistoryResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["resource_id"] = resource_id + + kwargs["owner_type"] = owner_type + + if cursor is not unset: + kwargs["cursor"] = cursor + + if limit is not unset: + kwargs["limit"] = limit + + return self._list_ownership_history_by_owner_type_endpoint.call_with_http_info(**kwargs) + + def list_ownership_inferences( + self, + resource_id: str, + ) -> OwnershipInferenceListResponse: + """List ownership inferences for a resource. + + Get all current ownership inferences for a resource, one per owner type ( ``user`` , ``team`` , ``service`` , ``unknown`` ). + + :param resource_id: The identifier of the resource to retrieve ownership inferences for. + :type resource_id: str + :rtype: OwnershipInferenceListResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["resource_id"] = resource_id + + return self._list_ownership_inferences_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v2/apis/__init__.py b/src/datadog_api_client/v2/apis/__init__.py index ea90bf0e99..7845da0b59 100644 --- a/src/datadog_api_client/v2/apis/__init__.py +++ b/src/datadog_api_client/v2/apis/__init__.py @@ -17,6 +17,7 @@ from datadog_api_client.v2.api.ci_visibility_tests_api import CIVisibilityTestsApi from datadog_api_client.v2.api.csm_agents_api import CSMAgentsApi from datadog_api_client.v2.api.csm_coverage_analysis_api import CSMCoverageAnalysisApi +from datadog_api_client.v2.api.csm_ownership_api import CSMOwnershipApi from datadog_api_client.v2.api.csm_settings_api import CSMSettingsApi from datadog_api_client.v2.api.csm_threats_api import CSMThreatsApi from datadog_api_client.v2.api.case_management_api import CaseManagementApi @@ -145,6 +146,7 @@ "CIVisibilityTestsApi", "CSMAgentsApi", "CSMCoverageAnalysisApi", + "CSMOwnershipApi", "CSMSettingsApi", "CSMThreatsApi", "CaseManagementApi", diff --git a/src/datadog_api_client/v2/model/ownership_evidence_attributes.py b/src/datadog_api_client/v2/model/ownership_evidence_attributes.py new file mode 100644 index 0000000000..1e61a6cb12 --- /dev/null +++ b/src/datadog_api_client/v2/model/ownership_evidence_attributes.py @@ -0,0 +1,41 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + none_type, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.ownership_evidence_version import OwnershipEvidenceVersion + + +class OwnershipEvidenceAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.ownership_evidence_version import OwnershipEvidenceVersion + + return { + "evidence_versions": ([OwnershipEvidenceVersion],), + } + + attribute_map = { + "evidence_versions": "evidence_versions", + } + + def __init__(self_, evidence_versions: Union[List[OwnershipEvidenceVersion], none_type], **kwargs): + """ + The attributes of an ownership evidence response. + + :param evidence_versions: The list of evidence versions associated with an inference. + :type evidence_versions: [OwnershipEvidenceVersion], none_type + """ + super().__init__(kwargs) + + self_.evidence_versions = evidence_versions diff --git a/src/datadog_api_client/v2/model/ownership_evidence_data.py b/src/datadog_api_client/v2/model/ownership_evidence_data.py new file mode 100644 index 0000000000..3659323cce --- /dev/null +++ b/src/datadog_api_client/v2/model/ownership_evidence_data.py @@ -0,0 +1,54 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.ownership_evidence_attributes import OwnershipEvidenceAttributes + from datadog_api_client.v2.model.ownership_evidence_type import OwnershipEvidenceType + + +class OwnershipEvidenceData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.ownership_evidence_attributes import OwnershipEvidenceAttributes + from datadog_api_client.v2.model.ownership_evidence_type import OwnershipEvidenceType + + return { + "attributes": (OwnershipEvidenceAttributes,), + "id": (str,), + "type": (OwnershipEvidenceType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__(self_, attributes: OwnershipEvidenceAttributes, id: str, type: OwnershipEvidenceType, **kwargs): + """ + The data wrapper for an ownership evidence response. + + :param attributes: The attributes of an ownership evidence response. + :type attributes: OwnershipEvidenceAttributes + + :param id: The identifier of the resource the evidence applies to. + :type id: str + + :param type: The type of the ownership evidence resource. The value should always be ``ownership_evidence``. + :type type: OwnershipEvidenceType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/ownership_evidence_response.py b/src/datadog_api_client/v2/model/ownership_evidence_response.py new file mode 100644 index 0000000000..9333c23823 --- /dev/null +++ b/src/datadog_api_client/v2/model/ownership_evidence_response.py @@ -0,0 +1,40 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.ownership_evidence_data import OwnershipEvidenceData + + +class OwnershipEvidenceResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.ownership_evidence_data import OwnershipEvidenceData + + return { + "data": (OwnershipEvidenceData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: OwnershipEvidenceData, **kwargs): + """ + The response returned when retrieving the evidence backing an ownership inference for an owner type. + + :param data: The data wrapper for an ownership evidence response. + :type data: OwnershipEvidenceData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/ownership_evidence_type.py b/src/datadog_api_client/v2/model/ownership_evidence_type.py new file mode 100644 index 0000000000..f14ae88e52 --- /dev/null +++ b/src/datadog_api_client/v2/model/ownership_evidence_type.py @@ -0,0 +1,35 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class OwnershipEvidenceType(ModelSimple): + """ + The type of the ownership evidence resource. The value should always be `ownership_evidence`. + + :param value: If omitted defaults to "ownership_evidence". Must be one of ["ownership_evidence"]. + :type value: str + """ + + allowed_values = { + "ownership_evidence", + } + OWNERSHIP_EVIDENCE: ClassVar["OwnershipEvidenceType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +OwnershipEvidenceType.OWNERSHIP_EVIDENCE = OwnershipEvidenceType("ownership_evidence") diff --git a/src/datadog_api_client/v2/model/ownership_evidence_version.py b/src/datadog_api_client/v2/model/ownership_evidence_version.py new file mode 100644 index 0000000000..76b93a4157 --- /dev/null +++ b/src/datadog_api_client/v2/model/ownership_evidence_version.py @@ -0,0 +1,17 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelNormal, +) + + +class OwnershipEvidenceVersion(ModelNormal): + def __init__(self_, **kwargs): + """ + A single evidence version entry describing how an inference was produced. + """ + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/ownership_feedback_action.py b/src/datadog_api_client/v2/model/ownership_feedback_action.py new file mode 100644 index 0000000000..87143d4de1 --- /dev/null +++ b/src/datadog_api_client/v2/model/ownership_feedback_action.py @@ -0,0 +1,44 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class OwnershipFeedbackAction(ModelSimple): + """ + The feedback action to apply to an inference. + + :param value: Must be one of ["confirm", "reject", "correct", "persist"]. + :type value: str + """ + + allowed_values = { + "confirm", + "reject", + "correct", + "persist", + } + CONFIRM: ClassVar["OwnershipFeedbackAction"] + REJECT: ClassVar["OwnershipFeedbackAction"] + CORRECT: ClassVar["OwnershipFeedbackAction"] + PERSIST: ClassVar["OwnershipFeedbackAction"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +OwnershipFeedbackAction.CONFIRM = OwnershipFeedbackAction("confirm") +OwnershipFeedbackAction.REJECT = OwnershipFeedbackAction("reject") +OwnershipFeedbackAction.CORRECT = OwnershipFeedbackAction("correct") +OwnershipFeedbackAction.PERSIST = OwnershipFeedbackAction("persist") diff --git a/src/datadog_api_client/v2/model/ownership_feedback_request.py b/src/datadog_api_client/v2/model/ownership_feedback_request.py new file mode 100644 index 0000000000..950416aaf9 --- /dev/null +++ b/src/datadog_api_client/v2/model/ownership_feedback_request.py @@ -0,0 +1,40 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.ownership_feedback_request_data import OwnershipFeedbackRequestData + + +class OwnershipFeedbackRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.ownership_feedback_request_data import OwnershipFeedbackRequestData + + return { + "data": (OwnershipFeedbackRequestData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: OwnershipFeedbackRequestData, **kwargs): + """ + The request body for submitting ownership feedback. + + :param data: The data wrapper for an ownership feedback request. + :type data: OwnershipFeedbackRequestData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/ownership_feedback_request_attributes.py b/src/datadog_api_client/v2/model/ownership_feedback_request_attributes.py new file mode 100644 index 0000000000..46888507e0 --- /dev/null +++ b/src/datadog_api_client/v2/model/ownership_feedback_request_attributes.py @@ -0,0 +1,92 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + none_type, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.ownership_feedback_action import OwnershipFeedbackAction + + +class OwnershipFeedbackRequestAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.ownership_feedback_action import OwnershipFeedbackAction + + return { + "action": (OwnershipFeedbackAction,), + "actor_handle": (str,), + "actor_type": (str,), + "corrected_owner_handle": (str, none_type), + "corrected_owner_type": (str, none_type), + "inference_checksum": (str,), + "reason": (str, none_type), + } + + attribute_map = { + "action": "action", + "actor_handle": "actor_handle", + "actor_type": "actor_type", + "corrected_owner_handle": "corrected_owner_handle", + "corrected_owner_type": "corrected_owner_type", + "inference_checksum": "inference_checksum", + "reason": "reason", + } + + def __init__( + self_, + action: OwnershipFeedbackAction, + actor_handle: str, + actor_type: str, + inference_checksum: str, + corrected_owner_handle: Union[str, none_type, UnsetType] = unset, + corrected_owner_type: Union[str, none_type, UnsetType] = unset, + reason: Union[str, none_type, UnsetType] = unset, + **kwargs, + ): + """ + The attributes of an ownership feedback request. + + :param action: The feedback action to apply to an inference. + :type action: OwnershipFeedbackAction + + :param actor_handle: The handle of the actor submitting the feedback. + :type actor_handle: str + + :param actor_type: The type of actor submitting the feedback, for example ``user`` or ``service``. + :type actor_type: str + + :param corrected_owner_handle: The corrected owner handle. Required when ``action`` is ``correct``. + :type corrected_owner_handle: str, none_type, optional + + :param corrected_owner_type: The corrected owner type. Required when ``action`` is ``correct``. + :type corrected_owner_type: str, none_type, optional + + :param inference_checksum: The checksum of the inference being acted upon. Must match the current inference checksum or the request returns a conflict. + :type inference_checksum: str + + :param reason: An optional free-form reason explaining the feedback. + :type reason: str, none_type, optional + """ + if corrected_owner_handle is not unset: + kwargs["corrected_owner_handle"] = corrected_owner_handle + if corrected_owner_type is not unset: + kwargs["corrected_owner_type"] = corrected_owner_type + if reason is not unset: + kwargs["reason"] = reason + super().__init__(kwargs) + + self_.action = action + self_.actor_handle = actor_handle + self_.actor_type = actor_type + self_.inference_checksum = inference_checksum diff --git a/src/datadog_api_client/v2/model/ownership_feedback_request_data.py b/src/datadog_api_client/v2/model/ownership_feedback_request_data.py new file mode 100644 index 0000000000..507b60c10a --- /dev/null +++ b/src/datadog_api_client/v2/model/ownership_feedback_request_data.py @@ -0,0 +1,48 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.ownership_feedback_request_attributes import OwnershipFeedbackRequestAttributes + from datadog_api_client.v2.model.ownership_feedback_type import OwnershipFeedbackType + + +class OwnershipFeedbackRequestData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.ownership_feedback_request_attributes import OwnershipFeedbackRequestAttributes + from datadog_api_client.v2.model.ownership_feedback_type import OwnershipFeedbackType + + return { + "attributes": (OwnershipFeedbackRequestAttributes,), + "type": (OwnershipFeedbackType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__(self_, attributes: OwnershipFeedbackRequestAttributes, type: OwnershipFeedbackType, **kwargs): + """ + The data wrapper for an ownership feedback request. + + :param attributes: The attributes of an ownership feedback request. + :type attributes: OwnershipFeedbackRequestAttributes + + :param type: The type of the ownership feedback request resource. The value should always be ``ownership_feedback``. + :type type: OwnershipFeedbackType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/ownership_feedback_response.py b/src/datadog_api_client/v2/model/ownership_feedback_response.py new file mode 100644 index 0000000000..ba58388775 --- /dev/null +++ b/src/datadog_api_client/v2/model/ownership_feedback_response.py @@ -0,0 +1,40 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.ownership_feedback_result_data import OwnershipFeedbackResultData + + +class OwnershipFeedbackResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.ownership_feedback_result_data import OwnershipFeedbackResultData + + return { + "data": (OwnershipFeedbackResultData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: OwnershipFeedbackResultData, **kwargs): + """ + The response returned after applying ownership feedback to an inference. + + :param data: The data wrapper for an ownership feedback result response. + :type data: OwnershipFeedbackResultData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/ownership_feedback_result_attributes.py b/src/datadog_api_client/v2/model/ownership_feedback_result_attributes.py new file mode 100644 index 0000000000..e14edf5f36 --- /dev/null +++ b/src/datadog_api_client/v2/model/ownership_feedback_result_attributes.py @@ -0,0 +1,95 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + none_type, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.ownership_feedback_action import OwnershipFeedbackAction + from datadog_api_client.v2.model.ownership_inference_status import OwnershipInferenceStatus + from datadog_api_client.v2.model.ownership_owner_type import OwnershipOwnerType + + +class OwnershipFeedbackResultAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.ownership_feedback_action import OwnershipFeedbackAction + from datadog_api_client.v2.model.ownership_inference_status import OwnershipInferenceStatus + from datadog_api_client.v2.model.ownership_owner_type import OwnershipOwnerType + + return { + "action": (OwnershipFeedbackAction,), + "checksum": (str,), + "new_status": (OwnershipInferenceStatus,), + "owner_type": (OwnershipOwnerType,), + "previous_status": (OwnershipInferenceStatus,), + "primary_contact_ref": (str, none_type), + "updated_at": (datetime,), + } + + attribute_map = { + "action": "action", + "checksum": "checksum", + "new_status": "new_status", + "owner_type": "owner_type", + "previous_status": "previous_status", + "primary_contact_ref": "primary_contact_ref", + "updated_at": "updated_at", + } + + def __init__( + self_, + action: OwnershipFeedbackAction, + checksum: str, + new_status: OwnershipInferenceStatus, + owner_type: OwnershipOwnerType, + previous_status: OwnershipInferenceStatus, + updated_at: datetime, + primary_contact_ref: Union[str, none_type, UnsetType] = unset, + **kwargs, + ): + """ + The attributes of an ownership feedback result. + + :param action: The feedback action to apply to an inference. + :type action: OwnershipFeedbackAction + + :param checksum: The checksum of the inference after the feedback was applied. + :type checksum: str + + :param new_status: The lifecycle status of an ownership inference. + :type new_status: OwnershipInferenceStatus + + :param owner_type: The owner type for an ownership inference. + :type owner_type: OwnershipOwnerType + + :param previous_status: The lifecycle status of an ownership inference. + :type previous_status: OwnershipInferenceStatus + + :param primary_contact_ref: The primary contact reference for the inferred owner after the feedback was applied, formatted as ``ref:handle/``. + :type primary_contact_ref: str, none_type, optional + + :param updated_at: The time when the inference was updated by the feedback. + :type updated_at: datetime + """ + if primary_contact_ref is not unset: + kwargs["primary_contact_ref"] = primary_contact_ref + super().__init__(kwargs) + + self_.action = action + self_.checksum = checksum + self_.new_status = new_status + self_.owner_type = owner_type + self_.previous_status = previous_status + self_.updated_at = updated_at diff --git a/src/datadog_api_client/v2/model/ownership_feedback_result_data.py b/src/datadog_api_client/v2/model/ownership_feedback_result_data.py new file mode 100644 index 0000000000..ea39b46a75 --- /dev/null +++ b/src/datadog_api_client/v2/model/ownership_feedback_result_data.py @@ -0,0 +1,56 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.ownership_feedback_result_attributes import OwnershipFeedbackResultAttributes + from datadog_api_client.v2.model.ownership_feedback_result_type import OwnershipFeedbackResultType + + +class OwnershipFeedbackResultData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.ownership_feedback_result_attributes import OwnershipFeedbackResultAttributes + from datadog_api_client.v2.model.ownership_feedback_result_type import OwnershipFeedbackResultType + + return { + "attributes": (OwnershipFeedbackResultAttributes,), + "id": (str,), + "type": (OwnershipFeedbackResultType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, attributes: OwnershipFeedbackResultAttributes, id: str, type: OwnershipFeedbackResultType, **kwargs + ): + """ + The data wrapper for an ownership feedback result response. + + :param attributes: The attributes of an ownership feedback result. + :type attributes: OwnershipFeedbackResultAttributes + + :param id: The identifier of the resource that the feedback was applied to. + :type id: str + + :param type: The type of the ownership feedback result resource. The value should always be ``ownership_feedback_result``. + :type type: OwnershipFeedbackResultType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/ownership_feedback_result_type.py b/src/datadog_api_client/v2/model/ownership_feedback_result_type.py new file mode 100644 index 0000000000..9879cda507 --- /dev/null +++ b/src/datadog_api_client/v2/model/ownership_feedback_result_type.py @@ -0,0 +1,35 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class OwnershipFeedbackResultType(ModelSimple): + """ + The type of the ownership feedback result resource. The value should always be `ownership_feedback_result`. + + :param value: If omitted defaults to "ownership_feedback_result". Must be one of ["ownership_feedback_result"]. + :type value: str + """ + + allowed_values = { + "ownership_feedback_result", + } + OWNERSHIP_FEEDBACK_RESULT: ClassVar["OwnershipFeedbackResultType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +OwnershipFeedbackResultType.OWNERSHIP_FEEDBACK_RESULT = OwnershipFeedbackResultType("ownership_feedback_result") diff --git a/src/datadog_api_client/v2/model/ownership_feedback_type.py b/src/datadog_api_client/v2/model/ownership_feedback_type.py new file mode 100644 index 0000000000..9cf003955b --- /dev/null +++ b/src/datadog_api_client/v2/model/ownership_feedback_type.py @@ -0,0 +1,35 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class OwnershipFeedbackType(ModelSimple): + """ + The type of the ownership feedback request resource. The value should always be `ownership_feedback`. + + :param value: If omitted defaults to "ownership_feedback". Must be one of ["ownership_feedback"]. + :type value: str + """ + + allowed_values = { + "ownership_feedback", + } + OWNERSHIP_FEEDBACK: ClassVar["OwnershipFeedbackType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +OwnershipFeedbackType.OWNERSHIP_FEEDBACK = OwnershipFeedbackType("ownership_feedback") diff --git a/src/datadog_api_client/v2/model/ownership_history_attributes.py b/src/datadog_api_client/v2/model/ownership_history_attributes.py new file mode 100644 index 0000000000..95c867b778 --- /dev/null +++ b/src/datadog_api_client/v2/model/ownership_history_attributes.py @@ -0,0 +1,48 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.ownership_history_item import OwnershipHistoryItem + from datadog_api_client.v2.model.ownership_history_pagination import OwnershipHistoryPagination + + +class OwnershipHistoryAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.ownership_history_item import OwnershipHistoryItem + from datadog_api_client.v2.model.ownership_history_pagination import OwnershipHistoryPagination + + return { + "items": ([OwnershipHistoryItem],), + "pagination": (OwnershipHistoryPagination,), + } + + attribute_map = { + "items": "items", + "pagination": "pagination", + } + + def __init__(self_, items: List[OwnershipHistoryItem], pagination: OwnershipHistoryPagination, **kwargs): + """ + The attributes of an ownership history response. + + :param items: The list of history entries returned for this page. + :type items: [OwnershipHistoryItem] + + :param pagination: Cursor-based pagination metadata for the history response. + :type pagination: OwnershipHistoryPagination + """ + super().__init__(kwargs) + + self_.items = items + self_.pagination = pagination diff --git a/src/datadog_api_client/v2/model/ownership_history_data.py b/src/datadog_api_client/v2/model/ownership_history_data.py new file mode 100644 index 0000000000..789c0a9021 --- /dev/null +++ b/src/datadog_api_client/v2/model/ownership_history_data.py @@ -0,0 +1,54 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.ownership_history_attributes import OwnershipHistoryAttributes + from datadog_api_client.v2.model.ownership_history_type import OwnershipHistoryType + + +class OwnershipHistoryData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.ownership_history_attributes import OwnershipHistoryAttributes + from datadog_api_client.v2.model.ownership_history_type import OwnershipHistoryType + + return { + "attributes": (OwnershipHistoryAttributes,), + "id": (str,), + "type": (OwnershipHistoryType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__(self_, attributes: OwnershipHistoryAttributes, id: str, type: OwnershipHistoryType, **kwargs): + """ + The data wrapper for an ownership history response. + + :param attributes: The attributes of an ownership history response. + :type attributes: OwnershipHistoryAttributes + + :param id: The resource identifier for which history is returned. + :type id: str + + :param type: The type of the ownership history resource. The value should always be ``ownership_history``. + :type type: OwnershipHistoryType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/ownership_history_item.py b/src/datadog_api_client/v2/model/ownership_history_item.py new file mode 100644 index 0000000000..255a5734ee --- /dev/null +++ b/src/datadog_api_client/v2/model/ownership_history_item.py @@ -0,0 +1,149 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + none_type, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.ownership_evidence_version import OwnershipEvidenceVersion + from datadog_api_client.v2.model.ownership_owner_type import OwnershipOwnerType + from datadog_api_client.v2.model.ownership_inference_source import OwnershipInferenceSource + from datadog_api_client.v2.model.ownership_inference_status import OwnershipInferenceStatus + + +class OwnershipHistoryItem(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.ownership_evidence_version import OwnershipEvidenceVersion + from datadog_api_client.v2.model.ownership_owner_type import OwnershipOwnerType + from datadog_api_client.v2.model.ownership_inference_source import OwnershipInferenceSource + from datadog_api_client.v2.model.ownership_inference_status import OwnershipInferenceStatus + + return { + "checksum": (str,), + "confidence": (str,), + "created_at": (datetime,), + "evidence_versions": ([OwnershipEvidenceVersion],), + "explanation": (str,), + "failed_at": (datetime, none_type), + "failure_reason": (str, none_type), + "id": (int,), + "owner_type": (OwnershipOwnerType,), + "primary_contact_ref": (str, none_type), + "resource_id": (str,), + "retry_schedule": (datetime, none_type), + "sources": ([OwnershipInferenceSource],), + "status": (OwnershipInferenceStatus,), + } + + attribute_map = { + "checksum": "checksum", + "confidence": "confidence", + "created_at": "created_at", + "evidence_versions": "evidence_versions", + "explanation": "explanation", + "failed_at": "failed_at", + "failure_reason": "failure_reason", + "id": "id", + "owner_type": "owner_type", + "primary_contact_ref": "primary_contact_ref", + "resource_id": "resource_id", + "retry_schedule": "retry_schedule", + "sources": "sources", + "status": "status", + } + + def __init__( + self_, + checksum: str, + confidence: str, + created_at: datetime, + evidence_versions: Union[List[OwnershipEvidenceVersion], none_type], + explanation: str, + id: int, + owner_type: OwnershipOwnerType, + resource_id: str, + sources: List[OwnershipInferenceSource], + status: OwnershipInferenceStatus, + failed_at: Union[datetime, none_type, UnsetType] = unset, + failure_reason: Union[str, none_type, UnsetType] = unset, + primary_contact_ref: Union[str, none_type, UnsetType] = unset, + retry_schedule: Union[datetime, none_type, UnsetType] = unset, + **kwargs, + ): + """ + A single ownership inference history entry. + + :param checksum: A checksum identifying the state of the inference at this point in time. + :type checksum: str + + :param confidence: The confidence score of the inference, expressed as a numeric string with up to four decimal places. + :type confidence: str + + :param created_at: The time this history entry was created. + :type created_at: datetime + + :param evidence_versions: The list of evidence versions associated with an inference. + :type evidence_versions: [OwnershipEvidenceVersion], none_type + + :param explanation: A human-readable explanation of how the inference was produced. + :type explanation: str + + :param failed_at: The time when this inference failed, if applicable. + :type failed_at: datetime, none_type, optional + + :param failure_reason: The reason why this inference failed, if applicable. + :type failure_reason: str, none_type, optional + + :param id: The unique identifier of the history entry. + :type id: int + + :param owner_type: The owner type for an ownership inference. + :type owner_type: OwnershipOwnerType + + :param primary_contact_ref: The primary contact reference for the inferred owner, formatted as ``ref:handle/``. + :type primary_contact_ref: str, none_type, optional + + :param resource_id: The identifier of the resource that the inference applies to. + :type resource_id: str + + :param retry_schedule: The scheduled retry time for a failed inference, if applicable. + :type retry_schedule: datetime, none_type, optional + + :param sources: The list of sources backing an ownership inference. Empty when the inference status is not whitelisted to expose sources. + :type sources: [OwnershipInferenceSource] + + :param status: The lifecycle status of an ownership inference. + :type status: OwnershipInferenceStatus + """ + if failed_at is not unset: + kwargs["failed_at"] = failed_at + if failure_reason is not unset: + kwargs["failure_reason"] = failure_reason + if primary_contact_ref is not unset: + kwargs["primary_contact_ref"] = primary_contact_ref + if retry_schedule is not unset: + kwargs["retry_schedule"] = retry_schedule + super().__init__(kwargs) + + self_.checksum = checksum + self_.confidence = confidence + self_.created_at = created_at + self_.evidence_versions = evidence_versions + self_.explanation = explanation + self_.id = id + self_.owner_type = owner_type + self_.resource_id = resource_id + self_.sources = sources + self_.status = status diff --git a/src/datadog_api_client/v2/model/ownership_history_pagination.py b/src/datadog_api_client/v2/model/ownership_history_pagination.py new file mode 100644 index 0000000000..033a6da289 --- /dev/null +++ b/src/datadog_api_client/v2/model/ownership_history_pagination.py @@ -0,0 +1,44 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + none_type, + unset, + UnsetType, +) + + +class OwnershipHistoryPagination(ModelNormal): + @cached_property + def openapi_types(_): + return { + "has_more": (bool,), + "next_cursor": (str, none_type), + } + + attribute_map = { + "has_more": "has_more", + "next_cursor": "next_cursor", + } + + def __init__(self_, has_more: bool, next_cursor: Union[str, none_type, UnsetType] = unset, **kwargs): + """ + Cursor-based pagination metadata for the history response. + + :param has_more: Whether more history entries are available beyond this page. + :type has_more: bool + + :param next_cursor: An opaque, base64-encoded cursor token. Pass it as the ``cursor`` query parameter to retrieve the next page. Absent or ``null`` when there are no further pages. + :type next_cursor: str, none_type, optional + """ + if next_cursor is not unset: + kwargs["next_cursor"] = next_cursor + super().__init__(kwargs) + + self_.has_more = has_more diff --git a/src/datadog_api_client/v2/model/ownership_history_response.py b/src/datadog_api_client/v2/model/ownership_history_response.py new file mode 100644 index 0000000000..cce37df7de --- /dev/null +++ b/src/datadog_api_client/v2/model/ownership_history_response.py @@ -0,0 +1,40 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.ownership_history_data import OwnershipHistoryData + + +class OwnershipHistoryResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.ownership_history_data import OwnershipHistoryData + + return { + "data": (OwnershipHistoryData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: OwnershipHistoryData, **kwargs): + """ + The response returned when listing the inference history for a resource. + + :param data: The data wrapper for an ownership history response. + :type data: OwnershipHistoryData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/ownership_history_type.py b/src/datadog_api_client/v2/model/ownership_history_type.py new file mode 100644 index 0000000000..7625bfbcd8 --- /dev/null +++ b/src/datadog_api_client/v2/model/ownership_history_type.py @@ -0,0 +1,35 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class OwnershipHistoryType(ModelSimple): + """ + The type of the ownership history resource. The value should always be `ownership_history`. + + :param value: If omitted defaults to "ownership_history". Must be one of ["ownership_history"]. + :type value: str + """ + + allowed_values = { + "ownership_history", + } + OWNERSHIP_HISTORY: ClassVar["OwnershipHistoryType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +OwnershipHistoryType.OWNERSHIP_HISTORY = OwnershipHistoryType("ownership_history") diff --git a/src/datadog_api_client/v2/model/ownership_inference_attributes.py b/src/datadog_api_client/v2/model/ownership_inference_attributes.py new file mode 100644 index 0000000000..dd17e9b998 --- /dev/null +++ b/src/datadog_api_client/v2/model/ownership_inference_attributes.py @@ -0,0 +1,118 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + none_type, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.ownership_evidence_version import OwnershipEvidenceVersion + from datadog_api_client.v2.model.ownership_owner_type import OwnershipOwnerType + from datadog_api_client.v2.model.ownership_inference_source import OwnershipInferenceSource + from datadog_api_client.v2.model.ownership_inference_status import OwnershipInferenceStatus + + +class OwnershipInferenceAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.ownership_evidence_version import OwnershipEvidenceVersion + from datadog_api_client.v2.model.ownership_owner_type import OwnershipOwnerType + from datadog_api_client.v2.model.ownership_inference_source import OwnershipInferenceSource + from datadog_api_client.v2.model.ownership_inference_status import OwnershipInferenceStatus + + return { + "checksum": (str,), + "confidence": (str,), + "created_at": (datetime,), + "evidence_versions": ([OwnershipEvidenceVersion],), + "explanation": (str,), + "owner_type": (OwnershipOwnerType,), + "primary_contact_ref": (str, none_type), + "sources": ([OwnershipInferenceSource],), + "status": (OwnershipInferenceStatus,), + "updated_at": (datetime,), + } + + attribute_map = { + "checksum": "checksum", + "confidence": "confidence", + "created_at": "created_at", + "evidence_versions": "evidence_versions", + "explanation": "explanation", + "owner_type": "owner_type", + "primary_contact_ref": "primary_contact_ref", + "sources": "sources", + "status": "status", + "updated_at": "updated_at", + } + + def __init__( + self_, + checksum: str, + confidence: str, + created_at: datetime, + evidence_versions: Union[List[OwnershipEvidenceVersion], none_type], + explanation: str, + owner_type: OwnershipOwnerType, + sources: List[OwnershipInferenceSource], + status: OwnershipInferenceStatus, + updated_at: datetime, + primary_contact_ref: Union[str, none_type, UnsetType] = unset, + **kwargs, + ): + """ + The attributes of a single ownership inference. + + :param checksum: A checksum that uniquely identifies the current state of the inference. Required when submitting feedback. + :type checksum: str + + :param confidence: The confidence score of the inference, expressed as a numeric string with up to four decimal places. + :type confidence: str + + :param created_at: The time when the inference was created. + :type created_at: datetime + + :param evidence_versions: The list of evidence versions associated with an inference. + :type evidence_versions: [OwnershipEvidenceVersion], none_type + + :param explanation: A human-readable explanation of how the inference was produced. + :type explanation: str + + :param owner_type: The owner type for an ownership inference. + :type owner_type: OwnershipOwnerType + + :param primary_contact_ref: The primary contact reference for the inferred owner, formatted as ``ref:handle/``. + :type primary_contact_ref: str, none_type, optional + + :param sources: The list of sources backing an ownership inference. Empty when the inference status is not whitelisted to expose sources. + :type sources: [OwnershipInferenceSource] + + :param status: The lifecycle status of an ownership inference. + :type status: OwnershipInferenceStatus + + :param updated_at: The time when the inference was last updated. + :type updated_at: datetime + """ + if primary_contact_ref is not unset: + kwargs["primary_contact_ref"] = primary_contact_ref + super().__init__(kwargs) + + self_.checksum = checksum + self_.confidence = confidence + self_.created_at = created_at + self_.evidence_versions = evidence_versions + self_.explanation = explanation + self_.owner_type = owner_type + self_.sources = sources + self_.status = status + self_.updated_at = updated_at diff --git a/src/datadog_api_client/v2/model/ownership_inference_data.py b/src/datadog_api_client/v2/model/ownership_inference_data.py new file mode 100644 index 0000000000..8dcb8cdca7 --- /dev/null +++ b/src/datadog_api_client/v2/model/ownership_inference_data.py @@ -0,0 +1,54 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.ownership_inference_attributes import OwnershipInferenceAttributes + from datadog_api_client.v2.model.ownership_inference_type import OwnershipInferenceType + + +class OwnershipInferenceData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.ownership_inference_attributes import OwnershipInferenceAttributes + from datadog_api_client.v2.model.ownership_inference_type import OwnershipInferenceType + + return { + "attributes": (OwnershipInferenceAttributes,), + "id": (str,), + "type": (OwnershipInferenceType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__(self_, attributes: OwnershipInferenceAttributes, id: str, type: OwnershipInferenceType, **kwargs): + """ + The data wrapper for a single ownership inference response. + + :param attributes: The attributes of a single ownership inference. + :type attributes: OwnershipInferenceAttributes + + :param id: The identifier of the inference, formatted as ``resource_id:owner_type``. + :type id: str + + :param type: The type of the ownership inference resource. The value should always be ``ownership_inference``. + :type type: OwnershipInferenceType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/ownership_inference_item.py b/src/datadog_api_client/v2/model/ownership_inference_item.py new file mode 100644 index 0000000000..b624527d99 --- /dev/null +++ b/src/datadog_api_client/v2/model/ownership_inference_item.py @@ -0,0 +1,125 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + none_type, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.ownership_evidence_version import OwnershipEvidenceVersion + from datadog_api_client.v2.model.ownership_owner_type import OwnershipOwnerType + from datadog_api_client.v2.model.ownership_inference_source import OwnershipInferenceSource + from datadog_api_client.v2.model.ownership_inference_status import OwnershipInferenceStatus + + +class OwnershipInferenceItem(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.ownership_evidence_version import OwnershipEvidenceVersion + from datadog_api_client.v2.model.ownership_owner_type import OwnershipOwnerType + from datadog_api_client.v2.model.ownership_inference_source import OwnershipInferenceSource + from datadog_api_client.v2.model.ownership_inference_status import OwnershipInferenceStatus + + return { + "checksum": (str,), + "confidence": (str,), + "created_at": (datetime,), + "evidence_versions": ([OwnershipEvidenceVersion],), + "explanation": (str,), + "id": (str,), + "owner_type": (OwnershipOwnerType,), + "primary_contact_ref": (str, none_type), + "sources": ([OwnershipInferenceSource],), + "status": (OwnershipInferenceStatus,), + "updated_at": (datetime,), + } + + attribute_map = { + "checksum": "checksum", + "confidence": "confidence", + "created_at": "created_at", + "evidence_versions": "evidence_versions", + "explanation": "explanation", + "id": "id", + "owner_type": "owner_type", + "primary_contact_ref": "primary_contact_ref", + "sources": "sources", + "status": "status", + "updated_at": "updated_at", + } + + def __init__( + self_, + checksum: str, + confidence: str, + created_at: datetime, + evidence_versions: Union[List[OwnershipEvidenceVersion], none_type], + explanation: str, + id: str, + owner_type: OwnershipOwnerType, + sources: List[OwnershipInferenceSource], + status: OwnershipInferenceStatus, + updated_at: datetime, + primary_contact_ref: Union[str, none_type, UnsetType] = unset, + **kwargs, + ): + """ + A single ownership inference, scoped to a specific owner type. + + :param checksum: A checksum that uniquely identifies the current state of the inference. Required when submitting feedback. + :type checksum: str + + :param confidence: The confidence score of the inference, expressed as a numeric string with up to four decimal places. + :type confidence: str + + :param created_at: The time when the inference was created. + :type created_at: datetime + + :param evidence_versions: The list of evidence versions associated with an inference. + :type evidence_versions: [OwnershipEvidenceVersion], none_type + + :param explanation: A human-readable explanation of how the inference was produced. + :type explanation: str + + :param id: The identifier of the inference, formatted as ``resource_id:owner_type``. + :type id: str + + :param owner_type: The owner type for an ownership inference. + :type owner_type: OwnershipOwnerType + + :param primary_contact_ref: The primary contact reference for the inferred owner, formatted as ``ref:handle/``. + :type primary_contact_ref: str, none_type, optional + + :param sources: The list of sources backing an ownership inference. Empty when the inference status is not whitelisted to expose sources. + :type sources: [OwnershipInferenceSource] + + :param status: The lifecycle status of an ownership inference. + :type status: OwnershipInferenceStatus + + :param updated_at: The time when the inference was last updated. + :type updated_at: datetime + """ + if primary_contact_ref is not unset: + kwargs["primary_contact_ref"] = primary_contact_ref + super().__init__(kwargs) + + self_.checksum = checksum + self_.confidence = confidence + self_.created_at = created_at + self_.evidence_versions = evidence_versions + self_.explanation = explanation + self_.id = id + self_.owner_type = owner_type + self_.sources = sources + self_.status = status + self_.updated_at = updated_at diff --git a/src/datadog_api_client/v2/model/ownership_inference_list_attributes.py b/src/datadog_api_client/v2/model/ownership_inference_list_attributes.py new file mode 100644 index 0000000000..2409d84db0 --- /dev/null +++ b/src/datadog_api_client/v2/model/ownership_inference_list_attributes.py @@ -0,0 +1,40 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.ownership_inference_item import OwnershipInferenceItem + + +class OwnershipInferenceListAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.ownership_inference_item import OwnershipInferenceItem + + return { + "items": ([OwnershipInferenceItem],), + } + + attribute_map = { + "items": "items", + } + + def __init__(self_, items: List[OwnershipInferenceItem], **kwargs): + """ + The attributes of the ownership inferences collection response. + + :param items: The list of inferences for a resource, with one inference per owner type. + :type items: [OwnershipInferenceItem] + """ + super().__init__(kwargs) + + self_.items = items diff --git a/src/datadog_api_client/v2/model/ownership_inference_list_data.py b/src/datadog_api_client/v2/model/ownership_inference_list_data.py new file mode 100644 index 0000000000..8051b71a9a --- /dev/null +++ b/src/datadog_api_client/v2/model/ownership_inference_list_data.py @@ -0,0 +1,54 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.ownership_inference_list_attributes import OwnershipInferenceListAttributes + from datadog_api_client.v2.model.ownership_inferences_type import OwnershipInferencesType + + +class OwnershipInferenceListData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.ownership_inference_list_attributes import OwnershipInferenceListAttributes + from datadog_api_client.v2.model.ownership_inferences_type import OwnershipInferencesType + + return { + "attributes": (OwnershipInferenceListAttributes,), + "id": (str,), + "type": (OwnershipInferencesType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__(self_, attributes: OwnershipInferenceListAttributes, id: str, type: OwnershipInferencesType, **kwargs): + """ + The data wrapper for the ownership inferences collection response. + + :param attributes: The attributes of the ownership inferences collection response. + :type attributes: OwnershipInferenceListAttributes + + :param id: The resource identifier associated with the returned inferences. + :type id: str + + :param type: The type of the ownership inferences collection resource. The value should always be ``ownership_inferences``. + :type type: OwnershipInferencesType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/ownership_inference_list_response.py b/src/datadog_api_client/v2/model/ownership_inference_list_response.py new file mode 100644 index 0000000000..42723e7336 --- /dev/null +++ b/src/datadog_api_client/v2/model/ownership_inference_list_response.py @@ -0,0 +1,40 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.ownership_inference_list_data import OwnershipInferenceListData + + +class OwnershipInferenceListResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.ownership_inference_list_data import OwnershipInferenceListData + + return { + "data": (OwnershipInferenceListData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: OwnershipInferenceListData, **kwargs): + """ + The response returned when listing all current ownership inferences for a resource. + + :param data: The data wrapper for the ownership inferences collection response. + :type data: OwnershipInferenceListData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/ownership_inference_response.py b/src/datadog_api_client/v2/model/ownership_inference_response.py new file mode 100644 index 0000000000..e34ca8f20a --- /dev/null +++ b/src/datadog_api_client/v2/model/ownership_inference_response.py @@ -0,0 +1,40 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.ownership_inference_data import OwnershipInferenceData + + +class OwnershipInferenceResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.ownership_inference_data import OwnershipInferenceData + + return { + "data": (OwnershipInferenceData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: OwnershipInferenceData, **kwargs): + """ + The response returned when retrieving a single ownership inference for an owner type. + + :param data: The data wrapper for a single ownership inference response. + :type data: OwnershipInferenceData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/ownership_inference_source.py b/src/datadog_api_client/v2/model/ownership_inference_source.py new file mode 100644 index 0000000000..036d000b04 --- /dev/null +++ b/src/datadog_api_client/v2/model/ownership_inference_source.py @@ -0,0 +1,17 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelNormal, +) + + +class OwnershipInferenceSource(ModelNormal): + def __init__(self_, **kwargs): + """ + A source describing how an inference was derived. + """ + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/ownership_inference_status.py b/src/datadog_api_client/v2/model/ownership_inference_status.py new file mode 100644 index 0000000000..23c3f1ff73 --- /dev/null +++ b/src/datadog_api_client/v2/model/ownership_inference_status.py @@ -0,0 +1,47 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class OwnershipInferenceStatus(ModelSimple): + """ + The lifecycle status of an ownership inference. + + :param value: Must be one of ["suggested", "persisted", "overridden", "failed", "unknown"]. + :type value: str + """ + + allowed_values = { + "suggested", + "persisted", + "overridden", + "failed", + "unknown", + } + SUGGESTED: ClassVar["OwnershipInferenceStatus"] + PERSISTED: ClassVar["OwnershipInferenceStatus"] + OVERRIDDEN: ClassVar["OwnershipInferenceStatus"] + FAILED: ClassVar["OwnershipInferenceStatus"] + UNKNOWN: ClassVar["OwnershipInferenceStatus"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +OwnershipInferenceStatus.SUGGESTED = OwnershipInferenceStatus("suggested") +OwnershipInferenceStatus.PERSISTED = OwnershipInferenceStatus("persisted") +OwnershipInferenceStatus.OVERRIDDEN = OwnershipInferenceStatus("overridden") +OwnershipInferenceStatus.FAILED = OwnershipInferenceStatus("failed") +OwnershipInferenceStatus.UNKNOWN = OwnershipInferenceStatus("unknown") diff --git a/src/datadog_api_client/v2/model/ownership_inference_type.py b/src/datadog_api_client/v2/model/ownership_inference_type.py new file mode 100644 index 0000000000..526e87dc92 --- /dev/null +++ b/src/datadog_api_client/v2/model/ownership_inference_type.py @@ -0,0 +1,35 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class OwnershipInferenceType(ModelSimple): + """ + The type of the ownership inference resource. The value should always be `ownership_inference`. + + :param value: If omitted defaults to "ownership_inference". Must be one of ["ownership_inference"]. + :type value: str + """ + + allowed_values = { + "ownership_inference", + } + OWNERSHIP_INFERENCE: ClassVar["OwnershipInferenceType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +OwnershipInferenceType.OWNERSHIP_INFERENCE = OwnershipInferenceType("ownership_inference") diff --git a/src/datadog_api_client/v2/model/ownership_inferences_type.py b/src/datadog_api_client/v2/model/ownership_inferences_type.py new file mode 100644 index 0000000000..b1ab25b618 --- /dev/null +++ b/src/datadog_api_client/v2/model/ownership_inferences_type.py @@ -0,0 +1,35 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class OwnershipInferencesType(ModelSimple): + """ + The type of the ownership inferences collection resource. The value should always be `ownership_inferences`. + + :param value: If omitted defaults to "ownership_inferences". Must be one of ["ownership_inferences"]. + :type value: str + """ + + allowed_values = { + "ownership_inferences", + } + OWNERSHIP_INFERENCES: ClassVar["OwnershipInferencesType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +OwnershipInferencesType.OWNERSHIP_INFERENCES = OwnershipInferencesType("ownership_inferences") diff --git a/src/datadog_api_client/v2/model/ownership_owner_type.py b/src/datadog_api_client/v2/model/ownership_owner_type.py new file mode 100644 index 0000000000..b1bee47a3a --- /dev/null +++ b/src/datadog_api_client/v2/model/ownership_owner_type.py @@ -0,0 +1,44 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class OwnershipOwnerType(ModelSimple): + """ + The owner type for an ownership inference. + + :param value: Must be one of ["user", "team", "service", "unknown"]. + :type value: str + """ + + allowed_values = { + "user", + "team", + "service", + "unknown", + } + USER: ClassVar["OwnershipOwnerType"] + TEAM: ClassVar["OwnershipOwnerType"] + SERVICE: ClassVar["OwnershipOwnerType"] + UNKNOWN: ClassVar["OwnershipOwnerType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +OwnershipOwnerType.USER = OwnershipOwnerType("user") +OwnershipOwnerType.TEAM = OwnershipOwnerType("team") +OwnershipOwnerType.SERVICE = OwnershipOwnerType("service") +OwnershipOwnerType.UNKNOWN = OwnershipOwnerType("unknown") diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 860f637df7..ad3f108387 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -5750,6 +5750,38 @@ from datadog_api_client.v2.model.output_schema_parameters import OutputSchemaParameters from datadog_api_client.v2.model.output_schema_parameters_type import OutputSchemaParametersType from datadog_api_client.v2.model.overwrite_allocations_request import OverwriteAllocationsRequest +from datadog_api_client.v2.model.ownership_evidence_attributes import OwnershipEvidenceAttributes +from datadog_api_client.v2.model.ownership_evidence_data import OwnershipEvidenceData +from datadog_api_client.v2.model.ownership_evidence_response import OwnershipEvidenceResponse +from datadog_api_client.v2.model.ownership_evidence_type import OwnershipEvidenceType +from datadog_api_client.v2.model.ownership_evidence_version import OwnershipEvidenceVersion +from datadog_api_client.v2.model.ownership_feedback_action import OwnershipFeedbackAction +from datadog_api_client.v2.model.ownership_feedback_request import OwnershipFeedbackRequest +from datadog_api_client.v2.model.ownership_feedback_request_attributes import OwnershipFeedbackRequestAttributes +from datadog_api_client.v2.model.ownership_feedback_request_data import OwnershipFeedbackRequestData +from datadog_api_client.v2.model.ownership_feedback_response import OwnershipFeedbackResponse +from datadog_api_client.v2.model.ownership_feedback_result_attributes import OwnershipFeedbackResultAttributes +from datadog_api_client.v2.model.ownership_feedback_result_data import OwnershipFeedbackResultData +from datadog_api_client.v2.model.ownership_feedback_result_type import OwnershipFeedbackResultType +from datadog_api_client.v2.model.ownership_feedback_type import OwnershipFeedbackType +from datadog_api_client.v2.model.ownership_history_attributes import OwnershipHistoryAttributes +from datadog_api_client.v2.model.ownership_history_data import OwnershipHistoryData +from datadog_api_client.v2.model.ownership_history_item import OwnershipHistoryItem +from datadog_api_client.v2.model.ownership_history_pagination import OwnershipHistoryPagination +from datadog_api_client.v2.model.ownership_history_response import OwnershipHistoryResponse +from datadog_api_client.v2.model.ownership_history_type import OwnershipHistoryType +from datadog_api_client.v2.model.ownership_inference_attributes import OwnershipInferenceAttributes +from datadog_api_client.v2.model.ownership_inference_data import OwnershipInferenceData +from datadog_api_client.v2.model.ownership_inference_item import OwnershipInferenceItem +from datadog_api_client.v2.model.ownership_inference_list_attributes import OwnershipInferenceListAttributes +from datadog_api_client.v2.model.ownership_inference_list_data import OwnershipInferenceListData +from datadog_api_client.v2.model.ownership_inference_list_response import OwnershipInferenceListResponse +from datadog_api_client.v2.model.ownership_inference_response import OwnershipInferenceResponse +from datadog_api_client.v2.model.ownership_inference_source import OwnershipInferenceSource +from datadog_api_client.v2.model.ownership_inference_status import OwnershipInferenceStatus +from datadog_api_client.v2.model.ownership_inference_type import OwnershipInferenceType +from datadog_api_client.v2.model.ownership_inferences_type import OwnershipInferencesType +from datadog_api_client.v2.model.ownership_owner_type import OwnershipOwnerType from datadog_api_client.v2.model.page_annotations_attributes import PageAnnotationsAttributes from datadog_api_client.v2.model.page_annotations_data import PageAnnotationsData from datadog_api_client.v2.model.page_annotations_response import PageAnnotationsResponse @@ -13067,6 +13099,38 @@ "OutputSchemaParameters", "OutputSchemaParametersType", "OverwriteAllocationsRequest", + "OwnershipEvidenceAttributes", + "OwnershipEvidenceData", + "OwnershipEvidenceResponse", + "OwnershipEvidenceType", + "OwnershipEvidenceVersion", + "OwnershipFeedbackAction", + "OwnershipFeedbackRequest", + "OwnershipFeedbackRequestAttributes", + "OwnershipFeedbackRequestData", + "OwnershipFeedbackResponse", + "OwnershipFeedbackResultAttributes", + "OwnershipFeedbackResultData", + "OwnershipFeedbackResultType", + "OwnershipFeedbackType", + "OwnershipHistoryAttributes", + "OwnershipHistoryData", + "OwnershipHistoryItem", + "OwnershipHistoryPagination", + "OwnershipHistoryResponse", + "OwnershipHistoryType", + "OwnershipInferenceAttributes", + "OwnershipInferenceData", + "OwnershipInferenceItem", + "OwnershipInferenceListAttributes", + "OwnershipInferenceListData", + "OwnershipInferenceListResponse", + "OwnershipInferenceResponse", + "OwnershipInferenceSource", + "OwnershipInferenceStatus", + "OwnershipInferenceType", + "OwnershipInferencesType", + "OwnershipOwnerType", "PageAnnotationsAttributes", "PageAnnotationsData", "PageAnnotationsResponse", diff --git a/tests/v2/features/csm_ownership.feature b/tests/v2/features/csm_ownership.feature new file mode 100644 index 0000000000..58498ca155 --- /dev/null +++ b/tests/v2/features/csm_ownership.feature @@ -0,0 +1,165 @@ +@endpoint(csm-ownership) @endpoint(csm-ownership-v2) +Feature: CSM Ownership + Datadog Cloud Security Management (CSM) Ownership infers the most likely + owner for a cloud resource by combining ownership signals from across the + platform, and lets you review the inference, inspect its evidence, and + submit feedback to persist, override, or correct the inferred owner. For + more information, see [Cloud Security Management](https://docs.datadoghq.c + om/security/cloud_security_management). + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "CSMOwnership" API + + @generated @skip @team:DataDog/k9-misconfigs + Scenario: Get an ownership inference by owner type returns "Bad Request" response + Given operation "GetOwnershipInference" enabled + And new "GetOwnershipInference" request + And request contains "resource_id" parameter from "REPLACE.ME" + And request contains "owner_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-misconfigs + Scenario: Get an ownership inference by owner type returns "Not Found" response + Given operation "GetOwnershipInference" enabled + And new "GetOwnershipInference" request + And request contains "resource_id" parameter from "REPLACE.ME" + And request contains "owner_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/k9-misconfigs + Scenario: Get an ownership inference by owner type returns "OK" response + Given operation "GetOwnershipInference" enabled + And new "GetOwnershipInference" request + And request contains "resource_id" parameter from "REPLACE.ME" + And request contains "owner_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/k9-misconfigs + Scenario: Get the evidence for an ownership inference returns "Bad Request" response + Given operation "GetOwnershipEvidence" enabled + And new "GetOwnershipEvidence" request + And request contains "resource_id" parameter from "REPLACE.ME" + And request contains "owner_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-misconfigs + Scenario: Get the evidence for an ownership inference returns "Not Found" response + Given operation "GetOwnershipEvidence" enabled + And new "GetOwnershipEvidence" request + And request contains "resource_id" parameter from "REPLACE.ME" + And request contains "owner_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/k9-misconfigs + Scenario: Get the evidence for an ownership inference returns "OK" response + Given operation "GetOwnershipEvidence" enabled + And new "GetOwnershipEvidence" request + And request contains "resource_id" parameter from "REPLACE.ME" + And request contains "owner_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/k9-misconfigs + Scenario: List ownership history by owner type returns "Bad Request" response + Given operation "ListOwnershipHistoryByOwnerType" enabled + And new "ListOwnershipHistoryByOwnerType" request + And request contains "resource_id" parameter from "REPLACE.ME" + And request contains "owner_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-misconfigs + Scenario: List ownership history by owner type returns "OK" response + Given operation "ListOwnershipHistoryByOwnerType" enabled + And new "ListOwnershipHistoryByOwnerType" request + And request contains "resource_id" parameter from "REPLACE.ME" + And request contains "owner_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/k9-misconfigs + Scenario: List ownership inference history for a resource returns "Bad Request" response + Given operation "ListOwnershipHistory" enabled + And new "ListOwnershipHistory" request + And request contains "resource_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-misconfigs + Scenario: List ownership inference history for a resource returns "OK" response + Given operation "ListOwnershipHistory" enabled + And new "ListOwnershipHistory" request + And request contains "resource_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/k9-misconfigs + Scenario: List ownership inferences for a resource returns "Bad Request" response + Given operation "ListOwnershipInferences" enabled + And new "ListOwnershipInferences" request + And request contains "resource_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-misconfigs + Scenario: List ownership inferences for a resource returns "Not Found" response + Given operation "ListOwnershipInferences" enabled + And new "ListOwnershipInferences" request + And request contains "resource_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/k9-misconfigs + Scenario: List ownership inferences for a resource returns "OK" response + Given operation "ListOwnershipInferences" enabled + And new "ListOwnershipInferences" request + And request contains "resource_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/k9-misconfigs + Scenario: Submit feedback on an ownership inference returns "Bad Request" response + Given operation "CreateOwnershipFeedback" enabled + And new "CreateOwnershipFeedback" request + And request contains "resource_id" parameter from "REPLACE.ME" + And request contains "owner_type" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"action": "confirm", "actor_handle": "user@example.com", "actor_type": "user", "corrected_owner_handle": "team-b", "corrected_owner_type": "team", "inference_checksum": "abc123", "reason": "Confirmed by team lead."}, "type": "ownership_feedback"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-misconfigs + Scenario: Submit feedback on an ownership inference returns "Conflict" response + Given operation "CreateOwnershipFeedback" enabled + And new "CreateOwnershipFeedback" request + And request contains "resource_id" parameter from "REPLACE.ME" + And request contains "owner_type" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"action": "confirm", "actor_handle": "user@example.com", "actor_type": "user", "corrected_owner_handle": "team-b", "corrected_owner_type": "team", "inference_checksum": "abc123", "reason": "Confirmed by team lead."}, "type": "ownership_feedback"}} + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:DataDog/k9-misconfigs + Scenario: Submit feedback on an ownership inference returns "Created" response + Given operation "CreateOwnershipFeedback" enabled + And new "CreateOwnershipFeedback" request + And request contains "resource_id" parameter from "REPLACE.ME" + And request contains "owner_type" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"action": "confirm", "actor_handle": "user@example.com", "actor_type": "user", "corrected_owner_handle": "team-b", "corrected_owner_type": "team", "inference_checksum": "abc123", "reason": "Confirmed by team lead."}, "type": "ownership_feedback"}} + When the request is sent + Then the response status is 201 Created + + @generated @skip @team:DataDog/k9-misconfigs + Scenario: Submit feedback on an ownership inference returns "Not Found" response + Given operation "CreateOwnershipFeedback" enabled + And new "CreateOwnershipFeedback" request + And request contains "resource_id" parameter from "REPLACE.ME" + And request contains "owner_type" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"action": "confirm", "actor_handle": "user@example.com", "actor_type": "user", "corrected_owner_handle": "team-b", "corrected_owner_type": "team", "inference_checksum": "abc123", "reason": "Confirmed by team lead."}, "type": "ownership_feedback"}} + When the request is sent + Then the response status is 404 Not Found diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 64ba52bc40..9ee7b33471 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -2031,6 +2031,42 @@ "type": "safe" } }, + "ListOwnershipInferences": { + "tag": "CSM Ownership", + "undo": { + "type": "safe" + } + }, + "ListOwnershipHistory": { + "tag": "CSM Ownership", + "undo": { + "type": "safe" + } + }, + "GetOwnershipInference": { + "tag": "CSM Ownership", + "undo": { + "type": "safe" + } + }, + "GetOwnershipEvidence": { + "tag": "CSM Ownership", + "undo": { + "type": "safe" + } + }, + "CreateOwnershipFeedback": { + "tag": "CSM Ownership", + "undo": { + "type": "idempotent" + } + }, + "ListOwnershipHistoryByOwnerType": { + "tag": "CSM Ownership", + "undo": { + "type": "safe" + } + }, "ListCSMAgentlessHosts": { "tag": "CSM Settings", "undo": {