From b6a4957d59da7821a9936bd61d7a1d660358169c Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 10 Jun 2026 08:33:48 +0000 Subject: [PATCH] Regenerate client from commit cb0f041 of spec repo --- .generator/schemas/v2/openapi.yaml | 1058 ++++++++++++ .../CreateOwnershipFeedback.java | 47 + .../csm-ownership/GetOwnershipEvidence.java | 27 + .../csm-ownership/GetOwnershipInference.java | 27 + .../csm-ownership/ListOwnershipHistory.java | 25 + .../ListOwnershipHistoryByOwnerType.java | 27 + .../ListOwnershipInferences.java | 25 + .../com/datadog/api/client/ApiClient.java | 6 + .../api/client/v2/api/CsmOwnershipApi.java | 1475 +++++++++++++++++ .../v2/model/OwnershipEvidenceAttributes.java | 155 ++ .../v2/model/OwnershipEvidenceData.java | 210 +++ .../v2/model/OwnershipEvidenceResponse.java | 149 ++ .../v2/model/OwnershipEvidenceType.java | 59 + .../v2/model/OwnershipFeedbackAction.java | 59 + .../v2/model/OwnershipFeedbackRequest.java | 146 ++ .../OwnershipFeedbackRequestAttributes.java | 364 ++++ .../model/OwnershipFeedbackRequestData.java | 183 ++ .../v2/model/OwnershipFeedbackResponse.java | 146 ++ .../OwnershipFeedbackResultAttributes.java | 358 ++++ .../v2/model/OwnershipFeedbackResultData.java | 211 +++ .../v2/model/OwnershipFeedbackResultType.java | 60 + .../v2/model/OwnershipFeedbackType.java | 59 + .../v2/model/OwnershipHistoryAttributes.java | 188 +++ .../client/v2/model/OwnershipHistoryData.java | 210 +++ .../client/v2/model/OwnershipHistoryItem.java | 592 +++++++ .../v2/model/OwnershipHistoryPagination.java | 185 +++ .../v2/model/OwnershipHistoryResponse.java | 145 ++ .../client/v2/model/OwnershipHistoryType.java | 59 + .../model/OwnershipInferenceAttributes.java | 451 +++++ .../v2/model/OwnershipInferenceData.java | 210 +++ .../v2/model/OwnershipInferenceItem.java | 478 ++++++ .../OwnershipInferenceListAttributes.java | 157 ++ .../v2/model/OwnershipInferenceListData.java | 211 +++ .../model/OwnershipInferenceListResponse.java | 147 ++ .../v2/model/OwnershipInferenceResponse.java | 146 ++ .../v2/model/OwnershipInferenceStatus.java | 64 + .../v2/model/OwnershipInferenceType.java | 60 + .../v2/model/OwnershipInferencesType.java | 60 + .../client/v2/model/OwnershipOwnerType.java | 57 + .../api/client/v2/api/csm_ownership.feature | 165 ++ .../com/datadog/api/client/v2/api/undo.json | 36 + 41 files changed, 8497 insertions(+) create mode 100644 examples/v2/csm-ownership/CreateOwnershipFeedback.java create mode 100644 examples/v2/csm-ownership/GetOwnershipEvidence.java create mode 100644 examples/v2/csm-ownership/GetOwnershipInference.java create mode 100644 examples/v2/csm-ownership/ListOwnershipHistory.java create mode 100644 examples/v2/csm-ownership/ListOwnershipHistoryByOwnerType.java create mode 100644 examples/v2/csm-ownership/ListOwnershipInferences.java create mode 100644 src/main/java/com/datadog/api/client/v2/api/CsmOwnershipApi.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/OwnershipEvidenceAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/OwnershipEvidenceData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/OwnershipEvidenceResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/OwnershipEvidenceType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/OwnershipFeedbackAction.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/OwnershipFeedbackRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/OwnershipFeedbackRequestAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/OwnershipFeedbackRequestData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/OwnershipFeedbackResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/OwnershipFeedbackResultAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/OwnershipFeedbackResultData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/OwnershipFeedbackResultType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/OwnershipFeedbackType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/OwnershipHistoryAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/OwnershipHistoryData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/OwnershipHistoryItem.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/OwnershipHistoryPagination.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/OwnershipHistoryResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/OwnershipHistoryType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/OwnershipInferenceAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/OwnershipInferenceData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/OwnershipInferenceItem.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/OwnershipInferenceListAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/OwnershipInferenceListData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/OwnershipInferenceListResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/OwnershipInferenceResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/OwnershipInferenceStatus.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/OwnershipInferenceType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/OwnershipInferencesType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/OwnershipOwnerType.java create mode 100644 src/test/resources/com/datadog/api/client/v2/api/csm_ownership.feature diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 134a7ef0ee8..b0d9d61d134 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/examples/v2/csm-ownership/CreateOwnershipFeedback.java b/examples/v2/csm-ownership/CreateOwnershipFeedback.java new file mode 100644 index 00000000000..3038b405394 --- /dev/null +++ b/examples/v2/csm-ownership/CreateOwnershipFeedback.java @@ -0,0 +1,47 @@ +// Submit feedback on an ownership inference returns "Created" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.CsmOwnershipApi; +import com.datadog.api.client.v2.model.OwnershipFeedbackAction; +import com.datadog.api.client.v2.model.OwnershipFeedbackRequest; +import com.datadog.api.client.v2.model.OwnershipFeedbackRequestAttributes; +import com.datadog.api.client.v2.model.OwnershipFeedbackRequestData; +import com.datadog.api.client.v2.model.OwnershipFeedbackResponse; +import com.datadog.api.client.v2.model.OwnershipFeedbackType; +import com.datadog.api.client.v2.model.OwnershipOwnerType; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.createOwnershipFeedback", true); + CsmOwnershipApi apiInstance = new CsmOwnershipApi(defaultClient); + + OwnershipFeedbackRequest body = + new OwnershipFeedbackRequest() + .data( + new OwnershipFeedbackRequestData() + .attributes( + new OwnershipFeedbackRequestAttributes() + .action(OwnershipFeedbackAction.CONFIRM) + .actorHandle("user@example.com") + .actorType("user") + .correctedOwnerHandle("team-b") + .correctedOwnerType("team") + .inferenceChecksum("abc123") + .reason("Confirmed by team lead.")) + .type(OwnershipFeedbackType.OWNERSHIP_FEEDBACK)); + + try { + OwnershipFeedbackResponse result = + apiInstance.createOwnershipFeedback("res-1", OwnershipOwnerType.TEAM, body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CsmOwnershipApi#createOwnershipFeedback"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/csm-ownership/GetOwnershipEvidence.java b/examples/v2/csm-ownership/GetOwnershipEvidence.java new file mode 100644 index 00000000000..9c76f6f7afd --- /dev/null +++ b/examples/v2/csm-ownership/GetOwnershipEvidence.java @@ -0,0 +1,27 @@ +// Get the evidence for an ownership inference returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.CsmOwnershipApi; +import com.datadog.api.client.v2.model.OwnershipEvidenceResponse; +import com.datadog.api.client.v2.model.OwnershipOwnerType; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getOwnershipEvidence", true); + CsmOwnershipApi apiInstance = new CsmOwnershipApi(defaultClient); + + try { + OwnershipEvidenceResponse result = + apiInstance.getOwnershipEvidence("test-resource", OwnershipOwnerType.TEAM); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CsmOwnershipApi#getOwnershipEvidence"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/csm-ownership/GetOwnershipInference.java b/examples/v2/csm-ownership/GetOwnershipInference.java new file mode 100644 index 00000000000..7b0989237f2 --- /dev/null +++ b/examples/v2/csm-ownership/GetOwnershipInference.java @@ -0,0 +1,27 @@ +// Get an ownership inference by owner type returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.CsmOwnershipApi; +import com.datadog.api.client.v2.model.OwnershipInferenceResponse; +import com.datadog.api.client.v2.model.OwnershipOwnerType; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getOwnershipInference", true); + CsmOwnershipApi apiInstance = new CsmOwnershipApi(defaultClient); + + try { + OwnershipInferenceResponse result = + apiInstance.getOwnershipInference("test-resource", OwnershipOwnerType.TEAM); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CsmOwnershipApi#getOwnershipInference"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/csm-ownership/ListOwnershipHistory.java b/examples/v2/csm-ownership/ListOwnershipHistory.java new file mode 100644 index 00000000000..5b9c23a1e23 --- /dev/null +++ b/examples/v2/csm-ownership/ListOwnershipHistory.java @@ -0,0 +1,25 @@ +// List ownership inference history for a resource returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.CsmOwnershipApi; +import com.datadog.api.client.v2.model.OwnershipHistoryResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.listOwnershipHistory", true); + CsmOwnershipApi apiInstance = new CsmOwnershipApi(defaultClient); + + try { + OwnershipHistoryResponse result = apiInstance.listOwnershipHistory("res-1"); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CsmOwnershipApi#listOwnershipHistory"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/csm-ownership/ListOwnershipHistoryByOwnerType.java b/examples/v2/csm-ownership/ListOwnershipHistoryByOwnerType.java new file mode 100644 index 00000000000..5c28017cdeb --- /dev/null +++ b/examples/v2/csm-ownership/ListOwnershipHistoryByOwnerType.java @@ -0,0 +1,27 @@ +// List ownership history by owner type returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.CsmOwnershipApi; +import com.datadog.api.client.v2.model.OwnershipHistoryResponse; +import com.datadog.api.client.v2.model.OwnershipOwnerType; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.listOwnershipHistoryByOwnerType", true); + CsmOwnershipApi apiInstance = new CsmOwnershipApi(defaultClient); + + try { + OwnershipHistoryResponse result = + apiInstance.listOwnershipHistoryByOwnerType("res-1", OwnershipOwnerType.TEAM); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CsmOwnershipApi#listOwnershipHistoryByOwnerType"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/csm-ownership/ListOwnershipInferences.java b/examples/v2/csm-ownership/ListOwnershipInferences.java new file mode 100644 index 00000000000..a89248f787e --- /dev/null +++ b/examples/v2/csm-ownership/ListOwnershipInferences.java @@ -0,0 +1,25 @@ +// List ownership inferences for a resource returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.CsmOwnershipApi; +import com.datadog.api.client.v2.model.OwnershipInferenceListResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.listOwnershipInferences", true); + CsmOwnershipApi apiInstance = new CsmOwnershipApi(defaultClient); + + try { + OwnershipInferenceListResponse result = apiInstance.listOwnershipInferences("test-resource"); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CsmOwnershipApi#listOwnershipInferences"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/ApiClient.java b/src/main/java/com/datadog/api/client/ApiClient.java index d60f627c77e..4c38f9803cb 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -972,6 +972,12 @@ public class ApiClient { put("v2.listCostTagMetadataMonths", false); put("v2.listCostTagMetadataOrchestrators", false); put("v2.searchCostRecommendations", false); + put("v2.createOwnershipFeedback", false); + put("v2.getOwnershipEvidence", false); + put("v2.getOwnershipInference", false); + put("v2.listOwnershipHistory", false); + put("v2.listOwnershipHistoryByOwnerType", false); + put("v2.listOwnershipInferences", false); put("v2.getCSMAgentlessHostFacetInfo", false); put("v2.getCSMUnifiedHostFacetInfo", false); put("v2.listCSMAgentlessHostFacets", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/CsmOwnershipApi.java b/src/main/java/com/datadog/api/client/v2/api/CsmOwnershipApi.java new file mode 100644 index 00000000000..274a5db9624 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/CsmOwnershipApi.java @@ -0,0 +1,1475 @@ +package com.datadog.api.client.v2.api; + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.ApiResponse; +import com.datadog.api.client.Pair; +import com.datadog.api.client.v2.model.OwnershipEvidenceResponse; +import com.datadog.api.client.v2.model.OwnershipFeedbackRequest; +import com.datadog.api.client.v2.model.OwnershipFeedbackResponse; +import com.datadog.api.client.v2.model.OwnershipHistoryResponse; +import com.datadog.api.client.v2.model.OwnershipInferenceListResponse; +import com.datadog.api.client.v2.model.OwnershipInferenceResponse; +import com.datadog.api.client.v2.model.OwnershipOwnerType; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.core.GenericType; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CsmOwnershipApi { + private ApiClient apiClient; + + public CsmOwnershipApi() { + this(ApiClient.getDefaultApiClient()); + } + + public CsmOwnershipApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API client. + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API client. + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Submit feedback on an ownership inference. + * + *

See {@link #createOwnershipFeedbackWithHttpInfo}. + * + * @param resourceId The identifier of the resource that the feedback applies to. (required) + * @param ownerType The type of owner that the feedback applies to. (required) + * @param body (required) + * @return OwnershipFeedbackResponse + * @throws ApiException if fails to make API call + */ + public OwnershipFeedbackResponse createOwnershipFeedback( + String resourceId, OwnershipOwnerType ownerType, OwnershipFeedbackRequest body) + throws ApiException { + return createOwnershipFeedbackWithHttpInfo(resourceId, ownerType, body).getData(); + } + + /** + * Submit feedback on an ownership inference. + * + *

See {@link #createOwnershipFeedbackWithHttpInfoAsync}. + * + * @param resourceId The identifier of the resource that the feedback applies to. (required) + * @param ownerType The type of owner that the feedback applies to. (required) + * @param body (required) + * @return CompletableFuture<OwnershipFeedbackResponse> + */ + public CompletableFuture createOwnershipFeedbackAsync( + String resourceId, OwnershipOwnerType ownerType, OwnershipFeedbackRequest body) { + return createOwnershipFeedbackWithHttpInfoAsync(resourceId, ownerType, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * 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 resourceId The identifier of the resource that the feedback applies to. (required) + * @param ownerType The type of owner that the feedback applies to. (required) + * @param body (required) + * @return ApiResponse<OwnershipFeedbackResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
201 Created -
400 Bad Request -
401 Unauthorized -
404 Not Found -
409 Conflict -
429 Too many requests -
+ */ + public ApiResponse createOwnershipFeedbackWithHttpInfo( + String resourceId, OwnershipOwnerType ownerType, OwnershipFeedbackRequest body) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "createOwnershipFeedback"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'resourceId' is set + if (resourceId == null) { + throw new ApiException( + 400, "Missing the required parameter 'resourceId' when calling createOwnershipFeedback"); + } + + // verify the required parameter 'ownerType' is set + if (ownerType == null) { + throw new ApiException( + 400, "Missing the required parameter 'ownerType' when calling createOwnershipFeedback"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling createOwnershipFeedback"); + } + // create path and map variables + String localVarPath = + "/api/v2/csm/ownership/{resource_id}/{owner_type}/feedback" + .replaceAll( + "\\{" + "resource_id" + "\\}", apiClient.escapeString(resourceId.toString())) + .replaceAll("\\{" + "owner_type" + "\\}", apiClient.escapeString(ownerType.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.CsmOwnershipApi.createOwnershipFeedback", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Submit feedback on an ownership inference. + * + *

See {@link #createOwnershipFeedbackWithHttpInfo}. + * + * @param resourceId The identifier of the resource that the feedback applies to. (required) + * @param ownerType The type of owner that the feedback applies to. (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<OwnershipFeedbackResponse>> + */ + public CompletableFuture> + createOwnershipFeedbackWithHttpInfoAsync( + String resourceId, OwnershipOwnerType ownerType, OwnershipFeedbackRequest body) { + // Check if unstable operation is enabled + String operationId = "createOwnershipFeedback"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = body; + + // verify the required parameter 'resourceId' is set + if (resourceId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'resourceId' when calling createOwnershipFeedback")); + return result; + } + + // verify the required parameter 'ownerType' is set + if (ownerType == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'ownerType' when calling createOwnershipFeedback")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling createOwnershipFeedback")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/csm/ownership/{resource_id}/{owner_type}/feedback" + .replaceAll( + "\\{" + "resource_id" + "\\}", apiClient.escapeString(resourceId.toString())) + .replaceAll("\\{" + "owner_type" + "\\}", apiClient.escapeString(ownerType.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.CsmOwnershipApi.createOwnershipFeedback", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** Manage optional parameters to getOwnershipEvidence. */ + public static class GetOwnershipEvidenceOptionalParameters { + private String ifNoneMatch; + + /** + * Set ifNoneMatch. + * + * @param ifNoneMatch A previously returned weak ETag value. When supplied and the + * evidence has not changed, the endpoint returns 304 Not Modified. (optional) + * @return GetOwnershipEvidenceOptionalParameters + */ + public GetOwnershipEvidenceOptionalParameters ifNoneMatch(String ifNoneMatch) { + this.ifNoneMatch = ifNoneMatch; + return this; + } + } + + /** + * Get the evidence for an ownership inference. + * + *

See {@link #getOwnershipEvidenceWithHttpInfo}. + * + * @param resourceId The identifier of the resource to retrieve evidence for. (required) + * @param ownerType The owner type of the inference to retrieve evidence for. (required) + * @return OwnershipEvidenceResponse + * @throws ApiException if fails to make API call + */ + public OwnershipEvidenceResponse getOwnershipEvidence( + String resourceId, OwnershipOwnerType ownerType) throws ApiException { + return getOwnershipEvidenceWithHttpInfo( + resourceId, ownerType, new GetOwnershipEvidenceOptionalParameters()) + .getData(); + } + + /** + * Get the evidence for an ownership inference. + * + *

See {@link #getOwnershipEvidenceWithHttpInfoAsync}. + * + * @param resourceId The identifier of the resource to retrieve evidence for. (required) + * @param ownerType The owner type of the inference to retrieve evidence for. (required) + * @return CompletableFuture<OwnershipEvidenceResponse> + */ + public CompletableFuture getOwnershipEvidenceAsync( + String resourceId, OwnershipOwnerType ownerType) { + return getOwnershipEvidenceWithHttpInfoAsync( + resourceId, ownerType, new GetOwnershipEvidenceOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get the evidence for an ownership inference. + * + *

See {@link #getOwnershipEvidenceWithHttpInfo}. + * + * @param resourceId The identifier of the resource to retrieve evidence for. (required) + * @param ownerType The owner type of the inference to retrieve evidence for. (required) + * @param parameters Optional parameters for the request. + * @return OwnershipEvidenceResponse + * @throws ApiException if fails to make API call + */ + public OwnershipEvidenceResponse getOwnershipEvidence( + String resourceId, + OwnershipOwnerType ownerType, + GetOwnershipEvidenceOptionalParameters parameters) + throws ApiException { + return getOwnershipEvidenceWithHttpInfo(resourceId, ownerType, parameters).getData(); + } + + /** + * Get the evidence for an ownership inference. + * + *

See {@link #getOwnershipEvidenceWithHttpInfoAsync}. + * + * @param resourceId The identifier of the resource to retrieve evidence for. (required) + * @param ownerType The owner type of the inference to retrieve evidence for. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<OwnershipEvidenceResponse> + */ + public CompletableFuture getOwnershipEvidenceAsync( + String resourceId, + OwnershipOwnerType ownerType, + GetOwnershipEvidenceOptionalParameters parameters) { + return getOwnershipEvidenceWithHttpInfoAsync(resourceId, ownerType, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * 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 resourceId The identifier of the resource to retrieve evidence for. (required) + * @param ownerType The owner type of the inference to retrieve evidence for. (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<OwnershipEvidenceResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse getOwnershipEvidenceWithHttpInfo( + String resourceId, + OwnershipOwnerType ownerType, + GetOwnershipEvidenceOptionalParameters parameters) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "getOwnershipEvidence"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'resourceId' is set + if (resourceId == null) { + throw new ApiException( + 400, "Missing the required parameter 'resourceId' when calling getOwnershipEvidence"); + } + + // verify the required parameter 'ownerType' is set + if (ownerType == null) { + throw new ApiException( + 400, "Missing the required parameter 'ownerType' when calling getOwnershipEvidence"); + } + String ifNoneMatch = parameters.ifNoneMatch; + // create path and map variables + String localVarPath = + "/api/v2/csm/ownership/{resource_id}/{owner_type}/evidence" + .replaceAll( + "\\{" + "resource_id" + "\\}", apiClient.escapeString(resourceId.toString())) + .replaceAll("\\{" + "owner_type" + "\\}", apiClient.escapeString(ownerType.toString())); + + Map localVarHeaderParams = new HashMap(); + + if (ifNoneMatch != null) { + localVarHeaderParams.put("If-None-Match", apiClient.parameterToString(ifNoneMatch)); + } + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.CsmOwnershipApi.getOwnershipEvidence", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get the evidence for an ownership inference. + * + *

See {@link #getOwnershipEvidenceWithHttpInfo}. + * + * @param resourceId The identifier of the resource to retrieve evidence for. (required) + * @param ownerType The owner type of the inference to retrieve evidence for. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<OwnershipEvidenceResponse>> + */ + public CompletableFuture> + getOwnershipEvidenceWithHttpInfoAsync( + String resourceId, + OwnershipOwnerType ownerType, + GetOwnershipEvidenceOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "getOwnershipEvidence"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'resourceId' is set + if (resourceId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'resourceId' when calling getOwnershipEvidence")); + return result; + } + + // verify the required parameter 'ownerType' is set + if (ownerType == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'ownerType' when calling getOwnershipEvidence")); + return result; + } + String ifNoneMatch = parameters.ifNoneMatch; + // create path and map variables + String localVarPath = + "/api/v2/csm/ownership/{resource_id}/{owner_type}/evidence" + .replaceAll( + "\\{" + "resource_id" + "\\}", apiClient.escapeString(resourceId.toString())) + .replaceAll("\\{" + "owner_type" + "\\}", apiClient.escapeString(ownerType.toString())); + + Map localVarHeaderParams = new HashMap(); + + if (ifNoneMatch != null) { + localVarHeaderParams.put("If-None-Match", apiClient.parameterToString(ifNoneMatch)); + } + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.CsmOwnershipApi.getOwnershipEvidence", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** Manage optional parameters to getOwnershipInference. */ + public static class GetOwnershipInferenceOptionalParameters { + private String ifNoneMatch; + + /** + * Set ifNoneMatch. + * + * @param ifNoneMatch A previously returned ETag value. When supplied and the + * resource has not changed, the endpoint returns 304 Not Modified. (optional) + * @return GetOwnershipInferenceOptionalParameters + */ + public GetOwnershipInferenceOptionalParameters ifNoneMatch(String ifNoneMatch) { + this.ifNoneMatch = ifNoneMatch; + return this; + } + } + + /** + * Get an ownership inference by owner type. + * + *

See {@link #getOwnershipInferenceWithHttpInfo}. + * + * @param resourceId The identifier of the resource to retrieve the ownership inference for. + * (required) + * @param ownerType The owner type of the inference to retrieve. (required) + * @return OwnershipInferenceResponse + * @throws ApiException if fails to make API call + */ + public OwnershipInferenceResponse getOwnershipInference( + String resourceId, OwnershipOwnerType ownerType) throws ApiException { + return getOwnershipInferenceWithHttpInfo( + resourceId, ownerType, new GetOwnershipInferenceOptionalParameters()) + .getData(); + } + + /** + * Get an ownership inference by owner type. + * + *

See {@link #getOwnershipInferenceWithHttpInfoAsync}. + * + * @param resourceId The identifier of the resource to retrieve the ownership inference for. + * (required) + * @param ownerType The owner type of the inference to retrieve. (required) + * @return CompletableFuture<OwnershipInferenceResponse> + */ + public CompletableFuture getOwnershipInferenceAsync( + String resourceId, OwnershipOwnerType ownerType) { + return getOwnershipInferenceWithHttpInfoAsync( + resourceId, ownerType, new GetOwnershipInferenceOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get an ownership inference by owner type. + * + *

See {@link #getOwnershipInferenceWithHttpInfo}. + * + * @param resourceId The identifier of the resource to retrieve the ownership inference for. + * (required) + * @param ownerType The owner type of the inference to retrieve. (required) + * @param parameters Optional parameters for the request. + * @return OwnershipInferenceResponse + * @throws ApiException if fails to make API call + */ + public OwnershipInferenceResponse getOwnershipInference( + String resourceId, + OwnershipOwnerType ownerType, + GetOwnershipInferenceOptionalParameters parameters) + throws ApiException { + return getOwnershipInferenceWithHttpInfo(resourceId, ownerType, parameters).getData(); + } + + /** + * Get an ownership inference by owner type. + * + *

See {@link #getOwnershipInferenceWithHttpInfoAsync}. + * + * @param resourceId The identifier of the resource to retrieve the ownership inference for. + * (required) + * @param ownerType The owner type of the inference to retrieve. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<OwnershipInferenceResponse> + */ + public CompletableFuture getOwnershipInferenceAsync( + String resourceId, + OwnershipOwnerType ownerType, + GetOwnershipInferenceOptionalParameters parameters) { + return getOwnershipInferenceWithHttpInfoAsync(resourceId, ownerType, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * 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 resourceId The identifier of the resource to retrieve the ownership inference for. + * (required) + * @param ownerType The owner type of the inference to retrieve. (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<OwnershipInferenceResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse getOwnershipInferenceWithHttpInfo( + String resourceId, + OwnershipOwnerType ownerType, + GetOwnershipInferenceOptionalParameters parameters) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "getOwnershipInference"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'resourceId' is set + if (resourceId == null) { + throw new ApiException( + 400, "Missing the required parameter 'resourceId' when calling getOwnershipInference"); + } + + // verify the required parameter 'ownerType' is set + if (ownerType == null) { + throw new ApiException( + 400, "Missing the required parameter 'ownerType' when calling getOwnershipInference"); + } + String ifNoneMatch = parameters.ifNoneMatch; + // create path and map variables + String localVarPath = + "/api/v2/csm/ownership/{resource_id}/{owner_type}" + .replaceAll( + "\\{" + "resource_id" + "\\}", apiClient.escapeString(resourceId.toString())) + .replaceAll("\\{" + "owner_type" + "\\}", apiClient.escapeString(ownerType.toString())); + + Map localVarHeaderParams = new HashMap(); + + if (ifNoneMatch != null) { + localVarHeaderParams.put("If-None-Match", apiClient.parameterToString(ifNoneMatch)); + } + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.CsmOwnershipApi.getOwnershipInference", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get an ownership inference by owner type. + * + *

See {@link #getOwnershipInferenceWithHttpInfo}. + * + * @param resourceId The identifier of the resource to retrieve the ownership inference for. + * (required) + * @param ownerType The owner type of the inference to retrieve. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<OwnershipInferenceResponse>> + */ + public CompletableFuture> + getOwnershipInferenceWithHttpInfoAsync( + String resourceId, + OwnershipOwnerType ownerType, + GetOwnershipInferenceOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "getOwnershipInference"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'resourceId' is set + if (resourceId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'resourceId' when calling getOwnershipInference")); + return result; + } + + // verify the required parameter 'ownerType' is set + if (ownerType == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'ownerType' when calling getOwnershipInference")); + return result; + } + String ifNoneMatch = parameters.ifNoneMatch; + // create path and map variables + String localVarPath = + "/api/v2/csm/ownership/{resource_id}/{owner_type}" + .replaceAll( + "\\{" + "resource_id" + "\\}", apiClient.escapeString(resourceId.toString())) + .replaceAll("\\{" + "owner_type" + "\\}", apiClient.escapeString(ownerType.toString())); + + Map localVarHeaderParams = new HashMap(); + + if (ifNoneMatch != null) { + localVarHeaderParams.put("If-None-Match", apiClient.parameterToString(ifNoneMatch)); + } + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.CsmOwnershipApi.getOwnershipInference", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** Manage optional parameters to listOwnershipHistory. */ + public static class ListOwnershipHistoryOptionalParameters { + private String cursor; + private Integer limit; + + /** + * Set cursor. + * + * @param cursor An opaque, base64-encoded cursor token returned by a previous call in + * pagination.next_cursor. Omit to fetch the first page. (optional) + * @return ListOwnershipHistoryOptionalParameters + */ + public ListOwnershipHistoryOptionalParameters cursor(String cursor) { + this.cursor = cursor; + return this; + } + + /** + * Set limit. + * + * @param limit The maximum number of history entries to return per page. (optional, default to + * 25) + * @return ListOwnershipHistoryOptionalParameters + */ + public ListOwnershipHistoryOptionalParameters limit(Integer limit) { + this.limit = limit; + return this; + } + } + + /** + * List ownership inference history for a resource. + * + *

See {@link #listOwnershipHistoryWithHttpInfo}. + * + * @param resourceId The identifier of the resource to retrieve inference history for. (required) + * @return OwnershipHistoryResponse + * @throws ApiException if fails to make API call + */ + public OwnershipHistoryResponse listOwnershipHistory(String resourceId) throws ApiException { + return listOwnershipHistoryWithHttpInfo( + resourceId, new ListOwnershipHistoryOptionalParameters()) + .getData(); + } + + /** + * List ownership inference history for a resource. + * + *

See {@link #listOwnershipHistoryWithHttpInfoAsync}. + * + * @param resourceId The identifier of the resource to retrieve inference history for. (required) + * @return CompletableFuture<OwnershipHistoryResponse> + */ + public CompletableFuture listOwnershipHistoryAsync(String resourceId) { + return listOwnershipHistoryWithHttpInfoAsync( + resourceId, new ListOwnershipHistoryOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List ownership inference history for a resource. + * + *

See {@link #listOwnershipHistoryWithHttpInfo}. + * + * @param resourceId The identifier of the resource to retrieve inference history for. (required) + * @param parameters Optional parameters for the request. + * @return OwnershipHistoryResponse + * @throws ApiException if fails to make API call + */ + public OwnershipHistoryResponse listOwnershipHistory( + String resourceId, ListOwnershipHistoryOptionalParameters parameters) throws ApiException { + return listOwnershipHistoryWithHttpInfo(resourceId, parameters).getData(); + } + + /** + * List ownership inference history for a resource. + * + *

See {@link #listOwnershipHistoryWithHttpInfoAsync}. + * + * @param resourceId The identifier of the resource to retrieve inference history for. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<OwnershipHistoryResponse> + */ + public CompletableFuture listOwnershipHistoryAsync( + String resourceId, ListOwnershipHistoryOptionalParameters parameters) { + return listOwnershipHistoryWithHttpInfoAsync(resourceId, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List inference history entries for a resource across all owner types, ordered from most recent + * to oldest. Uses cursor-based pagination. + * + * @param resourceId The identifier of the resource to retrieve inference history for. (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<OwnershipHistoryResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
429 Too many requests -
+ */ + public ApiResponse listOwnershipHistoryWithHttpInfo( + String resourceId, ListOwnershipHistoryOptionalParameters parameters) throws ApiException { + // Check if unstable operation is enabled + String operationId = "listOwnershipHistory"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'resourceId' is set + if (resourceId == null) { + throw new ApiException( + 400, "Missing the required parameter 'resourceId' when calling listOwnershipHistory"); + } + String cursor = parameters.cursor; + Integer limit = parameters.limit; + // create path and map variables + String localVarPath = + "/api/v2/csm/ownership/{resource_id}/history" + .replaceAll( + "\\{" + "resource_id" + "\\}", apiClient.escapeString(resourceId.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.CsmOwnershipApi.listOwnershipHistory", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List ownership inference history for a resource. + * + *

See {@link #listOwnershipHistoryWithHttpInfo}. + * + * @param resourceId The identifier of the resource to retrieve inference history for. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<OwnershipHistoryResponse>> + */ + public CompletableFuture> + listOwnershipHistoryWithHttpInfoAsync( + String resourceId, ListOwnershipHistoryOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "listOwnershipHistory"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'resourceId' is set + if (resourceId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'resourceId' when calling listOwnershipHistory")); + return result; + } + String cursor = parameters.cursor; + Integer limit = parameters.limit; + // create path and map variables + String localVarPath = + "/api/v2/csm/ownership/{resource_id}/history" + .replaceAll( + "\\{" + "resource_id" + "\\}", apiClient.escapeString(resourceId.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.CsmOwnershipApi.listOwnershipHistory", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** Manage optional parameters to listOwnershipHistoryByOwnerType. */ + public static class ListOwnershipHistoryByOwnerTypeOptionalParameters { + private String cursor; + private Integer limit; + + /** + * Set cursor. + * + * @param cursor An opaque, base64-encoded cursor token returned by a previous call in + * pagination.next_cursor. Omit to fetch the first page. (optional) + * @return ListOwnershipHistoryByOwnerTypeOptionalParameters + */ + public ListOwnershipHistoryByOwnerTypeOptionalParameters cursor(String cursor) { + this.cursor = cursor; + return this; + } + + /** + * Set limit. + * + * @param limit The maximum number of history entries to return per page. (optional, default to + * 25) + * @return ListOwnershipHistoryByOwnerTypeOptionalParameters + */ + public ListOwnershipHistoryByOwnerTypeOptionalParameters limit(Integer limit) { + this.limit = limit; + return this; + } + } + + /** + * List ownership history by owner type. + * + *

See {@link #listOwnershipHistoryByOwnerTypeWithHttpInfo}. + * + * @param resourceId The identifier of the resource to retrieve inference history for. (required) + * @param ownerType The owner type to filter history by. (required) + * @return OwnershipHistoryResponse + * @throws ApiException if fails to make API call + */ + public OwnershipHistoryResponse listOwnershipHistoryByOwnerType( + String resourceId, OwnershipOwnerType ownerType) throws ApiException { + return listOwnershipHistoryByOwnerTypeWithHttpInfo( + resourceId, ownerType, new ListOwnershipHistoryByOwnerTypeOptionalParameters()) + .getData(); + } + + /** + * List ownership history by owner type. + * + *

See {@link #listOwnershipHistoryByOwnerTypeWithHttpInfoAsync}. + * + * @param resourceId The identifier of the resource to retrieve inference history for. (required) + * @param ownerType The owner type to filter history by. (required) + * @return CompletableFuture<OwnershipHistoryResponse> + */ + public CompletableFuture listOwnershipHistoryByOwnerTypeAsync( + String resourceId, OwnershipOwnerType ownerType) { + return listOwnershipHistoryByOwnerTypeWithHttpInfoAsync( + resourceId, ownerType, new ListOwnershipHistoryByOwnerTypeOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List ownership history by owner type. + * + *

See {@link #listOwnershipHistoryByOwnerTypeWithHttpInfo}. + * + * @param resourceId The identifier of the resource to retrieve inference history for. (required) + * @param ownerType The owner type to filter history by. (required) + * @param parameters Optional parameters for the request. + * @return OwnershipHistoryResponse + * @throws ApiException if fails to make API call + */ + public OwnershipHistoryResponse listOwnershipHistoryByOwnerType( + String resourceId, + OwnershipOwnerType ownerType, + ListOwnershipHistoryByOwnerTypeOptionalParameters parameters) + throws ApiException { + return listOwnershipHistoryByOwnerTypeWithHttpInfo(resourceId, ownerType, parameters).getData(); + } + + /** + * List ownership history by owner type. + * + *

See {@link #listOwnershipHistoryByOwnerTypeWithHttpInfoAsync}. + * + * @param resourceId The identifier of the resource to retrieve inference history for. (required) + * @param ownerType The owner type to filter history by. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<OwnershipHistoryResponse> + */ + public CompletableFuture listOwnershipHistoryByOwnerTypeAsync( + String resourceId, + OwnershipOwnerType ownerType, + ListOwnershipHistoryByOwnerTypeOptionalParameters parameters) { + return listOwnershipHistoryByOwnerTypeWithHttpInfoAsync(resourceId, ownerType, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List inference history entries for a resource filtered by owner type, ordered from most recent + * to oldest. Uses cursor-based pagination. + * + * @param resourceId The identifier of the resource to retrieve inference history for. (required) + * @param ownerType The owner type to filter history by. (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<OwnershipHistoryResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
429 Too many requests -
+ */ + public ApiResponse listOwnershipHistoryByOwnerTypeWithHttpInfo( + String resourceId, + OwnershipOwnerType ownerType, + ListOwnershipHistoryByOwnerTypeOptionalParameters parameters) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "listOwnershipHistoryByOwnerType"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'resourceId' is set + if (resourceId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'resourceId' when calling" + + " listOwnershipHistoryByOwnerType"); + } + + // verify the required parameter 'ownerType' is set + if (ownerType == null) { + throw new ApiException( + 400, + "Missing the required parameter 'ownerType' when calling" + + " listOwnershipHistoryByOwnerType"); + } + String cursor = parameters.cursor; + Integer limit = parameters.limit; + // create path and map variables + String localVarPath = + "/api/v2/csm/ownership/{resource_id}/{owner_type}/history" + .replaceAll( + "\\{" + "resource_id" + "\\}", apiClient.escapeString(resourceId.toString())) + .replaceAll("\\{" + "owner_type" + "\\}", apiClient.escapeString(ownerType.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.CsmOwnershipApi.listOwnershipHistoryByOwnerType", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List ownership history by owner type. + * + *

See {@link #listOwnershipHistoryByOwnerTypeWithHttpInfo}. + * + * @param resourceId The identifier of the resource to retrieve inference history for. (required) + * @param ownerType The owner type to filter history by. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<OwnershipHistoryResponse>> + */ + public CompletableFuture> + listOwnershipHistoryByOwnerTypeWithHttpInfoAsync( + String resourceId, + OwnershipOwnerType ownerType, + ListOwnershipHistoryByOwnerTypeOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "listOwnershipHistoryByOwnerType"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'resourceId' is set + if (resourceId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'resourceId' when calling" + + " listOwnershipHistoryByOwnerType")); + return result; + } + + // verify the required parameter 'ownerType' is set + if (ownerType == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'ownerType' when calling" + + " listOwnershipHistoryByOwnerType")); + return result; + } + String cursor = parameters.cursor; + Integer limit = parameters.limit; + // create path and map variables + String localVarPath = + "/api/v2/csm/ownership/{resource_id}/{owner_type}/history" + .replaceAll( + "\\{" + "resource_id" + "\\}", apiClient.escapeString(resourceId.toString())) + .replaceAll("\\{" + "owner_type" + "\\}", apiClient.escapeString(ownerType.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.CsmOwnershipApi.listOwnershipHistoryByOwnerType", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List ownership inferences for a resource. + * + *

See {@link #listOwnershipInferencesWithHttpInfo}. + * + * @param resourceId The identifier of the resource to retrieve ownership inferences for. + * (required) + * @return OwnershipInferenceListResponse + * @throws ApiException if fails to make API call + */ + public OwnershipInferenceListResponse listOwnershipInferences(String resourceId) + throws ApiException { + return listOwnershipInferencesWithHttpInfo(resourceId).getData(); + } + + /** + * List ownership inferences for a resource. + * + *

See {@link #listOwnershipInferencesWithHttpInfoAsync}. + * + * @param resourceId The identifier of the resource to retrieve ownership inferences for. + * (required) + * @return CompletableFuture<OwnershipInferenceListResponse> + */ + public CompletableFuture listOwnershipInferencesAsync( + String resourceId) { + return listOwnershipInferencesWithHttpInfoAsync(resourceId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get all current ownership inferences for a resource, one per owner type (user, + * team, service, unknown). + * + * @param resourceId The identifier of the resource to retrieve ownership inferences for. + * (required) + * @return ApiResponse<OwnershipInferenceListResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse listOwnershipInferencesWithHttpInfo( + String resourceId) throws ApiException { + // Check if unstable operation is enabled + String operationId = "listOwnershipInferences"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'resourceId' is set + if (resourceId == null) { + throw new ApiException( + 400, "Missing the required parameter 'resourceId' when calling listOwnershipInferences"); + } + // create path and map variables + String localVarPath = + "/api/v2/csm/ownership/{resource_id}" + .replaceAll( + "\\{" + "resource_id" + "\\}", apiClient.escapeString(resourceId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.CsmOwnershipApi.listOwnershipInferences", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List ownership inferences for a resource. + * + *

See {@link #listOwnershipInferencesWithHttpInfo}. + * + * @param resourceId The identifier of the resource to retrieve ownership inferences for. + * (required) + * @return CompletableFuture<ApiResponse<OwnershipInferenceListResponse>> + */ + public CompletableFuture> + listOwnershipInferencesWithHttpInfoAsync(String resourceId) { + // Check if unstable operation is enabled + String operationId = "listOwnershipInferences"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'resourceId' is set + if (resourceId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'resourceId' when calling listOwnershipInferences")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/csm/ownership/{resource_id}" + .replaceAll( + "\\{" + "resource_id" + "\\}", apiClient.escapeString(resourceId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.CsmOwnershipApi.listOwnershipInferences", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OwnershipEvidenceAttributes.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipEvidenceAttributes.java new file mode 100644 index 00000000000..e9e4a0b8388 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipEvidenceAttributes.java @@ -0,0 +1,155 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** The attributes of an ownership evidence response. */ +@JsonPropertyOrder({OwnershipEvidenceAttributes.JSON_PROPERTY_EVIDENCE_VERSIONS}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OwnershipEvidenceAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_EVIDENCE_VERSIONS = "evidence_versions"; + private List> evidenceVersions = new ArrayList<>(); + + public OwnershipEvidenceAttributes() {} + + @JsonCreator + public OwnershipEvidenceAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_EVIDENCE_VERSIONS) + List> evidenceVersions) { + this.evidenceVersions = evidenceVersions; + if (evidenceVersions != null) {} + } + + public OwnershipEvidenceAttributes evidenceVersions(List> evidenceVersions) { + this.evidenceVersions = evidenceVersions; + return this; + } + + public OwnershipEvidenceAttributes addEvidenceVersionsItem( + Map evidenceVersionsItem) { + this.evidenceVersions.add(evidenceVersionsItem); + return this; + } + + /** + * The list of evidence versions associated with an inference. + * + * @return evidenceVersions + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EVIDENCE_VERSIONS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List> getEvidenceVersions() { + return evidenceVersions; + } + + public void setEvidenceVersions(List> evidenceVersions) { + this.evidenceVersions = evidenceVersions; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return OwnershipEvidenceAttributes + */ + @JsonAnySetter + public OwnershipEvidenceAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this OwnershipEvidenceAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OwnershipEvidenceAttributes ownershipEvidenceAttributes = (OwnershipEvidenceAttributes) o; + return Objects.equals(this.evidenceVersions, ownershipEvidenceAttributes.evidenceVersions) + && Objects.equals( + this.additionalProperties, ownershipEvidenceAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(evidenceVersions, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OwnershipEvidenceAttributes {\n"); + sb.append(" evidenceVersions: ").append(toIndentedString(evidenceVersions)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OwnershipEvidenceData.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipEvidenceData.java new file mode 100644 index 00000000000..79e5d636c68 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipEvidenceData.java @@ -0,0 +1,210 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The data wrapper for an ownership evidence response. */ +@JsonPropertyOrder({ + OwnershipEvidenceData.JSON_PROPERTY_ATTRIBUTES, + OwnershipEvidenceData.JSON_PROPERTY_ID, + OwnershipEvidenceData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OwnershipEvidenceData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private OwnershipEvidenceAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private OwnershipEvidenceType type = OwnershipEvidenceType.OWNERSHIP_EVIDENCE; + + public OwnershipEvidenceData() {} + + @JsonCreator + public OwnershipEvidenceData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + OwnershipEvidenceAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) OwnershipEvidenceType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public OwnershipEvidenceData attributes(OwnershipEvidenceAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes of an ownership evidence response. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipEvidenceAttributes getAttributes() { + return attributes; + } + + public void setAttributes(OwnershipEvidenceAttributes attributes) { + this.attributes = attributes; + } + + public OwnershipEvidenceData id(String id) { + this.id = id; + return this; + } + + /** + * The identifier of the resource the evidence applies to. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public OwnershipEvidenceData type(OwnershipEvidenceType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of the ownership evidence resource. The value should always be + * ownership_evidence. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipEvidenceType getType() { + return type; + } + + public void setType(OwnershipEvidenceType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return OwnershipEvidenceData + */ + @JsonAnySetter + public OwnershipEvidenceData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this OwnershipEvidenceData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OwnershipEvidenceData ownershipEvidenceData = (OwnershipEvidenceData) o; + return Objects.equals(this.attributes, ownershipEvidenceData.attributes) + && Objects.equals(this.id, ownershipEvidenceData.id) + && Objects.equals(this.type, ownershipEvidenceData.type) + && Objects.equals(this.additionalProperties, ownershipEvidenceData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OwnershipEvidenceData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OwnershipEvidenceResponse.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipEvidenceResponse.java new file mode 100644 index 00000000000..cd17c2f5eee --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipEvidenceResponse.java @@ -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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** + * The response returned when retrieving the evidence backing an ownership inference for an owner + * type. + */ +@JsonPropertyOrder({OwnershipEvidenceResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OwnershipEvidenceResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private OwnershipEvidenceData data; + + public OwnershipEvidenceResponse() {} + + @JsonCreator + public OwnershipEvidenceResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) OwnershipEvidenceData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public OwnershipEvidenceResponse data(OwnershipEvidenceData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The data wrapper for an ownership evidence response. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipEvidenceData getData() { + return data; + } + + public void setData(OwnershipEvidenceData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return OwnershipEvidenceResponse + */ + @JsonAnySetter + public OwnershipEvidenceResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this OwnershipEvidenceResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OwnershipEvidenceResponse ownershipEvidenceResponse = (OwnershipEvidenceResponse) o; + return Objects.equals(this.data, ownershipEvidenceResponse.data) + && Objects.equals( + this.additionalProperties, ownershipEvidenceResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OwnershipEvidenceResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OwnershipEvidenceType.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipEvidenceType.java new file mode 100644 index 00000000000..58593391cf4 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipEvidenceType.java @@ -0,0 +1,59 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** + * The type of the ownership evidence resource. The value should always be ownership_evidence + * . + */ +@JsonSerialize(using = OwnershipEvidenceType.OwnershipEvidenceTypeSerializer.class) +public class OwnershipEvidenceType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("ownership_evidence")); + + public static final OwnershipEvidenceType OWNERSHIP_EVIDENCE = + new OwnershipEvidenceType("ownership_evidence"); + + OwnershipEvidenceType(String value) { + super(value, allowedValues); + } + + public static class OwnershipEvidenceTypeSerializer extends StdSerializer { + public OwnershipEvidenceTypeSerializer(Class t) { + super(t); + } + + public OwnershipEvidenceTypeSerializer() { + this(null); + } + + @Override + public void serialize( + OwnershipEvidenceType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static OwnershipEvidenceType fromValue(String value) { + return new OwnershipEvidenceType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OwnershipFeedbackAction.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipFeedbackAction.java new file mode 100644 index 00000000000..408da89c014 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipFeedbackAction.java @@ -0,0 +1,59 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The feedback action to apply to an inference. */ +@JsonSerialize(using = OwnershipFeedbackAction.OwnershipFeedbackActionSerializer.class) +public class OwnershipFeedbackAction extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("confirm", "reject", "correct", "persist")); + + public static final OwnershipFeedbackAction CONFIRM = new OwnershipFeedbackAction("confirm"); + public static final OwnershipFeedbackAction REJECT = new OwnershipFeedbackAction("reject"); + public static final OwnershipFeedbackAction CORRECT = new OwnershipFeedbackAction("correct"); + public static final OwnershipFeedbackAction PERSIST = new OwnershipFeedbackAction("persist"); + + OwnershipFeedbackAction(String value) { + super(value, allowedValues); + } + + public static class OwnershipFeedbackActionSerializer + extends StdSerializer { + public OwnershipFeedbackActionSerializer(Class t) { + super(t); + } + + public OwnershipFeedbackActionSerializer() { + this(null); + } + + @Override + public void serialize( + OwnershipFeedbackAction value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static OwnershipFeedbackAction fromValue(String value) { + return new OwnershipFeedbackAction(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OwnershipFeedbackRequest.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipFeedbackRequest.java new file mode 100644 index 00000000000..f875eb6d3ca --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipFeedbackRequest.java @@ -0,0 +1,146 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The request body for submitting ownership feedback. */ +@JsonPropertyOrder({OwnershipFeedbackRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OwnershipFeedbackRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private OwnershipFeedbackRequestData data; + + public OwnershipFeedbackRequest() {} + + @JsonCreator + public OwnershipFeedbackRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + OwnershipFeedbackRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public OwnershipFeedbackRequest data(OwnershipFeedbackRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The data wrapper for an ownership feedback request. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipFeedbackRequestData getData() { + return data; + } + + public void setData(OwnershipFeedbackRequestData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return OwnershipFeedbackRequest + */ + @JsonAnySetter + public OwnershipFeedbackRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this OwnershipFeedbackRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OwnershipFeedbackRequest ownershipFeedbackRequest = (OwnershipFeedbackRequest) o; + return Objects.equals(this.data, ownershipFeedbackRequest.data) + && Objects.equals(this.additionalProperties, ownershipFeedbackRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OwnershipFeedbackRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OwnershipFeedbackRequestAttributes.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipFeedbackRequestAttributes.java new file mode 100644 index 00000000000..f1862e53e26 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipFeedbackRequestAttributes.java @@ -0,0 +1,364 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** The attributes of an ownership feedback request. */ +@JsonPropertyOrder({ + OwnershipFeedbackRequestAttributes.JSON_PROPERTY_ACTION, + OwnershipFeedbackRequestAttributes.JSON_PROPERTY_ACTOR_HANDLE, + OwnershipFeedbackRequestAttributes.JSON_PROPERTY_ACTOR_TYPE, + OwnershipFeedbackRequestAttributes.JSON_PROPERTY_CORRECTED_OWNER_HANDLE, + OwnershipFeedbackRequestAttributes.JSON_PROPERTY_CORRECTED_OWNER_TYPE, + OwnershipFeedbackRequestAttributes.JSON_PROPERTY_INFERENCE_CHECKSUM, + OwnershipFeedbackRequestAttributes.JSON_PROPERTY_REASON +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OwnershipFeedbackRequestAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ACTION = "action"; + private OwnershipFeedbackAction action; + + public static final String JSON_PROPERTY_ACTOR_HANDLE = "actor_handle"; + private String actorHandle; + + public static final String JSON_PROPERTY_ACTOR_TYPE = "actor_type"; + private String actorType; + + public static final String JSON_PROPERTY_CORRECTED_OWNER_HANDLE = "corrected_owner_handle"; + private JsonNullable correctedOwnerHandle = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_CORRECTED_OWNER_TYPE = "corrected_owner_type"; + private JsonNullable correctedOwnerType = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_INFERENCE_CHECKSUM = "inference_checksum"; + private String inferenceChecksum; + + public static final String JSON_PROPERTY_REASON = "reason"; + private JsonNullable reason = JsonNullable.undefined(); + + public OwnershipFeedbackRequestAttributes() {} + + @JsonCreator + public OwnershipFeedbackRequestAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_ACTION) OwnershipFeedbackAction action, + @JsonProperty(required = true, value = JSON_PROPERTY_ACTOR_HANDLE) String actorHandle, + @JsonProperty(required = true, value = JSON_PROPERTY_ACTOR_TYPE) String actorType, + @JsonProperty(required = true, value = JSON_PROPERTY_INFERENCE_CHECKSUM) + String inferenceChecksum) { + this.action = action; + this.unparsed |= !action.isValid(); + this.actorHandle = actorHandle; + this.actorType = actorType; + this.inferenceChecksum = inferenceChecksum; + } + + public OwnershipFeedbackRequestAttributes action(OwnershipFeedbackAction action) { + this.action = action; + this.unparsed |= !action.isValid(); + return this; + } + + /** + * The feedback action to apply to an inference. + * + * @return action + */ + @JsonProperty(JSON_PROPERTY_ACTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipFeedbackAction getAction() { + return action; + } + + public void setAction(OwnershipFeedbackAction action) { + if (!action.isValid()) { + this.unparsed = true; + } + this.action = action; + } + + public OwnershipFeedbackRequestAttributes actorHandle(String actorHandle) { + this.actorHandle = actorHandle; + return this; + } + + /** + * The handle of the actor submitting the feedback. + * + * @return actorHandle + */ + @JsonProperty(JSON_PROPERTY_ACTOR_HANDLE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getActorHandle() { + return actorHandle; + } + + public void setActorHandle(String actorHandle) { + this.actorHandle = actorHandle; + } + + public OwnershipFeedbackRequestAttributes actorType(String actorType) { + this.actorType = actorType; + return this; + } + + /** + * The type of actor submitting the feedback, for example user or service + * . + * + * @return actorType + */ + @JsonProperty(JSON_PROPERTY_ACTOR_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getActorType() { + return actorType; + } + + public void setActorType(String actorType) { + this.actorType = actorType; + } + + public OwnershipFeedbackRequestAttributes correctedOwnerHandle(String correctedOwnerHandle) { + this.correctedOwnerHandle = JsonNullable.of(correctedOwnerHandle); + return this; + } + + /** + * The corrected owner handle. Required when action is correct. + * + * @return correctedOwnerHandle + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getCorrectedOwnerHandle() { + return correctedOwnerHandle.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CORRECTED_OWNER_HANDLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getCorrectedOwnerHandle_JsonNullable() { + return correctedOwnerHandle; + } + + @JsonProperty(JSON_PROPERTY_CORRECTED_OWNER_HANDLE) + public void setCorrectedOwnerHandle_JsonNullable(JsonNullable correctedOwnerHandle) { + this.correctedOwnerHandle = correctedOwnerHandle; + } + + public void setCorrectedOwnerHandle(String correctedOwnerHandle) { + this.correctedOwnerHandle = JsonNullable.of(correctedOwnerHandle); + } + + public OwnershipFeedbackRequestAttributes correctedOwnerType(String correctedOwnerType) { + this.correctedOwnerType = JsonNullable.of(correctedOwnerType); + return this; + } + + /** + * The corrected owner type. Required when action is correct. + * + * @return correctedOwnerType + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getCorrectedOwnerType() { + return correctedOwnerType.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CORRECTED_OWNER_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getCorrectedOwnerType_JsonNullable() { + return correctedOwnerType; + } + + @JsonProperty(JSON_PROPERTY_CORRECTED_OWNER_TYPE) + public void setCorrectedOwnerType_JsonNullable(JsonNullable correctedOwnerType) { + this.correctedOwnerType = correctedOwnerType; + } + + public void setCorrectedOwnerType(String correctedOwnerType) { + this.correctedOwnerType = JsonNullable.of(correctedOwnerType); + } + + public OwnershipFeedbackRequestAttributes inferenceChecksum(String inferenceChecksum) { + this.inferenceChecksum = inferenceChecksum; + return this; + } + + /** + * The checksum of the inference being acted upon. Must match the current inference checksum or + * the request returns a conflict. + * + * @return inferenceChecksum + */ + @JsonProperty(JSON_PROPERTY_INFERENCE_CHECKSUM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getInferenceChecksum() { + return inferenceChecksum; + } + + public void setInferenceChecksum(String inferenceChecksum) { + this.inferenceChecksum = inferenceChecksum; + } + + public OwnershipFeedbackRequestAttributes reason(String reason) { + this.reason = JsonNullable.of(reason); + return this; + } + + /** + * An optional free-form reason explaining the feedback. + * + * @return reason + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getReason() { + return reason.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_REASON) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getReason_JsonNullable() { + return reason; + } + + @JsonProperty(JSON_PROPERTY_REASON) + public void setReason_JsonNullable(JsonNullable reason) { + this.reason = reason; + } + + public void setReason(String reason) { + this.reason = JsonNullable.of(reason); + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return OwnershipFeedbackRequestAttributes + */ + @JsonAnySetter + public OwnershipFeedbackRequestAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this OwnershipFeedbackRequestAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OwnershipFeedbackRequestAttributes ownershipFeedbackRequestAttributes = + (OwnershipFeedbackRequestAttributes) o; + return Objects.equals(this.action, ownershipFeedbackRequestAttributes.action) + && Objects.equals(this.actorHandle, ownershipFeedbackRequestAttributes.actorHandle) + && Objects.equals(this.actorType, ownershipFeedbackRequestAttributes.actorType) + && Objects.equals( + this.correctedOwnerHandle, ownershipFeedbackRequestAttributes.correctedOwnerHandle) + && Objects.equals( + this.correctedOwnerType, ownershipFeedbackRequestAttributes.correctedOwnerType) + && Objects.equals( + this.inferenceChecksum, ownershipFeedbackRequestAttributes.inferenceChecksum) + && Objects.equals(this.reason, ownershipFeedbackRequestAttributes.reason) + && Objects.equals( + this.additionalProperties, ownershipFeedbackRequestAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + action, + actorHandle, + actorType, + correctedOwnerHandle, + correctedOwnerType, + inferenceChecksum, + reason, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OwnershipFeedbackRequestAttributes {\n"); + sb.append(" action: ").append(toIndentedString(action)).append("\n"); + sb.append(" actorHandle: ").append(toIndentedString(actorHandle)).append("\n"); + sb.append(" actorType: ").append(toIndentedString(actorType)).append("\n"); + sb.append(" correctedOwnerHandle: ") + .append(toIndentedString(correctedOwnerHandle)) + .append("\n"); + sb.append(" correctedOwnerType: ").append(toIndentedString(correctedOwnerType)).append("\n"); + sb.append(" inferenceChecksum: ").append(toIndentedString(inferenceChecksum)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OwnershipFeedbackRequestData.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipFeedbackRequestData.java new file mode 100644 index 00000000000..9dbbf553ff8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipFeedbackRequestData.java @@ -0,0 +1,183 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The data wrapper for an ownership feedback request. */ +@JsonPropertyOrder({ + OwnershipFeedbackRequestData.JSON_PROPERTY_ATTRIBUTES, + OwnershipFeedbackRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OwnershipFeedbackRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private OwnershipFeedbackRequestAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private OwnershipFeedbackType type = OwnershipFeedbackType.OWNERSHIP_FEEDBACK; + + public OwnershipFeedbackRequestData() {} + + @JsonCreator + public OwnershipFeedbackRequestData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + OwnershipFeedbackRequestAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) OwnershipFeedbackType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public OwnershipFeedbackRequestData attributes(OwnershipFeedbackRequestAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes of an ownership feedback request. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipFeedbackRequestAttributes getAttributes() { + return attributes; + } + + public void setAttributes(OwnershipFeedbackRequestAttributes attributes) { + this.attributes = attributes; + } + + public OwnershipFeedbackRequestData type(OwnershipFeedbackType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of the ownership feedback request resource. The value should always be + * ownership_feedback. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipFeedbackType getType() { + return type; + } + + public void setType(OwnershipFeedbackType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return OwnershipFeedbackRequestData + */ + @JsonAnySetter + public OwnershipFeedbackRequestData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this OwnershipFeedbackRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OwnershipFeedbackRequestData ownershipFeedbackRequestData = (OwnershipFeedbackRequestData) o; + return Objects.equals(this.attributes, ownershipFeedbackRequestData.attributes) + && Objects.equals(this.type, ownershipFeedbackRequestData.type) + && Objects.equals( + this.additionalProperties, ownershipFeedbackRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OwnershipFeedbackRequestData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OwnershipFeedbackResponse.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipFeedbackResponse.java new file mode 100644 index 00000000000..bfe77eb0982 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipFeedbackResponse.java @@ -0,0 +1,146 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The response returned after applying ownership feedback to an inference. */ +@JsonPropertyOrder({OwnershipFeedbackResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OwnershipFeedbackResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private OwnershipFeedbackResultData data; + + public OwnershipFeedbackResponse() {} + + @JsonCreator + public OwnershipFeedbackResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) OwnershipFeedbackResultData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public OwnershipFeedbackResponse data(OwnershipFeedbackResultData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The data wrapper for an ownership feedback result response. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipFeedbackResultData getData() { + return data; + } + + public void setData(OwnershipFeedbackResultData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return OwnershipFeedbackResponse + */ + @JsonAnySetter + public OwnershipFeedbackResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this OwnershipFeedbackResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OwnershipFeedbackResponse ownershipFeedbackResponse = (OwnershipFeedbackResponse) o; + return Objects.equals(this.data, ownershipFeedbackResponse.data) + && Objects.equals( + this.additionalProperties, ownershipFeedbackResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OwnershipFeedbackResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OwnershipFeedbackResultAttributes.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipFeedbackResultAttributes.java new file mode 100644 index 00000000000..ce34990e646 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipFeedbackResultAttributes.java @@ -0,0 +1,358 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** The attributes of an ownership feedback result. */ +@JsonPropertyOrder({ + OwnershipFeedbackResultAttributes.JSON_PROPERTY_ACTION, + OwnershipFeedbackResultAttributes.JSON_PROPERTY_CHECKSUM, + OwnershipFeedbackResultAttributes.JSON_PROPERTY_NEW_STATUS, + OwnershipFeedbackResultAttributes.JSON_PROPERTY_OWNER_TYPE, + OwnershipFeedbackResultAttributes.JSON_PROPERTY_PREVIOUS_STATUS, + OwnershipFeedbackResultAttributes.JSON_PROPERTY_PRIMARY_CONTACT_REF, + OwnershipFeedbackResultAttributes.JSON_PROPERTY_UPDATED_AT +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OwnershipFeedbackResultAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ACTION = "action"; + private OwnershipFeedbackAction action; + + public static final String JSON_PROPERTY_CHECKSUM = "checksum"; + private String checksum; + + public static final String JSON_PROPERTY_NEW_STATUS = "new_status"; + private OwnershipInferenceStatus newStatus; + + public static final String JSON_PROPERTY_OWNER_TYPE = "owner_type"; + private OwnershipOwnerType ownerType; + + public static final String JSON_PROPERTY_PREVIOUS_STATUS = "previous_status"; + private OwnershipInferenceStatus previousStatus; + + public static final String JSON_PROPERTY_PRIMARY_CONTACT_REF = "primary_contact_ref"; + private JsonNullable primaryContactRef = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_UPDATED_AT = "updated_at"; + private OffsetDateTime updatedAt; + + public OwnershipFeedbackResultAttributes() {} + + @JsonCreator + public OwnershipFeedbackResultAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_ACTION) OwnershipFeedbackAction action, + @JsonProperty(required = true, value = JSON_PROPERTY_CHECKSUM) String checksum, + @JsonProperty(required = true, value = JSON_PROPERTY_NEW_STATUS) + OwnershipInferenceStatus newStatus, + @JsonProperty(required = true, value = JSON_PROPERTY_OWNER_TYPE) OwnershipOwnerType ownerType, + @JsonProperty(required = true, value = JSON_PROPERTY_PREVIOUS_STATUS) + OwnershipInferenceStatus previousStatus, + @JsonProperty(required = true, value = JSON_PROPERTY_UPDATED_AT) OffsetDateTime updatedAt) { + this.action = action; + this.unparsed |= !action.isValid(); + this.checksum = checksum; + this.newStatus = newStatus; + this.unparsed |= !newStatus.isValid(); + this.ownerType = ownerType; + this.unparsed |= !ownerType.isValid(); + this.previousStatus = previousStatus; + this.unparsed |= !previousStatus.isValid(); + this.updatedAt = updatedAt; + } + + public OwnershipFeedbackResultAttributes action(OwnershipFeedbackAction action) { + this.action = action; + this.unparsed |= !action.isValid(); + return this; + } + + /** + * The feedback action to apply to an inference. + * + * @return action + */ + @JsonProperty(JSON_PROPERTY_ACTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipFeedbackAction getAction() { + return action; + } + + public void setAction(OwnershipFeedbackAction action) { + if (!action.isValid()) { + this.unparsed = true; + } + this.action = action; + } + + public OwnershipFeedbackResultAttributes checksum(String checksum) { + this.checksum = checksum; + return this; + } + + /** + * The checksum of the inference after the feedback was applied. + * + * @return checksum + */ + @JsonProperty(JSON_PROPERTY_CHECKSUM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getChecksum() { + return checksum; + } + + public void setChecksum(String checksum) { + this.checksum = checksum; + } + + public OwnershipFeedbackResultAttributes newStatus(OwnershipInferenceStatus newStatus) { + this.newStatus = newStatus; + this.unparsed |= !newStatus.isValid(); + return this; + } + + /** + * The lifecycle status of an ownership inference. + * + * @return newStatus + */ + @JsonProperty(JSON_PROPERTY_NEW_STATUS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipInferenceStatus getNewStatus() { + return newStatus; + } + + public void setNewStatus(OwnershipInferenceStatus newStatus) { + if (!newStatus.isValid()) { + this.unparsed = true; + } + this.newStatus = newStatus; + } + + public OwnershipFeedbackResultAttributes ownerType(OwnershipOwnerType ownerType) { + this.ownerType = ownerType; + this.unparsed |= !ownerType.isValid(); + return this; + } + + /** + * The owner type for an ownership inference. + * + * @return ownerType + */ + @JsonProperty(JSON_PROPERTY_OWNER_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipOwnerType getOwnerType() { + return ownerType; + } + + public void setOwnerType(OwnershipOwnerType ownerType) { + if (!ownerType.isValid()) { + this.unparsed = true; + } + this.ownerType = ownerType; + } + + public OwnershipFeedbackResultAttributes previousStatus(OwnershipInferenceStatus previousStatus) { + this.previousStatus = previousStatus; + this.unparsed |= !previousStatus.isValid(); + return this; + } + + /** + * The lifecycle status of an ownership inference. + * + * @return previousStatus + */ + @JsonProperty(JSON_PROPERTY_PREVIOUS_STATUS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipInferenceStatus getPreviousStatus() { + return previousStatus; + } + + public void setPreviousStatus(OwnershipInferenceStatus previousStatus) { + if (!previousStatus.isValid()) { + this.unparsed = true; + } + this.previousStatus = previousStatus; + } + + public OwnershipFeedbackResultAttributes primaryContactRef(String primaryContactRef) { + this.primaryContactRef = JsonNullable.of(primaryContactRef); + return this; + } + + /** + * The primary contact reference for the inferred owner after the feedback was applied, formatted + * as ref:handle/<owner_handle>. + * + * @return primaryContactRef + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getPrimaryContactRef() { + return primaryContactRef.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_PRIMARY_CONTACT_REF) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getPrimaryContactRef_JsonNullable() { + return primaryContactRef; + } + + @JsonProperty(JSON_PROPERTY_PRIMARY_CONTACT_REF) + public void setPrimaryContactRef_JsonNullable(JsonNullable primaryContactRef) { + this.primaryContactRef = primaryContactRef; + } + + public void setPrimaryContactRef(String primaryContactRef) { + this.primaryContactRef = JsonNullable.of(primaryContactRef); + } + + public OwnershipFeedbackResultAttributes updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * The time when the inference was updated by the feedback. + * + * @return updatedAt + */ + @JsonProperty(JSON_PROPERTY_UPDATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return OwnershipFeedbackResultAttributes + */ + @JsonAnySetter + public OwnershipFeedbackResultAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this OwnershipFeedbackResultAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OwnershipFeedbackResultAttributes ownershipFeedbackResultAttributes = + (OwnershipFeedbackResultAttributes) o; + return Objects.equals(this.action, ownershipFeedbackResultAttributes.action) + && Objects.equals(this.checksum, ownershipFeedbackResultAttributes.checksum) + && Objects.equals(this.newStatus, ownershipFeedbackResultAttributes.newStatus) + && Objects.equals(this.ownerType, ownershipFeedbackResultAttributes.ownerType) + && Objects.equals(this.previousStatus, ownershipFeedbackResultAttributes.previousStatus) + && Objects.equals( + this.primaryContactRef, ownershipFeedbackResultAttributes.primaryContactRef) + && Objects.equals(this.updatedAt, ownershipFeedbackResultAttributes.updatedAt) + && Objects.equals( + this.additionalProperties, ownershipFeedbackResultAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + action, + checksum, + newStatus, + ownerType, + previousStatus, + primaryContactRef, + updatedAt, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OwnershipFeedbackResultAttributes {\n"); + sb.append(" action: ").append(toIndentedString(action)).append("\n"); + sb.append(" checksum: ").append(toIndentedString(checksum)).append("\n"); + sb.append(" newStatus: ").append(toIndentedString(newStatus)).append("\n"); + sb.append(" ownerType: ").append(toIndentedString(ownerType)).append("\n"); + sb.append(" previousStatus: ").append(toIndentedString(previousStatus)).append("\n"); + sb.append(" primaryContactRef: ").append(toIndentedString(primaryContactRef)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OwnershipFeedbackResultData.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipFeedbackResultData.java new file mode 100644 index 00000000000..5a4e14e01f8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipFeedbackResultData.java @@ -0,0 +1,211 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The data wrapper for an ownership feedback result response. */ +@JsonPropertyOrder({ + OwnershipFeedbackResultData.JSON_PROPERTY_ATTRIBUTES, + OwnershipFeedbackResultData.JSON_PROPERTY_ID, + OwnershipFeedbackResultData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OwnershipFeedbackResultData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private OwnershipFeedbackResultAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private OwnershipFeedbackResultType type = OwnershipFeedbackResultType.OWNERSHIP_FEEDBACK_RESULT; + + public OwnershipFeedbackResultData() {} + + @JsonCreator + public OwnershipFeedbackResultData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + OwnershipFeedbackResultAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) OwnershipFeedbackResultType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public OwnershipFeedbackResultData attributes(OwnershipFeedbackResultAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes of an ownership feedback result. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipFeedbackResultAttributes getAttributes() { + return attributes; + } + + public void setAttributes(OwnershipFeedbackResultAttributes attributes) { + this.attributes = attributes; + } + + public OwnershipFeedbackResultData id(String id) { + this.id = id; + return this; + } + + /** + * The identifier of the resource that the feedback was applied to. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public OwnershipFeedbackResultData type(OwnershipFeedbackResultType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of the ownership feedback result resource. The value should always be + * ownership_feedback_result. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipFeedbackResultType getType() { + return type; + } + + public void setType(OwnershipFeedbackResultType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return OwnershipFeedbackResultData + */ + @JsonAnySetter + public OwnershipFeedbackResultData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this OwnershipFeedbackResultData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OwnershipFeedbackResultData ownershipFeedbackResultData = (OwnershipFeedbackResultData) o; + return Objects.equals(this.attributes, ownershipFeedbackResultData.attributes) + && Objects.equals(this.id, ownershipFeedbackResultData.id) + && Objects.equals(this.type, ownershipFeedbackResultData.type) + && Objects.equals( + this.additionalProperties, ownershipFeedbackResultData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OwnershipFeedbackResultData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OwnershipFeedbackResultType.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipFeedbackResultType.java new file mode 100644 index 00000000000..15f2af9204f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipFeedbackResultType.java @@ -0,0 +1,60 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** + * The type of the ownership feedback result resource. The value should always be + * ownership_feedback_result. + */ +@JsonSerialize(using = OwnershipFeedbackResultType.OwnershipFeedbackResultTypeSerializer.class) +public class OwnershipFeedbackResultType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("ownership_feedback_result")); + + public static final OwnershipFeedbackResultType OWNERSHIP_FEEDBACK_RESULT = + new OwnershipFeedbackResultType("ownership_feedback_result"); + + OwnershipFeedbackResultType(String value) { + super(value, allowedValues); + } + + public static class OwnershipFeedbackResultTypeSerializer + extends StdSerializer { + public OwnershipFeedbackResultTypeSerializer(Class t) { + super(t); + } + + public OwnershipFeedbackResultTypeSerializer() { + this(null); + } + + @Override + public void serialize( + OwnershipFeedbackResultType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static OwnershipFeedbackResultType fromValue(String value) { + return new OwnershipFeedbackResultType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OwnershipFeedbackType.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipFeedbackType.java new file mode 100644 index 00000000000..b96d1328ea8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipFeedbackType.java @@ -0,0 +1,59 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** + * The type of the ownership feedback request resource. The value should always be + * ownership_feedback. + */ +@JsonSerialize(using = OwnershipFeedbackType.OwnershipFeedbackTypeSerializer.class) +public class OwnershipFeedbackType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("ownership_feedback")); + + public static final OwnershipFeedbackType OWNERSHIP_FEEDBACK = + new OwnershipFeedbackType("ownership_feedback"); + + OwnershipFeedbackType(String value) { + super(value, allowedValues); + } + + public static class OwnershipFeedbackTypeSerializer extends StdSerializer { + public OwnershipFeedbackTypeSerializer(Class t) { + super(t); + } + + public OwnershipFeedbackTypeSerializer() { + this(null); + } + + @Override + public void serialize( + OwnershipFeedbackType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static OwnershipFeedbackType fromValue(String value) { + return new OwnershipFeedbackType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OwnershipHistoryAttributes.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipHistoryAttributes.java new file mode 100644 index 00000000000..9f9502cd720 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipHistoryAttributes.java @@ -0,0 +1,188 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** The attributes of an ownership history response. */ +@JsonPropertyOrder({ + OwnershipHistoryAttributes.JSON_PROPERTY_ITEMS, + OwnershipHistoryAttributes.JSON_PROPERTY_PAGINATION +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OwnershipHistoryAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ITEMS = "items"; + private List items = new ArrayList<>(); + + public static final String JSON_PROPERTY_PAGINATION = "pagination"; + private OwnershipHistoryPagination pagination; + + public OwnershipHistoryAttributes() {} + + @JsonCreator + public OwnershipHistoryAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_ITEMS) List items, + @JsonProperty(required = true, value = JSON_PROPERTY_PAGINATION) + OwnershipHistoryPagination pagination) { + this.items = items; + this.pagination = pagination; + this.unparsed |= pagination.unparsed; + } + + public OwnershipHistoryAttributes items(List items) { + this.items = items; + for (OwnershipHistoryItem item : items) { + this.unparsed |= item.unparsed; + } + return this; + } + + public OwnershipHistoryAttributes addItemsItem(OwnershipHistoryItem itemsItem) { + this.items.add(itemsItem); + this.unparsed |= itemsItem.unparsed; + return this; + } + + /** + * The list of history entries returned for this page. + * + * @return items + */ + @JsonProperty(JSON_PROPERTY_ITEMS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + public OwnershipHistoryAttributes pagination(OwnershipHistoryPagination pagination) { + this.pagination = pagination; + this.unparsed |= pagination.unparsed; + return this; + } + + /** + * Cursor-based pagination metadata for the history response. + * + * @return pagination + */ + @JsonProperty(JSON_PROPERTY_PAGINATION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipHistoryPagination getPagination() { + return pagination; + } + + public void setPagination(OwnershipHistoryPagination pagination) { + this.pagination = pagination; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return OwnershipHistoryAttributes + */ + @JsonAnySetter + public OwnershipHistoryAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this OwnershipHistoryAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OwnershipHistoryAttributes ownershipHistoryAttributes = (OwnershipHistoryAttributes) o; + return Objects.equals(this.items, ownershipHistoryAttributes.items) + && Objects.equals(this.pagination, ownershipHistoryAttributes.pagination) + && Objects.equals( + this.additionalProperties, ownershipHistoryAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, pagination, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OwnershipHistoryAttributes {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" pagination: ").append(toIndentedString(pagination)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OwnershipHistoryData.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipHistoryData.java new file mode 100644 index 00000000000..8100b7e514f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipHistoryData.java @@ -0,0 +1,210 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The data wrapper for an ownership history response. */ +@JsonPropertyOrder({ + OwnershipHistoryData.JSON_PROPERTY_ATTRIBUTES, + OwnershipHistoryData.JSON_PROPERTY_ID, + OwnershipHistoryData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OwnershipHistoryData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private OwnershipHistoryAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private OwnershipHistoryType type = OwnershipHistoryType.OWNERSHIP_HISTORY; + + public OwnershipHistoryData() {} + + @JsonCreator + public OwnershipHistoryData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + OwnershipHistoryAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) OwnershipHistoryType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public OwnershipHistoryData attributes(OwnershipHistoryAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes of an ownership history response. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipHistoryAttributes getAttributes() { + return attributes; + } + + public void setAttributes(OwnershipHistoryAttributes attributes) { + this.attributes = attributes; + } + + public OwnershipHistoryData id(String id) { + this.id = id; + return this; + } + + /** + * The resource identifier for which history is returned. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public OwnershipHistoryData type(OwnershipHistoryType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of the ownership history resource. The value should always be ownership_history + * . + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipHistoryType getType() { + return type; + } + + public void setType(OwnershipHistoryType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return OwnershipHistoryData + */ + @JsonAnySetter + public OwnershipHistoryData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this OwnershipHistoryData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OwnershipHistoryData ownershipHistoryData = (OwnershipHistoryData) o; + return Objects.equals(this.attributes, ownershipHistoryData.attributes) + && Objects.equals(this.id, ownershipHistoryData.id) + && Objects.equals(this.type, ownershipHistoryData.type) + && Objects.equals(this.additionalProperties, ownershipHistoryData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OwnershipHistoryData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OwnershipHistoryItem.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipHistoryItem.java new file mode 100644 index 00000000000..7084f55c26c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipHistoryItem.java @@ -0,0 +1,592 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** A single ownership inference history entry. */ +@JsonPropertyOrder({ + OwnershipHistoryItem.JSON_PROPERTY_CHECKSUM, + OwnershipHistoryItem.JSON_PROPERTY_CONFIDENCE, + OwnershipHistoryItem.JSON_PROPERTY_CREATED_AT, + OwnershipHistoryItem.JSON_PROPERTY_EVIDENCE_VERSIONS, + OwnershipHistoryItem.JSON_PROPERTY_EXPLANATION, + OwnershipHistoryItem.JSON_PROPERTY_FAILED_AT, + OwnershipHistoryItem.JSON_PROPERTY_FAILURE_REASON, + OwnershipHistoryItem.JSON_PROPERTY_ID, + OwnershipHistoryItem.JSON_PROPERTY_OWNER_TYPE, + OwnershipHistoryItem.JSON_PROPERTY_PRIMARY_CONTACT_REF, + OwnershipHistoryItem.JSON_PROPERTY_RESOURCE_ID, + OwnershipHistoryItem.JSON_PROPERTY_RETRY_SCHEDULE, + OwnershipHistoryItem.JSON_PROPERTY_SOURCES, + OwnershipHistoryItem.JSON_PROPERTY_STATUS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OwnershipHistoryItem { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CHECKSUM = "checksum"; + private String checksum; + + public static final String JSON_PROPERTY_CONFIDENCE = "confidence"; + private String confidence; + + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_EVIDENCE_VERSIONS = "evidence_versions"; + private List> evidenceVersions = new ArrayList<>(); + + public static final String JSON_PROPERTY_EXPLANATION = "explanation"; + private String explanation; + + public static final String JSON_PROPERTY_FAILED_AT = "failed_at"; + private JsonNullable failedAt = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_FAILURE_REASON = "failure_reason"; + private JsonNullable failureReason = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_ID = "id"; + private Long id; + + public static final String JSON_PROPERTY_OWNER_TYPE = "owner_type"; + private OwnershipOwnerType ownerType; + + public static final String JSON_PROPERTY_PRIMARY_CONTACT_REF = "primary_contact_ref"; + private JsonNullable primaryContactRef = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_RESOURCE_ID = "resource_id"; + private String resourceId; + + public static final String JSON_PROPERTY_RETRY_SCHEDULE = "retry_schedule"; + private JsonNullable retrySchedule = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_SOURCES = "sources"; + private List> sources = new ArrayList<>(); + + public static final String JSON_PROPERTY_STATUS = "status"; + private OwnershipInferenceStatus status; + + public OwnershipHistoryItem() {} + + @JsonCreator + public OwnershipHistoryItem( + @JsonProperty(required = true, value = JSON_PROPERTY_CHECKSUM) String checksum, + @JsonProperty(required = true, value = JSON_PROPERTY_CONFIDENCE) String confidence, + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_AT) OffsetDateTime createdAt, + @JsonProperty(required = true, value = JSON_PROPERTY_EVIDENCE_VERSIONS) + List> evidenceVersions, + @JsonProperty(required = true, value = JSON_PROPERTY_EXPLANATION) String explanation, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) Long id, + @JsonProperty(required = true, value = JSON_PROPERTY_OWNER_TYPE) OwnershipOwnerType ownerType, + @JsonProperty(required = true, value = JSON_PROPERTY_RESOURCE_ID) String resourceId, + @JsonProperty(required = true, value = JSON_PROPERTY_SOURCES) + List> sources, + @JsonProperty(required = true, value = JSON_PROPERTY_STATUS) + OwnershipInferenceStatus status) { + this.checksum = checksum; + this.confidence = confidence; + this.createdAt = createdAt; + this.evidenceVersions = evidenceVersions; + if (evidenceVersions != null) {} + this.explanation = explanation; + this.id = id; + this.ownerType = ownerType; + this.unparsed |= !ownerType.isValid(); + this.resourceId = resourceId; + this.sources = sources; + this.status = status; + this.unparsed |= !status.isValid(); + } + + public OwnershipHistoryItem checksum(String checksum) { + this.checksum = checksum; + return this; + } + + /** + * A checksum identifying the state of the inference at this point in time. + * + * @return checksum + */ + @JsonProperty(JSON_PROPERTY_CHECKSUM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getChecksum() { + return checksum; + } + + public void setChecksum(String checksum) { + this.checksum = checksum; + } + + public OwnershipHistoryItem confidence(String confidence) { + this.confidence = confidence; + return this; + } + + /** + * The confidence score of the inference, expressed as a numeric string with up to four decimal + * places. + * + * @return confidence + */ + @JsonProperty(JSON_PROPERTY_CONFIDENCE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getConfidence() { + return confidence; + } + + public void setConfidence(String confidence) { + this.confidence = confidence; + } + + public OwnershipHistoryItem createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The time this history entry was created. + * + * @return createdAt + */ + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public OwnershipHistoryItem evidenceVersions(List> evidenceVersions) { + this.evidenceVersions = evidenceVersions; + return this; + } + + public OwnershipHistoryItem addEvidenceVersionsItem(Map evidenceVersionsItem) { + this.evidenceVersions.add(evidenceVersionsItem); + return this; + } + + /** + * The list of evidence versions associated with an inference. + * + * @return evidenceVersions + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EVIDENCE_VERSIONS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List> getEvidenceVersions() { + return evidenceVersions; + } + + public void setEvidenceVersions(List> evidenceVersions) { + this.evidenceVersions = evidenceVersions; + } + + public OwnershipHistoryItem explanation(String explanation) { + this.explanation = explanation; + return this; + } + + /** + * A human-readable explanation of how the inference was produced. + * + * @return explanation + */ + @JsonProperty(JSON_PROPERTY_EXPLANATION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getExplanation() { + return explanation; + } + + public void setExplanation(String explanation) { + this.explanation = explanation; + } + + public OwnershipHistoryItem failedAt(OffsetDateTime failedAt) { + this.failedAt = JsonNullable.of(failedAt); + return this; + } + + /** + * The time when this inference failed, if applicable. + * + * @return failedAt + */ + @jakarta.annotation.Nullable + @JsonIgnore + public OffsetDateTime getFailedAt() { + return failedAt.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_FAILED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getFailedAt_JsonNullable() { + return failedAt; + } + + @JsonProperty(JSON_PROPERTY_FAILED_AT) + public void setFailedAt_JsonNullable(JsonNullable failedAt) { + this.failedAt = failedAt; + } + + public void setFailedAt(OffsetDateTime failedAt) { + this.failedAt = JsonNullable.of(failedAt); + } + + public OwnershipHistoryItem failureReason(String failureReason) { + this.failureReason = JsonNullable.of(failureReason); + return this; + } + + /** + * The reason why this inference failed, if applicable. + * + * @return failureReason + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getFailureReason() { + return failureReason.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_FAILURE_REASON) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getFailureReason_JsonNullable() { + return failureReason; + } + + @JsonProperty(JSON_PROPERTY_FAILURE_REASON) + public void setFailureReason_JsonNullable(JsonNullable failureReason) { + this.failureReason = failureReason; + } + + public void setFailureReason(String failureReason) { + this.failureReason = JsonNullable.of(failureReason); + } + + public OwnershipHistoryItem id(Long id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the history entry. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public OwnershipHistoryItem ownerType(OwnershipOwnerType ownerType) { + this.ownerType = ownerType; + this.unparsed |= !ownerType.isValid(); + return this; + } + + /** + * The owner type for an ownership inference. + * + * @return ownerType + */ + @JsonProperty(JSON_PROPERTY_OWNER_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipOwnerType getOwnerType() { + return ownerType; + } + + public void setOwnerType(OwnershipOwnerType ownerType) { + if (!ownerType.isValid()) { + this.unparsed = true; + } + this.ownerType = ownerType; + } + + public OwnershipHistoryItem primaryContactRef(String primaryContactRef) { + this.primaryContactRef = JsonNullable.of(primaryContactRef); + return this; + } + + /** + * The primary contact reference for the inferred owner, formatted as + * ref:handle/<owner_handle>. + * + * @return primaryContactRef + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getPrimaryContactRef() { + return primaryContactRef.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_PRIMARY_CONTACT_REF) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getPrimaryContactRef_JsonNullable() { + return primaryContactRef; + } + + @JsonProperty(JSON_PROPERTY_PRIMARY_CONTACT_REF) + public void setPrimaryContactRef_JsonNullable(JsonNullable primaryContactRef) { + this.primaryContactRef = primaryContactRef; + } + + public void setPrimaryContactRef(String primaryContactRef) { + this.primaryContactRef = JsonNullable.of(primaryContactRef); + } + + public OwnershipHistoryItem resourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * The identifier of the resource that the inference applies to. + * + * @return resourceId + */ + @JsonProperty(JSON_PROPERTY_RESOURCE_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getResourceId() { + return resourceId; + } + + public void setResourceId(String resourceId) { + this.resourceId = resourceId; + } + + public OwnershipHistoryItem retrySchedule(OffsetDateTime retrySchedule) { + this.retrySchedule = JsonNullable.of(retrySchedule); + return this; + } + + /** + * The scheduled retry time for a failed inference, if applicable. + * + * @return retrySchedule + */ + @jakarta.annotation.Nullable + @JsonIgnore + public OffsetDateTime getRetrySchedule() { + return retrySchedule.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_RETRY_SCHEDULE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getRetrySchedule_JsonNullable() { + return retrySchedule; + } + + @JsonProperty(JSON_PROPERTY_RETRY_SCHEDULE) + public void setRetrySchedule_JsonNullable(JsonNullable retrySchedule) { + this.retrySchedule = retrySchedule; + } + + public void setRetrySchedule(OffsetDateTime retrySchedule) { + this.retrySchedule = JsonNullable.of(retrySchedule); + } + + public OwnershipHistoryItem sources(List> sources) { + this.sources = sources; + return this; + } + + public OwnershipHistoryItem addSourcesItem(Map sourcesItem) { + this.sources.add(sourcesItem); + return this; + } + + /** + * The list of sources backing an ownership inference. Empty when the inference status is not + * whitelisted to expose sources. + * + * @return sources + */ + @JsonProperty(JSON_PROPERTY_SOURCES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List> getSources() { + return sources; + } + + public void setSources(List> sources) { + this.sources = sources; + } + + public OwnershipHistoryItem status(OwnershipInferenceStatus status) { + this.status = status; + this.unparsed |= !status.isValid(); + return this; + } + + /** + * The lifecycle status of an ownership inference. + * + * @return status + */ + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipInferenceStatus getStatus() { + return status; + } + + public void setStatus(OwnershipInferenceStatus status) { + if (!status.isValid()) { + this.unparsed = true; + } + this.status = status; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return OwnershipHistoryItem + */ + @JsonAnySetter + public OwnershipHistoryItem putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this OwnershipHistoryItem object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OwnershipHistoryItem ownershipHistoryItem = (OwnershipHistoryItem) o; + return Objects.equals(this.checksum, ownershipHistoryItem.checksum) + && Objects.equals(this.confidence, ownershipHistoryItem.confidence) + && Objects.equals(this.createdAt, ownershipHistoryItem.createdAt) + && Objects.equals(this.evidenceVersions, ownershipHistoryItem.evidenceVersions) + && Objects.equals(this.explanation, ownershipHistoryItem.explanation) + && Objects.equals(this.failedAt, ownershipHistoryItem.failedAt) + && Objects.equals(this.failureReason, ownershipHistoryItem.failureReason) + && Objects.equals(this.id, ownershipHistoryItem.id) + && Objects.equals(this.ownerType, ownershipHistoryItem.ownerType) + && Objects.equals(this.primaryContactRef, ownershipHistoryItem.primaryContactRef) + && Objects.equals(this.resourceId, ownershipHistoryItem.resourceId) + && Objects.equals(this.retrySchedule, ownershipHistoryItem.retrySchedule) + && Objects.equals(this.sources, ownershipHistoryItem.sources) + && Objects.equals(this.status, ownershipHistoryItem.status) + && Objects.equals(this.additionalProperties, ownershipHistoryItem.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + checksum, + confidence, + createdAt, + evidenceVersions, + explanation, + failedAt, + failureReason, + id, + ownerType, + primaryContactRef, + resourceId, + retrySchedule, + sources, + status, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OwnershipHistoryItem {\n"); + sb.append(" checksum: ").append(toIndentedString(checksum)).append("\n"); + sb.append(" confidence: ").append(toIndentedString(confidence)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" evidenceVersions: ").append(toIndentedString(evidenceVersions)).append("\n"); + sb.append(" explanation: ").append(toIndentedString(explanation)).append("\n"); + sb.append(" failedAt: ").append(toIndentedString(failedAt)).append("\n"); + sb.append(" failureReason: ").append(toIndentedString(failureReason)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" ownerType: ").append(toIndentedString(ownerType)).append("\n"); + sb.append(" primaryContactRef: ").append(toIndentedString(primaryContactRef)).append("\n"); + sb.append(" resourceId: ").append(toIndentedString(resourceId)).append("\n"); + sb.append(" retrySchedule: ").append(toIndentedString(retrySchedule)).append("\n"); + sb.append(" sources: ").append(toIndentedString(sources)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OwnershipHistoryPagination.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipHistoryPagination.java new file mode 100644 index 00000000000..801cf870620 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipHistoryPagination.java @@ -0,0 +1,185 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Cursor-based pagination metadata for the history response. */ +@JsonPropertyOrder({ + OwnershipHistoryPagination.JSON_PROPERTY_HAS_MORE, + OwnershipHistoryPagination.JSON_PROPERTY_NEXT_CURSOR +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OwnershipHistoryPagination { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_HAS_MORE = "has_more"; + private Boolean hasMore; + + public static final String JSON_PROPERTY_NEXT_CURSOR = "next_cursor"; + private JsonNullable nextCursor = JsonNullable.undefined(); + + public OwnershipHistoryPagination() {} + + @JsonCreator + public OwnershipHistoryPagination( + @JsonProperty(required = true, value = JSON_PROPERTY_HAS_MORE) Boolean hasMore) { + this.hasMore = hasMore; + } + + public OwnershipHistoryPagination hasMore(Boolean hasMore) { + this.hasMore = hasMore; + return this; + } + + /** + * Whether more history entries are available beyond this page. + * + * @return hasMore + */ + @JsonProperty(JSON_PROPERTY_HAS_MORE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getHasMore() { + return hasMore; + } + + public void setHasMore(Boolean hasMore) { + this.hasMore = hasMore; + } + + public OwnershipHistoryPagination nextCursor(String nextCursor) { + this.nextCursor = JsonNullable.of(nextCursor); + return this; + } + + /** + * 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. + * + * @return nextCursor + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getNextCursor() { + return nextCursor.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NEXT_CURSOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getNextCursor_JsonNullable() { + return nextCursor; + } + + @JsonProperty(JSON_PROPERTY_NEXT_CURSOR) + public void setNextCursor_JsonNullable(JsonNullable nextCursor) { + this.nextCursor = nextCursor; + } + + public void setNextCursor(String nextCursor) { + this.nextCursor = JsonNullable.of(nextCursor); + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return OwnershipHistoryPagination + */ + @JsonAnySetter + public OwnershipHistoryPagination putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this OwnershipHistoryPagination object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OwnershipHistoryPagination ownershipHistoryPagination = (OwnershipHistoryPagination) o; + return Objects.equals(this.hasMore, ownershipHistoryPagination.hasMore) + && Objects.equals(this.nextCursor, ownershipHistoryPagination.nextCursor) + && Objects.equals( + this.additionalProperties, ownershipHistoryPagination.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(hasMore, nextCursor, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OwnershipHistoryPagination {\n"); + sb.append(" hasMore: ").append(toIndentedString(hasMore)).append("\n"); + sb.append(" nextCursor: ").append(toIndentedString(nextCursor)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OwnershipHistoryResponse.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipHistoryResponse.java new file mode 100644 index 00000000000..8c293117b2a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipHistoryResponse.java @@ -0,0 +1,145 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The response returned when listing the inference history for a resource. */ +@JsonPropertyOrder({OwnershipHistoryResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OwnershipHistoryResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private OwnershipHistoryData data; + + public OwnershipHistoryResponse() {} + + @JsonCreator + public OwnershipHistoryResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) OwnershipHistoryData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public OwnershipHistoryResponse data(OwnershipHistoryData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The data wrapper for an ownership history response. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipHistoryData getData() { + return data; + } + + public void setData(OwnershipHistoryData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return OwnershipHistoryResponse + */ + @JsonAnySetter + public OwnershipHistoryResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this OwnershipHistoryResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OwnershipHistoryResponse ownershipHistoryResponse = (OwnershipHistoryResponse) o; + return Objects.equals(this.data, ownershipHistoryResponse.data) + && Objects.equals(this.additionalProperties, ownershipHistoryResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OwnershipHistoryResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OwnershipHistoryType.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipHistoryType.java new file mode 100644 index 00000000000..f6f542163db --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipHistoryType.java @@ -0,0 +1,59 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** + * The type of the ownership history resource. The value should always be ownership_history + * . + */ +@JsonSerialize(using = OwnershipHistoryType.OwnershipHistoryTypeSerializer.class) +public class OwnershipHistoryType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("ownership_history")); + + public static final OwnershipHistoryType OWNERSHIP_HISTORY = + new OwnershipHistoryType("ownership_history"); + + OwnershipHistoryType(String value) { + super(value, allowedValues); + } + + public static class OwnershipHistoryTypeSerializer extends StdSerializer { + public OwnershipHistoryTypeSerializer(Class t) { + super(t); + } + + public OwnershipHistoryTypeSerializer() { + this(null); + } + + @Override + public void serialize( + OwnershipHistoryType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static OwnershipHistoryType fromValue(String value) { + return new OwnershipHistoryType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OwnershipInferenceAttributes.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipInferenceAttributes.java new file mode 100644 index 00000000000..92610a0d54d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipInferenceAttributes.java @@ -0,0 +1,451 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** The attributes of a single ownership inference. */ +@JsonPropertyOrder({ + OwnershipInferenceAttributes.JSON_PROPERTY_CHECKSUM, + OwnershipInferenceAttributes.JSON_PROPERTY_CONFIDENCE, + OwnershipInferenceAttributes.JSON_PROPERTY_CREATED_AT, + OwnershipInferenceAttributes.JSON_PROPERTY_EVIDENCE_VERSIONS, + OwnershipInferenceAttributes.JSON_PROPERTY_EXPLANATION, + OwnershipInferenceAttributes.JSON_PROPERTY_OWNER_TYPE, + OwnershipInferenceAttributes.JSON_PROPERTY_PRIMARY_CONTACT_REF, + OwnershipInferenceAttributes.JSON_PROPERTY_SOURCES, + OwnershipInferenceAttributes.JSON_PROPERTY_STATUS, + OwnershipInferenceAttributes.JSON_PROPERTY_UPDATED_AT +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OwnershipInferenceAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CHECKSUM = "checksum"; + private String checksum; + + public static final String JSON_PROPERTY_CONFIDENCE = "confidence"; + private String confidence; + + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_EVIDENCE_VERSIONS = "evidence_versions"; + private List> evidenceVersions = new ArrayList<>(); + + public static final String JSON_PROPERTY_EXPLANATION = "explanation"; + private String explanation; + + public static final String JSON_PROPERTY_OWNER_TYPE = "owner_type"; + private OwnershipOwnerType ownerType; + + public static final String JSON_PROPERTY_PRIMARY_CONTACT_REF = "primary_contact_ref"; + private JsonNullable primaryContactRef = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_SOURCES = "sources"; + private List> sources = new ArrayList<>(); + + public static final String JSON_PROPERTY_STATUS = "status"; + private OwnershipInferenceStatus status; + + public static final String JSON_PROPERTY_UPDATED_AT = "updated_at"; + private OffsetDateTime updatedAt; + + public OwnershipInferenceAttributes() {} + + @JsonCreator + public OwnershipInferenceAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_CHECKSUM) String checksum, + @JsonProperty(required = true, value = JSON_PROPERTY_CONFIDENCE) String confidence, + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_AT) OffsetDateTime createdAt, + @JsonProperty(required = true, value = JSON_PROPERTY_EVIDENCE_VERSIONS) + List> evidenceVersions, + @JsonProperty(required = true, value = JSON_PROPERTY_EXPLANATION) String explanation, + @JsonProperty(required = true, value = JSON_PROPERTY_OWNER_TYPE) OwnershipOwnerType ownerType, + @JsonProperty(required = true, value = JSON_PROPERTY_SOURCES) + List> sources, + @JsonProperty(required = true, value = JSON_PROPERTY_STATUS) OwnershipInferenceStatus status, + @JsonProperty(required = true, value = JSON_PROPERTY_UPDATED_AT) OffsetDateTime updatedAt) { + this.checksum = checksum; + this.confidence = confidence; + this.createdAt = createdAt; + this.evidenceVersions = evidenceVersions; + if (evidenceVersions != null) {} + this.explanation = explanation; + this.ownerType = ownerType; + this.unparsed |= !ownerType.isValid(); + this.sources = sources; + this.status = status; + this.unparsed |= !status.isValid(); + this.updatedAt = updatedAt; + } + + public OwnershipInferenceAttributes checksum(String checksum) { + this.checksum = checksum; + return this; + } + + /** + * A checksum that uniquely identifies the current state of the inference. Required when + * submitting feedback. + * + * @return checksum + */ + @JsonProperty(JSON_PROPERTY_CHECKSUM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getChecksum() { + return checksum; + } + + public void setChecksum(String checksum) { + this.checksum = checksum; + } + + public OwnershipInferenceAttributes confidence(String confidence) { + this.confidence = confidence; + return this; + } + + /** + * The confidence score of the inference, expressed as a numeric string with up to four decimal + * places. + * + * @return confidence + */ + @JsonProperty(JSON_PROPERTY_CONFIDENCE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getConfidence() { + return confidence; + } + + public void setConfidence(String confidence) { + this.confidence = confidence; + } + + public OwnershipInferenceAttributes createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The time when the inference was created. + * + * @return createdAt + */ + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public OwnershipInferenceAttributes evidenceVersions(List> evidenceVersions) { + this.evidenceVersions = evidenceVersions; + return this; + } + + public OwnershipInferenceAttributes addEvidenceVersionsItem( + Map evidenceVersionsItem) { + this.evidenceVersions.add(evidenceVersionsItem); + return this; + } + + /** + * The list of evidence versions associated with an inference. + * + * @return evidenceVersions + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EVIDENCE_VERSIONS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List> getEvidenceVersions() { + return evidenceVersions; + } + + public void setEvidenceVersions(List> evidenceVersions) { + this.evidenceVersions = evidenceVersions; + } + + public OwnershipInferenceAttributes explanation(String explanation) { + this.explanation = explanation; + return this; + } + + /** + * A human-readable explanation of how the inference was produced. + * + * @return explanation + */ + @JsonProperty(JSON_PROPERTY_EXPLANATION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getExplanation() { + return explanation; + } + + public void setExplanation(String explanation) { + this.explanation = explanation; + } + + public OwnershipInferenceAttributes ownerType(OwnershipOwnerType ownerType) { + this.ownerType = ownerType; + this.unparsed |= !ownerType.isValid(); + return this; + } + + /** + * The owner type for an ownership inference. + * + * @return ownerType + */ + @JsonProperty(JSON_PROPERTY_OWNER_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipOwnerType getOwnerType() { + return ownerType; + } + + public void setOwnerType(OwnershipOwnerType ownerType) { + if (!ownerType.isValid()) { + this.unparsed = true; + } + this.ownerType = ownerType; + } + + public OwnershipInferenceAttributes primaryContactRef(String primaryContactRef) { + this.primaryContactRef = JsonNullable.of(primaryContactRef); + return this; + } + + /** + * The primary contact reference for the inferred owner, formatted as + * ref:handle/<owner_handle>. + * + * @return primaryContactRef + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getPrimaryContactRef() { + return primaryContactRef.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_PRIMARY_CONTACT_REF) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getPrimaryContactRef_JsonNullable() { + return primaryContactRef; + } + + @JsonProperty(JSON_PROPERTY_PRIMARY_CONTACT_REF) + public void setPrimaryContactRef_JsonNullable(JsonNullable primaryContactRef) { + this.primaryContactRef = primaryContactRef; + } + + public void setPrimaryContactRef(String primaryContactRef) { + this.primaryContactRef = JsonNullable.of(primaryContactRef); + } + + public OwnershipInferenceAttributes sources(List> sources) { + this.sources = sources; + return this; + } + + public OwnershipInferenceAttributes addSourcesItem(Map sourcesItem) { + this.sources.add(sourcesItem); + return this; + } + + /** + * The list of sources backing an ownership inference. Empty when the inference status is not + * whitelisted to expose sources. + * + * @return sources + */ + @JsonProperty(JSON_PROPERTY_SOURCES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List> getSources() { + return sources; + } + + public void setSources(List> sources) { + this.sources = sources; + } + + public OwnershipInferenceAttributes status(OwnershipInferenceStatus status) { + this.status = status; + this.unparsed |= !status.isValid(); + return this; + } + + /** + * The lifecycle status of an ownership inference. + * + * @return status + */ + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipInferenceStatus getStatus() { + return status; + } + + public void setStatus(OwnershipInferenceStatus status) { + if (!status.isValid()) { + this.unparsed = true; + } + this.status = status; + } + + public OwnershipInferenceAttributes updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * The time when the inference was last updated. + * + * @return updatedAt + */ + @JsonProperty(JSON_PROPERTY_UPDATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return OwnershipInferenceAttributes + */ + @JsonAnySetter + public OwnershipInferenceAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this OwnershipInferenceAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OwnershipInferenceAttributes ownershipInferenceAttributes = (OwnershipInferenceAttributes) o; + return Objects.equals(this.checksum, ownershipInferenceAttributes.checksum) + && Objects.equals(this.confidence, ownershipInferenceAttributes.confidence) + && Objects.equals(this.createdAt, ownershipInferenceAttributes.createdAt) + && Objects.equals(this.evidenceVersions, ownershipInferenceAttributes.evidenceVersions) + && Objects.equals(this.explanation, ownershipInferenceAttributes.explanation) + && Objects.equals(this.ownerType, ownershipInferenceAttributes.ownerType) + && Objects.equals(this.primaryContactRef, ownershipInferenceAttributes.primaryContactRef) + && Objects.equals(this.sources, ownershipInferenceAttributes.sources) + && Objects.equals(this.status, ownershipInferenceAttributes.status) + && Objects.equals(this.updatedAt, ownershipInferenceAttributes.updatedAt) + && Objects.equals( + this.additionalProperties, ownershipInferenceAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + checksum, + confidence, + createdAt, + evidenceVersions, + explanation, + ownerType, + primaryContactRef, + sources, + status, + updatedAt, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OwnershipInferenceAttributes {\n"); + sb.append(" checksum: ").append(toIndentedString(checksum)).append("\n"); + sb.append(" confidence: ").append(toIndentedString(confidence)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" evidenceVersions: ").append(toIndentedString(evidenceVersions)).append("\n"); + sb.append(" explanation: ").append(toIndentedString(explanation)).append("\n"); + sb.append(" ownerType: ").append(toIndentedString(ownerType)).append("\n"); + sb.append(" primaryContactRef: ").append(toIndentedString(primaryContactRef)).append("\n"); + sb.append(" sources: ").append(toIndentedString(sources)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OwnershipInferenceData.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipInferenceData.java new file mode 100644 index 00000000000..0d9d3a6aac3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipInferenceData.java @@ -0,0 +1,210 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The data wrapper for a single ownership inference response. */ +@JsonPropertyOrder({ + OwnershipInferenceData.JSON_PROPERTY_ATTRIBUTES, + OwnershipInferenceData.JSON_PROPERTY_ID, + OwnershipInferenceData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OwnershipInferenceData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private OwnershipInferenceAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private OwnershipInferenceType type = OwnershipInferenceType.OWNERSHIP_INFERENCE; + + public OwnershipInferenceData() {} + + @JsonCreator + public OwnershipInferenceData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + OwnershipInferenceAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) OwnershipInferenceType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public OwnershipInferenceData attributes(OwnershipInferenceAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes of a single ownership inference. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipInferenceAttributes getAttributes() { + return attributes; + } + + public void setAttributes(OwnershipInferenceAttributes attributes) { + this.attributes = attributes; + } + + public OwnershipInferenceData id(String id) { + this.id = id; + return this; + } + + /** + * The identifier of the inference, formatted as resource_id:owner_type. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public OwnershipInferenceData type(OwnershipInferenceType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of the ownership inference resource. The value should always be + * ownership_inference. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipInferenceType getType() { + return type; + } + + public void setType(OwnershipInferenceType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return OwnershipInferenceData + */ + @JsonAnySetter + public OwnershipInferenceData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this OwnershipInferenceData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OwnershipInferenceData ownershipInferenceData = (OwnershipInferenceData) o; + return Objects.equals(this.attributes, ownershipInferenceData.attributes) + && Objects.equals(this.id, ownershipInferenceData.id) + && Objects.equals(this.type, ownershipInferenceData.type) + && Objects.equals(this.additionalProperties, ownershipInferenceData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OwnershipInferenceData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OwnershipInferenceItem.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipInferenceItem.java new file mode 100644 index 00000000000..9db4003b5af --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipInferenceItem.java @@ -0,0 +1,478 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** A single ownership inference, scoped to a specific owner type. */ +@JsonPropertyOrder({ + OwnershipInferenceItem.JSON_PROPERTY_CHECKSUM, + OwnershipInferenceItem.JSON_PROPERTY_CONFIDENCE, + OwnershipInferenceItem.JSON_PROPERTY_CREATED_AT, + OwnershipInferenceItem.JSON_PROPERTY_EVIDENCE_VERSIONS, + OwnershipInferenceItem.JSON_PROPERTY_EXPLANATION, + OwnershipInferenceItem.JSON_PROPERTY_ID, + OwnershipInferenceItem.JSON_PROPERTY_OWNER_TYPE, + OwnershipInferenceItem.JSON_PROPERTY_PRIMARY_CONTACT_REF, + OwnershipInferenceItem.JSON_PROPERTY_SOURCES, + OwnershipInferenceItem.JSON_PROPERTY_STATUS, + OwnershipInferenceItem.JSON_PROPERTY_UPDATED_AT +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OwnershipInferenceItem { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CHECKSUM = "checksum"; + private String checksum; + + public static final String JSON_PROPERTY_CONFIDENCE = "confidence"; + private String confidence; + + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_EVIDENCE_VERSIONS = "evidence_versions"; + private List> evidenceVersions = new ArrayList<>(); + + public static final String JSON_PROPERTY_EXPLANATION = "explanation"; + private String explanation; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_OWNER_TYPE = "owner_type"; + private OwnershipOwnerType ownerType; + + public static final String JSON_PROPERTY_PRIMARY_CONTACT_REF = "primary_contact_ref"; + private JsonNullable primaryContactRef = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_SOURCES = "sources"; + private List> sources = new ArrayList<>(); + + public static final String JSON_PROPERTY_STATUS = "status"; + private OwnershipInferenceStatus status; + + public static final String JSON_PROPERTY_UPDATED_AT = "updated_at"; + private OffsetDateTime updatedAt; + + public OwnershipInferenceItem() {} + + @JsonCreator + public OwnershipInferenceItem( + @JsonProperty(required = true, value = JSON_PROPERTY_CHECKSUM) String checksum, + @JsonProperty(required = true, value = JSON_PROPERTY_CONFIDENCE) String confidence, + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_AT) OffsetDateTime createdAt, + @JsonProperty(required = true, value = JSON_PROPERTY_EVIDENCE_VERSIONS) + List> evidenceVersions, + @JsonProperty(required = true, value = JSON_PROPERTY_EXPLANATION) String explanation, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_OWNER_TYPE) OwnershipOwnerType ownerType, + @JsonProperty(required = true, value = JSON_PROPERTY_SOURCES) + List> sources, + @JsonProperty(required = true, value = JSON_PROPERTY_STATUS) OwnershipInferenceStatus status, + @JsonProperty(required = true, value = JSON_PROPERTY_UPDATED_AT) OffsetDateTime updatedAt) { + this.checksum = checksum; + this.confidence = confidence; + this.createdAt = createdAt; + this.evidenceVersions = evidenceVersions; + if (evidenceVersions != null) {} + this.explanation = explanation; + this.id = id; + this.ownerType = ownerType; + this.unparsed |= !ownerType.isValid(); + this.sources = sources; + this.status = status; + this.unparsed |= !status.isValid(); + this.updatedAt = updatedAt; + } + + public OwnershipInferenceItem checksum(String checksum) { + this.checksum = checksum; + return this; + } + + /** + * A checksum that uniquely identifies the current state of the inference. Required when + * submitting feedback. + * + * @return checksum + */ + @JsonProperty(JSON_PROPERTY_CHECKSUM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getChecksum() { + return checksum; + } + + public void setChecksum(String checksum) { + this.checksum = checksum; + } + + public OwnershipInferenceItem confidence(String confidence) { + this.confidence = confidence; + return this; + } + + /** + * The confidence score of the inference, expressed as a numeric string with up to four decimal + * places. + * + * @return confidence + */ + @JsonProperty(JSON_PROPERTY_CONFIDENCE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getConfidence() { + return confidence; + } + + public void setConfidence(String confidence) { + this.confidence = confidence; + } + + public OwnershipInferenceItem createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The time when the inference was created. + * + * @return createdAt + */ + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public OwnershipInferenceItem evidenceVersions(List> evidenceVersions) { + this.evidenceVersions = evidenceVersions; + return this; + } + + public OwnershipInferenceItem addEvidenceVersionsItem(Map evidenceVersionsItem) { + this.evidenceVersions.add(evidenceVersionsItem); + return this; + } + + /** + * The list of evidence versions associated with an inference. + * + * @return evidenceVersions + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EVIDENCE_VERSIONS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List> getEvidenceVersions() { + return evidenceVersions; + } + + public void setEvidenceVersions(List> evidenceVersions) { + this.evidenceVersions = evidenceVersions; + } + + public OwnershipInferenceItem explanation(String explanation) { + this.explanation = explanation; + return this; + } + + /** + * A human-readable explanation of how the inference was produced. + * + * @return explanation + */ + @JsonProperty(JSON_PROPERTY_EXPLANATION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getExplanation() { + return explanation; + } + + public void setExplanation(String explanation) { + this.explanation = explanation; + } + + public OwnershipInferenceItem id(String id) { + this.id = id; + return this; + } + + /** + * The identifier of the inference, formatted as resource_id:owner_type. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public OwnershipInferenceItem ownerType(OwnershipOwnerType ownerType) { + this.ownerType = ownerType; + this.unparsed |= !ownerType.isValid(); + return this; + } + + /** + * The owner type for an ownership inference. + * + * @return ownerType + */ + @JsonProperty(JSON_PROPERTY_OWNER_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipOwnerType getOwnerType() { + return ownerType; + } + + public void setOwnerType(OwnershipOwnerType ownerType) { + if (!ownerType.isValid()) { + this.unparsed = true; + } + this.ownerType = ownerType; + } + + public OwnershipInferenceItem primaryContactRef(String primaryContactRef) { + this.primaryContactRef = JsonNullable.of(primaryContactRef); + return this; + } + + /** + * The primary contact reference for the inferred owner, formatted as + * ref:handle/<owner_handle>. + * + * @return primaryContactRef + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getPrimaryContactRef() { + return primaryContactRef.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_PRIMARY_CONTACT_REF) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getPrimaryContactRef_JsonNullable() { + return primaryContactRef; + } + + @JsonProperty(JSON_PROPERTY_PRIMARY_CONTACT_REF) + public void setPrimaryContactRef_JsonNullable(JsonNullable primaryContactRef) { + this.primaryContactRef = primaryContactRef; + } + + public void setPrimaryContactRef(String primaryContactRef) { + this.primaryContactRef = JsonNullable.of(primaryContactRef); + } + + public OwnershipInferenceItem sources(List> sources) { + this.sources = sources; + return this; + } + + public OwnershipInferenceItem addSourcesItem(Map sourcesItem) { + this.sources.add(sourcesItem); + return this; + } + + /** + * The list of sources backing an ownership inference. Empty when the inference status is not + * whitelisted to expose sources. + * + * @return sources + */ + @JsonProperty(JSON_PROPERTY_SOURCES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List> getSources() { + return sources; + } + + public void setSources(List> sources) { + this.sources = sources; + } + + public OwnershipInferenceItem status(OwnershipInferenceStatus status) { + this.status = status; + this.unparsed |= !status.isValid(); + return this; + } + + /** + * The lifecycle status of an ownership inference. + * + * @return status + */ + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipInferenceStatus getStatus() { + return status; + } + + public void setStatus(OwnershipInferenceStatus status) { + if (!status.isValid()) { + this.unparsed = true; + } + this.status = status; + } + + public OwnershipInferenceItem updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * The time when the inference was last updated. + * + * @return updatedAt + */ + @JsonProperty(JSON_PROPERTY_UPDATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return OwnershipInferenceItem + */ + @JsonAnySetter + public OwnershipInferenceItem putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this OwnershipInferenceItem object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OwnershipInferenceItem ownershipInferenceItem = (OwnershipInferenceItem) o; + return Objects.equals(this.checksum, ownershipInferenceItem.checksum) + && Objects.equals(this.confidence, ownershipInferenceItem.confidence) + && Objects.equals(this.createdAt, ownershipInferenceItem.createdAt) + && Objects.equals(this.evidenceVersions, ownershipInferenceItem.evidenceVersions) + && Objects.equals(this.explanation, ownershipInferenceItem.explanation) + && Objects.equals(this.id, ownershipInferenceItem.id) + && Objects.equals(this.ownerType, ownershipInferenceItem.ownerType) + && Objects.equals(this.primaryContactRef, ownershipInferenceItem.primaryContactRef) + && Objects.equals(this.sources, ownershipInferenceItem.sources) + && Objects.equals(this.status, ownershipInferenceItem.status) + && Objects.equals(this.updatedAt, ownershipInferenceItem.updatedAt) + && Objects.equals(this.additionalProperties, ownershipInferenceItem.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + checksum, + confidence, + createdAt, + evidenceVersions, + explanation, + id, + ownerType, + primaryContactRef, + sources, + status, + updatedAt, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OwnershipInferenceItem {\n"); + sb.append(" checksum: ").append(toIndentedString(checksum)).append("\n"); + sb.append(" confidence: ").append(toIndentedString(confidence)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" evidenceVersions: ").append(toIndentedString(evidenceVersions)).append("\n"); + sb.append(" explanation: ").append(toIndentedString(explanation)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" ownerType: ").append(toIndentedString(ownerType)).append("\n"); + sb.append(" primaryContactRef: ").append(toIndentedString(primaryContactRef)).append("\n"); + sb.append(" sources: ").append(toIndentedString(sources)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OwnershipInferenceListAttributes.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipInferenceListAttributes.java new file mode 100644 index 00000000000..e3bb1e54428 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipInferenceListAttributes.java @@ -0,0 +1,157 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** The attributes of the ownership inferences collection response. */ +@JsonPropertyOrder({OwnershipInferenceListAttributes.JSON_PROPERTY_ITEMS}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OwnershipInferenceListAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ITEMS = "items"; + private List items = new ArrayList<>(); + + public OwnershipInferenceListAttributes() {} + + @JsonCreator + public OwnershipInferenceListAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_ITEMS) + List items) { + this.items = items; + } + + public OwnershipInferenceListAttributes items(List items) { + this.items = items; + for (OwnershipInferenceItem item : items) { + this.unparsed |= item.unparsed; + } + return this; + } + + public OwnershipInferenceListAttributes addItemsItem(OwnershipInferenceItem itemsItem) { + this.items.add(itemsItem); + this.unparsed |= itemsItem.unparsed; + return this; + } + + /** + * The list of inferences for a resource, with one inference per owner type. + * + * @return items + */ + @JsonProperty(JSON_PROPERTY_ITEMS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return OwnershipInferenceListAttributes + */ + @JsonAnySetter + public OwnershipInferenceListAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this OwnershipInferenceListAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OwnershipInferenceListAttributes ownershipInferenceListAttributes = + (OwnershipInferenceListAttributes) o; + return Objects.equals(this.items, ownershipInferenceListAttributes.items) + && Objects.equals( + this.additionalProperties, ownershipInferenceListAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OwnershipInferenceListAttributes {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OwnershipInferenceListData.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipInferenceListData.java new file mode 100644 index 00000000000..a62a3346ffb --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipInferenceListData.java @@ -0,0 +1,211 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The data wrapper for the ownership inferences collection response. */ +@JsonPropertyOrder({ + OwnershipInferenceListData.JSON_PROPERTY_ATTRIBUTES, + OwnershipInferenceListData.JSON_PROPERTY_ID, + OwnershipInferenceListData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OwnershipInferenceListData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private OwnershipInferenceListAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private OwnershipInferencesType type = OwnershipInferencesType.OWNERSHIP_INFERENCES; + + public OwnershipInferenceListData() {} + + @JsonCreator + public OwnershipInferenceListData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + OwnershipInferenceListAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) OwnershipInferencesType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public OwnershipInferenceListData attributes(OwnershipInferenceListAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes of the ownership inferences collection response. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipInferenceListAttributes getAttributes() { + return attributes; + } + + public void setAttributes(OwnershipInferenceListAttributes attributes) { + this.attributes = attributes; + } + + public OwnershipInferenceListData id(String id) { + this.id = id; + return this; + } + + /** + * The resource identifier associated with the returned inferences. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public OwnershipInferenceListData type(OwnershipInferencesType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of the ownership inferences collection resource. The value should always be + * ownership_inferences. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipInferencesType getType() { + return type; + } + + public void setType(OwnershipInferencesType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return OwnershipInferenceListData + */ + @JsonAnySetter + public OwnershipInferenceListData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this OwnershipInferenceListData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OwnershipInferenceListData ownershipInferenceListData = (OwnershipInferenceListData) o; + return Objects.equals(this.attributes, ownershipInferenceListData.attributes) + && Objects.equals(this.id, ownershipInferenceListData.id) + && Objects.equals(this.type, ownershipInferenceListData.type) + && Objects.equals( + this.additionalProperties, ownershipInferenceListData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OwnershipInferenceListData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OwnershipInferenceListResponse.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipInferenceListResponse.java new file mode 100644 index 00000000000..068cb0714af --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipInferenceListResponse.java @@ -0,0 +1,147 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The response returned when listing all current ownership inferences for a resource. */ +@JsonPropertyOrder({OwnershipInferenceListResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OwnershipInferenceListResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private OwnershipInferenceListData data; + + public OwnershipInferenceListResponse() {} + + @JsonCreator + public OwnershipInferenceListResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) OwnershipInferenceListData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public OwnershipInferenceListResponse data(OwnershipInferenceListData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The data wrapper for the ownership inferences collection response. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipInferenceListData getData() { + return data; + } + + public void setData(OwnershipInferenceListData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return OwnershipInferenceListResponse + */ + @JsonAnySetter + public OwnershipInferenceListResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this OwnershipInferenceListResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OwnershipInferenceListResponse ownershipInferenceListResponse = + (OwnershipInferenceListResponse) o; + return Objects.equals(this.data, ownershipInferenceListResponse.data) + && Objects.equals( + this.additionalProperties, ownershipInferenceListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OwnershipInferenceListResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OwnershipInferenceResponse.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipInferenceResponse.java new file mode 100644 index 00000000000..e158b5349b2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipInferenceResponse.java @@ -0,0 +1,146 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The response returned when retrieving a single ownership inference for an owner type. */ +@JsonPropertyOrder({OwnershipInferenceResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OwnershipInferenceResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private OwnershipInferenceData data; + + public OwnershipInferenceResponse() {} + + @JsonCreator + public OwnershipInferenceResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) OwnershipInferenceData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public OwnershipInferenceResponse data(OwnershipInferenceData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The data wrapper for a single ownership inference response. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipInferenceData getData() { + return data; + } + + public void setData(OwnershipInferenceData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return OwnershipInferenceResponse + */ + @JsonAnySetter + public OwnershipInferenceResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this OwnershipInferenceResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OwnershipInferenceResponse ownershipInferenceResponse = (OwnershipInferenceResponse) o; + return Objects.equals(this.data, ownershipInferenceResponse.data) + && Objects.equals( + this.additionalProperties, ownershipInferenceResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OwnershipInferenceResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OwnershipInferenceStatus.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipInferenceStatus.java new file mode 100644 index 00000000000..65ae9b2a11a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipInferenceStatus.java @@ -0,0 +1,64 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The lifecycle status of an ownership inference. */ +@JsonSerialize(using = OwnershipInferenceStatus.OwnershipInferenceStatusSerializer.class) +public class OwnershipInferenceStatus extends ModelEnum { + + private static final Set allowedValues = + new HashSet( + Arrays.asList("suggested", "persisted", "overridden", "failed", "unknown")); + + public static final OwnershipInferenceStatus SUGGESTED = + new OwnershipInferenceStatus("suggested"); + public static final OwnershipInferenceStatus PERSISTED = + new OwnershipInferenceStatus("persisted"); + public static final OwnershipInferenceStatus OVERRIDDEN = + new OwnershipInferenceStatus("overridden"); + public static final OwnershipInferenceStatus FAILED = new OwnershipInferenceStatus("failed"); + public static final OwnershipInferenceStatus UNKNOWN = new OwnershipInferenceStatus("unknown"); + + OwnershipInferenceStatus(String value) { + super(value, allowedValues); + } + + public static class OwnershipInferenceStatusSerializer + extends StdSerializer { + public OwnershipInferenceStatusSerializer(Class t) { + super(t); + } + + public OwnershipInferenceStatusSerializer() { + this(null); + } + + @Override + public void serialize( + OwnershipInferenceStatus value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static OwnershipInferenceStatus fromValue(String value) { + return new OwnershipInferenceStatus(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OwnershipInferenceType.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipInferenceType.java new file mode 100644 index 00000000000..38f97260d33 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipInferenceType.java @@ -0,0 +1,60 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** + * The type of the ownership inference resource. The value should always be + * ownership_inference. + */ +@JsonSerialize(using = OwnershipInferenceType.OwnershipInferenceTypeSerializer.class) +public class OwnershipInferenceType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("ownership_inference")); + + public static final OwnershipInferenceType OWNERSHIP_INFERENCE = + new OwnershipInferenceType("ownership_inference"); + + OwnershipInferenceType(String value) { + super(value, allowedValues); + } + + public static class OwnershipInferenceTypeSerializer + extends StdSerializer { + public OwnershipInferenceTypeSerializer(Class t) { + super(t); + } + + public OwnershipInferenceTypeSerializer() { + this(null); + } + + @Override + public void serialize( + OwnershipInferenceType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static OwnershipInferenceType fromValue(String value) { + return new OwnershipInferenceType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OwnershipInferencesType.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipInferencesType.java new file mode 100644 index 00000000000..55f590ad362 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipInferencesType.java @@ -0,0 +1,60 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** + * The type of the ownership inferences collection resource. The value should always be + * ownership_inferences. + */ +@JsonSerialize(using = OwnershipInferencesType.OwnershipInferencesTypeSerializer.class) +public class OwnershipInferencesType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("ownership_inferences")); + + public static final OwnershipInferencesType OWNERSHIP_INFERENCES = + new OwnershipInferencesType("ownership_inferences"); + + OwnershipInferencesType(String value) { + super(value, allowedValues); + } + + public static class OwnershipInferencesTypeSerializer + extends StdSerializer { + public OwnershipInferencesTypeSerializer(Class t) { + super(t); + } + + public OwnershipInferencesTypeSerializer() { + this(null); + } + + @Override + public void serialize( + OwnershipInferencesType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static OwnershipInferencesType fromValue(String value) { + return new OwnershipInferencesType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OwnershipOwnerType.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipOwnerType.java new file mode 100644 index 00000000000..c38f87b13cf --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipOwnerType.java @@ -0,0 +1,57 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The owner type for an ownership inference. */ +@JsonSerialize(using = OwnershipOwnerType.OwnershipOwnerTypeSerializer.class) +public class OwnershipOwnerType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("user", "team", "service", "unknown")); + + public static final OwnershipOwnerType USER = new OwnershipOwnerType("user"); + public static final OwnershipOwnerType TEAM = new OwnershipOwnerType("team"); + public static final OwnershipOwnerType SERVICE = new OwnershipOwnerType("service"); + public static final OwnershipOwnerType UNKNOWN = new OwnershipOwnerType("unknown"); + + OwnershipOwnerType(String value) { + super(value, allowedValues); + } + + public static class OwnershipOwnerTypeSerializer extends StdSerializer { + public OwnershipOwnerTypeSerializer(Class t) { + super(t); + } + + public OwnershipOwnerTypeSerializer() { + this(null); + } + + @Override + public void serialize(OwnershipOwnerType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static OwnershipOwnerType fromValue(String value) { + return new OwnershipOwnerType(value); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/csm_ownership.feature b/src/test/resources/com/datadog/api/client/v2/api/csm_ownership.feature new file mode 100644 index 00000000000..58498ca1550 --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/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/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index 64ba52bc401..9ee7b334713 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/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": {