From ff5b03c6611ca67112186ccc9b578d4b5e141d3e Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 10 Jun 2026 08:31:15 +0000 Subject: [PATCH] Regenerate client from commit cb0f041 of spec repo --- .generator/schemas/v2/openapi.yaml | 1058 +++++++++++++++++ .../csm-ownership/CreateOwnershipFeedback.rb | 23 + .../v2/csm-ownership/GetOwnershipEvidence.rb | 8 + .../v2/csm-ownership/GetOwnershipInference.rb | 8 + .../v2/csm-ownership/ListOwnershipHistory.rb | 8 + .../ListOwnershipHistoryByOwnerType.rb | 8 + .../csm-ownership/ListOwnershipInferences.rb | 8 + features/scenarios_model_mapping.rb | 29 + features/v2/csm_ownership.feature | 165 +++ features/v2/undo.json | 36 + lib/datadog_api_client/configuration.rb | 6 + lib/datadog_api_client/inflector.rb | 31 + .../v2/api/csm_ownership_api.rb | 531 +++++++++ .../models/ownership_evidence_attributes.rb | 115 ++ .../v2/models/ownership_evidence_data.rb | 165 +++ .../v2/models/ownership_evidence_response.rb | 123 ++ .../v2/models/ownership_evidence_type.rb | 26 + .../v2/models/ownership_feedback_action.rb | 29 + .../v2/models/ownership_feedback_request.rb | 123 ++ .../ownership_feedback_request_attributes.rb | 226 ++++ .../models/ownership_feedback_request_data.rb | 144 +++ .../v2/models/ownership_feedback_response.rb | 123 ++ .../ownership_feedback_result_attributes.rb | 246 ++++ .../models/ownership_feedback_result_data.rb | 165 +++ .../models/ownership_feedback_result_type.rb | 26 + .../v2/models/ownership_feedback_type.rb | 26 + .../v2/models/ownership_history_attributes.rb | 146 +++ .../v2/models/ownership_history_data.rb | 165 +++ .../v2/models/ownership_history_item.rb | 357 ++++++ .../v2/models/ownership_history_pagination.rb | 141 +++ .../v2/models/ownership_history_response.rb | 123 ++ .../v2/models/ownership_history_type.rb | 26 + .../models/ownership_inference_attributes.rb | 303 +++++ .../v2/models/ownership_inference_data.rb | 165 +++ .../v2/models/ownership_inference_item.rb | 324 +++++ .../ownership_inference_list_attributes.rb | 125 ++ .../models/ownership_inference_list_data.rb | 165 +++ .../ownership_inference_list_response.rb | 123 ++ .../v2/models/ownership_inference_response.rb | 123 ++ .../v2/models/ownership_inference_status.rb | 30 + .../v2/models/ownership_inference_type.rb | 26 + .../v2/models/ownership_inferences_type.rb | 26 + .../v2/models/ownership_owner_type.rb | 29 + 43 files changed, 5853 insertions(+) create mode 100644 examples/v2/csm-ownership/CreateOwnershipFeedback.rb create mode 100644 examples/v2/csm-ownership/GetOwnershipEvidence.rb create mode 100644 examples/v2/csm-ownership/GetOwnershipInference.rb create mode 100644 examples/v2/csm-ownership/ListOwnershipHistory.rb create mode 100644 examples/v2/csm-ownership/ListOwnershipHistoryByOwnerType.rb create mode 100644 examples/v2/csm-ownership/ListOwnershipInferences.rb create mode 100644 features/v2/csm_ownership.feature create mode 100644 lib/datadog_api_client/v2/api/csm_ownership_api.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_evidence_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_evidence_data.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_evidence_response.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_evidence_type.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_feedback_action.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_feedback_request.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_feedback_request_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_feedback_request_data.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_feedback_response.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_feedback_result_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_feedback_result_data.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_feedback_result_type.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_feedback_type.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_history_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_history_data.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_history_item.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_history_pagination.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_history_response.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_history_type.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_inference_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_inference_data.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_inference_item.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_inference_list_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_inference_list_data.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_inference_list_response.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_inference_response.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_inference_status.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_inference_type.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_inferences_type.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_owner_type.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 134a7ef0ee8f..b0d9d61d1341 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.rb b/examples/v2/csm-ownership/CreateOwnershipFeedback.rb new file mode 100644 index 000000000000..d93954695653 --- /dev/null +++ b/examples/v2/csm-ownership/CreateOwnershipFeedback.rb @@ -0,0 +1,23 @@ +# Submit feedback on an ownership inference returns "Created" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.create_ownership_feedback".to_sym] = true +end +api_instance = DatadogAPIClient::V2::CSMOwnershipAPI.new + +body = DatadogAPIClient::V2::OwnershipFeedbackRequest.new({ + data: DatadogAPIClient::V2::OwnershipFeedbackRequestData.new({ + attributes: DatadogAPIClient::V2::OwnershipFeedbackRequestAttributes.new({ + action: DatadogAPIClient::V2::OwnershipFeedbackAction::CONFIRM, + actor_handle: "user@example.com", + actor_type: "user", + corrected_owner_handle: "team-b", + corrected_owner_type: "team", + inference_checksum: "abc123", + reason: "Confirmed by team lead.", + }), + type: DatadogAPIClient::V2::OwnershipFeedbackType::OWNERSHIP_FEEDBACK, + }), +}) +p api_instance.create_ownership_feedback("res-1", OwnershipOwnerType::TEAM, body) diff --git a/examples/v2/csm-ownership/GetOwnershipEvidence.rb b/examples/v2/csm-ownership/GetOwnershipEvidence.rb new file mode 100644 index 000000000000..13e130115777 --- /dev/null +++ b/examples/v2/csm-ownership/GetOwnershipEvidence.rb @@ -0,0 +1,8 @@ +# Get the evidence for an ownership inference returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_ownership_evidence".to_sym] = true +end +api_instance = DatadogAPIClient::V2::CSMOwnershipAPI.new +p api_instance.get_ownership_evidence("test-resource", OwnershipOwnerType::TEAM) diff --git a/examples/v2/csm-ownership/GetOwnershipInference.rb b/examples/v2/csm-ownership/GetOwnershipInference.rb new file mode 100644 index 000000000000..553e9cf59be2 --- /dev/null +++ b/examples/v2/csm-ownership/GetOwnershipInference.rb @@ -0,0 +1,8 @@ +# Get an ownership inference by owner type returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_ownership_inference".to_sym] = true +end +api_instance = DatadogAPIClient::V2::CSMOwnershipAPI.new +p api_instance.get_ownership_inference("test-resource", OwnershipOwnerType::TEAM) diff --git a/examples/v2/csm-ownership/ListOwnershipHistory.rb b/examples/v2/csm-ownership/ListOwnershipHistory.rb new file mode 100644 index 000000000000..329243ce1f97 --- /dev/null +++ b/examples/v2/csm-ownership/ListOwnershipHistory.rb @@ -0,0 +1,8 @@ +# List ownership inference history for a resource returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.list_ownership_history".to_sym] = true +end +api_instance = DatadogAPIClient::V2::CSMOwnershipAPI.new +p api_instance.list_ownership_history("res-1") diff --git a/examples/v2/csm-ownership/ListOwnershipHistoryByOwnerType.rb b/examples/v2/csm-ownership/ListOwnershipHistoryByOwnerType.rb new file mode 100644 index 000000000000..ba7c71ae339b --- /dev/null +++ b/examples/v2/csm-ownership/ListOwnershipHistoryByOwnerType.rb @@ -0,0 +1,8 @@ +# List ownership history by owner type returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.list_ownership_history_by_owner_type".to_sym] = true +end +api_instance = DatadogAPIClient::V2::CSMOwnershipAPI.new +p api_instance.list_ownership_history_by_owner_type("res-1", OwnershipOwnerType::TEAM) diff --git a/examples/v2/csm-ownership/ListOwnershipInferences.rb b/examples/v2/csm-ownership/ListOwnershipInferences.rb new file mode 100644 index 000000000000..74780cc31233 --- /dev/null +++ b/examples/v2/csm-ownership/ListOwnershipInferences.rb @@ -0,0 +1,8 @@ +# List ownership inferences for a resource returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.list_ownership_inferences".to_sym] = true +end +api_instance = DatadogAPIClient::V2::CSMOwnershipAPI.new +p api_instance.list_ownership_inferences("test-resource") diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 19f5f6d44b81..72fb77da5ca2 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -2855,6 +2855,35 @@ "query" => "String", "order_direction" => "OrderDirection", }, + "v2.ListOwnershipInferences" => { + "resource_id" => "String", + }, + "v2.ListOwnershipHistory" => { + "resource_id" => "String", + "cursor" => "String", + "limit" => "Integer", + }, + "v2.GetOwnershipInference" => { + "resource_id" => "String", + "owner_type" => "OwnershipOwnerType", + "if_none_match" => "String", + }, + "v2.GetOwnershipEvidence" => { + "resource_id" => "String", + "owner_type" => "OwnershipOwnerType", + "if_none_match" => "String", + }, + "v2.CreateOwnershipFeedback" => { + "resource_id" => "String", + "owner_type" => "OwnershipOwnerType", + "body" => "OwnershipFeedbackRequest", + }, + "v2.ListOwnershipHistoryByOwnerType" => { + "resource_id" => "String", + "owner_type" => "OwnershipOwnerType", + "cursor" => "String", + "limit" => "Integer", + }, "v2.ListCSMAgentlessHosts" => { "page" => "Integer", "size" => "Integer", diff --git a/features/v2/csm_ownership.feature b/features/v2/csm_ownership.feature new file mode 100644 index 000000000000..58498ca15502 --- /dev/null +++ b/features/v2/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/features/v2/undo.json b/features/v2/undo.json index 64ba52bc401a..9ee7b3347135 100644 --- a/features/v2/undo.json +++ b/features/v2/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": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 5554d5c1e161..dceee8924ed6 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -406,6 +406,12 @@ def initialize "v2.list_cost_tag_metadata_months": false, "v2.list_cost_tag_metadata_orchestrators": false, "v2.search_cost_recommendations": false, + "v2.create_ownership_feedback": false, + "v2.get_ownership_evidence": false, + "v2.get_ownership_inference": false, + "v2.list_ownership_history": false, + "v2.list_ownership_history_by_owner_type": false, + "v2.list_ownership_inferences": false, "v2.get_csm_agentless_host_facet_info": false, "v2.get_csm_unified_host_facet_info": false, "v2.list_csm_agentless_host_facets": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index aa9a5a15eeef..48320ff16688 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -5198,6 +5198,36 @@ def overrides "v2.output_schema_parameters" => "OutputSchemaParameters", "v2.output_schema_parameters_type" => "OutputSchemaParametersType", "v2.overwrite_allocations_request" => "OverwriteAllocationsRequest", + "v2.ownership_evidence_attributes" => "OwnershipEvidenceAttributes", + "v2.ownership_evidence_data" => "OwnershipEvidenceData", + "v2.ownership_evidence_response" => "OwnershipEvidenceResponse", + "v2.ownership_evidence_type" => "OwnershipEvidenceType", + "v2.ownership_feedback_action" => "OwnershipFeedbackAction", + "v2.ownership_feedback_request" => "OwnershipFeedbackRequest", + "v2.ownership_feedback_request_attributes" => "OwnershipFeedbackRequestAttributes", + "v2.ownership_feedback_request_data" => "OwnershipFeedbackRequestData", + "v2.ownership_feedback_response" => "OwnershipFeedbackResponse", + "v2.ownership_feedback_result_attributes" => "OwnershipFeedbackResultAttributes", + "v2.ownership_feedback_result_data" => "OwnershipFeedbackResultData", + "v2.ownership_feedback_result_type" => "OwnershipFeedbackResultType", + "v2.ownership_feedback_type" => "OwnershipFeedbackType", + "v2.ownership_history_attributes" => "OwnershipHistoryAttributes", + "v2.ownership_history_data" => "OwnershipHistoryData", + "v2.ownership_history_item" => "OwnershipHistoryItem", + "v2.ownership_history_pagination" => "OwnershipHistoryPagination", + "v2.ownership_history_response" => "OwnershipHistoryResponse", + "v2.ownership_history_type" => "OwnershipHistoryType", + "v2.ownership_inference_attributes" => "OwnershipInferenceAttributes", + "v2.ownership_inference_data" => "OwnershipInferenceData", + "v2.ownership_inference_item" => "OwnershipInferenceItem", + "v2.ownership_inference_list_attributes" => "OwnershipInferenceListAttributes", + "v2.ownership_inference_list_data" => "OwnershipInferenceListData", + "v2.ownership_inference_list_response" => "OwnershipInferenceListResponse", + "v2.ownership_inference_response" => "OwnershipInferenceResponse", + "v2.ownership_inference_status" => "OwnershipInferenceStatus", + "v2.ownership_inferences_type" => "OwnershipInferencesType", + "v2.ownership_inference_type" => "OwnershipInferenceType", + "v2.ownership_owner_type" => "OwnershipOwnerType", "v2.page_annotations_attributes" => "PageAnnotationsAttributes", "v2.page_annotations_data" => "PageAnnotationsData", "v2.page_annotations_response" => "PageAnnotationsResponse", @@ -7511,6 +7541,7 @@ def overrides "v2.containers_api" => "ContainersAPI", "v2.csm_agents_api" => "CSMAgentsAPI", "v2.csm_coverage_analysis_api" => "CSMCoverageAnalysisAPI", + "v2.csm_ownership_api" => "CSMOwnershipAPI", "v2.csm_settings_api" => "CSMSettingsAPI", "v2.csm_threats_api" => "CSMThreatsAPI", "v2.customer_org_api" => "CustomerOrgAPI", diff --git a/lib/datadog_api_client/v2/api/csm_ownership_api.rb b/lib/datadog_api_client/v2/api/csm_ownership_api.rb new file mode 100644 index 000000000000..a2a2cec66935 --- /dev/null +++ b/lib/datadog_api_client/v2/api/csm_ownership_api.rb @@ -0,0 +1,531 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'cgi' + +module DatadogAPIClient::V2 + class CSMOwnershipAPI + attr_accessor :api_client + + def initialize(api_client = DatadogAPIClient::APIClient.default) + @api_client = api_client + end + + # Submit feedback on an ownership inference. + # + # @see #create_ownership_feedback_with_http_info + def create_ownership_feedback(resource_id, owner_type, body, opts = {}) + data, _status_code, _headers = create_ownership_feedback_with_http_info(resource_id, owner_type, body, opts) + data + end + + # Submit feedback on an ownership inference. + # + # Submit feedback on the current ownership inference for a resource and owner type. Valid actions are `confirm`, `reject`, `correct`, and `persist`. + # + # The request must include the current inference `checksum` in `inference_checksum`. If the checksum does not match the current inference state, the endpoint returns `409 Conflict`. + # + # When `action` is `correct`, `corrected_owner_handle` and `corrected_owner_type` are required. + # + # @param resource_id [String] The identifier of the resource that the feedback applies to. + # @param owner_type [OwnershipOwnerType] The type of owner that the feedback applies to. + # @param body [OwnershipFeedbackRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(OwnershipFeedbackResponse, Integer, Hash)>] OwnershipFeedbackResponse data, response status code and response headers + def create_ownership_feedback_with_http_info(resource_id, owner_type, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.create_ownership_feedback".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_ownership_feedback") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_ownership_feedback")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CSMOwnershipAPI.create_ownership_feedback ...' + end + # verify the required parameter 'resource_id' is set + if @api_client.config.client_side_validation && resource_id.nil? + fail ArgumentError, "Missing the required parameter 'resource_id' when calling CSMOwnershipAPI.create_ownership_feedback" + end + # verify the required parameter 'owner_type' is set + if @api_client.config.client_side_validation && owner_type.nil? + fail ArgumentError, "Missing the required parameter 'owner_type' when calling CSMOwnershipAPI.create_ownership_feedback" + end + # verify enum value + allowable_values = ['user', 'team', 'service', 'unknown'] + if @api_client.config.client_side_validation && !allowable_values.include?(owner_type) + fail ArgumentError, "invalid value for \"owner_type\", must be one of #{allowable_values}" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling CSMOwnershipAPI.create_ownership_feedback" + end + # resource path + local_var_path = '/api/v2/csm/ownership/{resource_id}/{owner_type}/feedback'.sub('{resource_id}', CGI.escape(resource_id.to_s).gsub('%2F', '/')).sub('{owner_type}', CGI.escape(owner_type.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'OwnershipFeedbackResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :create_ownership_feedback, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CSMOwnershipAPI#create_ownership_feedback\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get the evidence for an ownership inference. + # + # @see #get_ownership_evidence_with_http_info + def get_ownership_evidence(resource_id, owner_type, opts = {}) + data, _status_code, _headers = get_ownership_evidence_with_http_info(resource_id, owner_type, opts) + data + end + + # Get the evidence for an ownership inference. + # + # Get the evidence versions backing the current ownership inference for a resource and owner type. + # + # This endpoint supports weak ETag caching. Pass the previously returned `ETag` value in the `If-None-Match` request header to receive a `304 Not Modified` response when the evidence has not changed. + # + # @param resource_id [String] The identifier of the resource to retrieve evidence for. + # @param owner_type [OwnershipOwnerType] The owner type of the inference to retrieve evidence for. + # @param opts [Hash] the optional parameters + # @option opts [String] :if_none_match A previously returned weak `ETag` value. When supplied and the evidence has not changed, the endpoint returns `304 Not Modified`. + # @return [Array<(OwnershipEvidenceResponse, Integer, Hash)>] OwnershipEvidenceResponse data, response status code and response headers + def get_ownership_evidence_with_http_info(resource_id, owner_type, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_ownership_evidence".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_ownership_evidence") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_ownership_evidence")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CSMOwnershipAPI.get_ownership_evidence ...' + end + # verify the required parameter 'resource_id' is set + if @api_client.config.client_side_validation && resource_id.nil? + fail ArgumentError, "Missing the required parameter 'resource_id' when calling CSMOwnershipAPI.get_ownership_evidence" + end + # verify the required parameter 'owner_type' is set + if @api_client.config.client_side_validation && owner_type.nil? + fail ArgumentError, "Missing the required parameter 'owner_type' when calling CSMOwnershipAPI.get_ownership_evidence" + end + # verify enum value + allowable_values = ['user', 'team', 'service', 'unknown'] + if @api_client.config.client_side_validation && !allowable_values.include?(owner_type) + fail ArgumentError, "invalid value for \"owner_type\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/api/v2/csm/ownership/{resource_id}/{owner_type}/evidence'.sub('{resource_id}', CGI.escape(resource_id.to_s).gsub('%2F', '/')).sub('{owner_type}', CGI.escape(owner_type.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['If-None-Match'] = opts[:'if_none_match'] if !opts[:'if_none_match'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'OwnershipEvidenceResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :get_ownership_evidence, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CSMOwnershipAPI#get_ownership_evidence\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get an ownership inference by owner type. + # + # @see #get_ownership_inference_with_http_info + def get_ownership_inference(resource_id, owner_type, opts = {}) + data, _status_code, _headers = get_ownership_inference_with_http_info(resource_id, owner_type, opts) + data + end + + # Get an ownership inference by owner type. + # + # Get the current ownership inference for a resource for a specific owner type. + # + # This endpoint supports ETag-based caching. Pass the previously returned `ETag` value in the `If-None-Match` request header to receive a `304 Not Modified` response when the inference has not changed. + # + # @param resource_id [String] The identifier of the resource to retrieve the ownership inference for. + # @param owner_type [OwnershipOwnerType] The owner type of the inference to retrieve. + # @param opts [Hash] the optional parameters + # @option opts [String] :if_none_match A previously returned `ETag` value. When supplied and the resource has not changed, the endpoint returns `304 Not Modified`. + # @return [Array<(OwnershipInferenceResponse, Integer, Hash)>] OwnershipInferenceResponse data, response status code and response headers + def get_ownership_inference_with_http_info(resource_id, owner_type, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_ownership_inference".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_ownership_inference") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_ownership_inference")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CSMOwnershipAPI.get_ownership_inference ...' + end + # verify the required parameter 'resource_id' is set + if @api_client.config.client_side_validation && resource_id.nil? + fail ArgumentError, "Missing the required parameter 'resource_id' when calling CSMOwnershipAPI.get_ownership_inference" + end + # verify the required parameter 'owner_type' is set + if @api_client.config.client_side_validation && owner_type.nil? + fail ArgumentError, "Missing the required parameter 'owner_type' when calling CSMOwnershipAPI.get_ownership_inference" + end + # verify enum value + allowable_values = ['user', 'team', 'service', 'unknown'] + if @api_client.config.client_side_validation && !allowable_values.include?(owner_type) + fail ArgumentError, "invalid value for \"owner_type\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/api/v2/csm/ownership/{resource_id}/{owner_type}'.sub('{resource_id}', CGI.escape(resource_id.to_s).gsub('%2F', '/')).sub('{owner_type}', CGI.escape(owner_type.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['If-None-Match'] = opts[:'if_none_match'] if !opts[:'if_none_match'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'OwnershipInferenceResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :get_ownership_inference, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CSMOwnershipAPI#get_ownership_inference\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List ownership inference history for a resource. + # + # @see #list_ownership_history_with_http_info + def list_ownership_history(resource_id, opts = {}) + data, _status_code, _headers = list_ownership_history_with_http_info(resource_id, opts) + data + end + + # List ownership inference history for a resource. + # + # List inference history entries for a resource across all owner types, ordered from most recent to oldest. Uses cursor-based pagination. + # + # @param resource_id [String] The identifier of the resource to retrieve inference history for. + # @param opts [Hash] the optional parameters + # @option opts [String] :cursor An opaque, base64-encoded cursor token returned by a previous call in `pagination.next_cursor`. Omit to fetch the first page. + # @option opts [Integer] :limit The maximum number of history entries to return per page. + # @return [Array<(OwnershipHistoryResponse, Integer, Hash)>] OwnershipHistoryResponse data, response status code and response headers + def list_ownership_history_with_http_info(resource_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.list_ownership_history".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_ownership_history") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_ownership_history")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CSMOwnershipAPI.list_ownership_history ...' + end + # verify the required parameter 'resource_id' is set + if @api_client.config.client_side_validation && resource_id.nil? + fail ArgumentError, "Missing the required parameter 'resource_id' when calling CSMOwnershipAPI.list_ownership_history" + end + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling CSMOwnershipAPI.list_ownership_history, must be smaller than or equal to 100.' + end + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling CSMOwnershipAPI.list_ownership_history, must be greater than or equal to 1.' + end + # resource path + local_var_path = '/api/v2/csm/ownership/{resource_id}/history'.sub('{resource_id}', CGI.escape(resource_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil? + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'OwnershipHistoryResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :list_ownership_history, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CSMOwnershipAPI#list_ownership_history\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List ownership history by owner type. + # + # @see #list_ownership_history_by_owner_type_with_http_info + def list_ownership_history_by_owner_type(resource_id, owner_type, opts = {}) + data, _status_code, _headers = list_ownership_history_by_owner_type_with_http_info(resource_id, owner_type, opts) + data + end + + # List ownership history by owner type. + # + # List inference history entries for a resource filtered by owner type, ordered from most recent to oldest. Uses cursor-based pagination. + # + # @param resource_id [String] The identifier of the resource to retrieve inference history for. + # @param owner_type [OwnershipOwnerType] The owner type to filter history by. + # @param opts [Hash] the optional parameters + # @option opts [String] :cursor An opaque, base64-encoded cursor token returned by a previous call in `pagination.next_cursor`. Omit to fetch the first page. + # @option opts [Integer] :limit The maximum number of history entries to return per page. + # @return [Array<(OwnershipHistoryResponse, Integer, Hash)>] OwnershipHistoryResponse data, response status code and response headers + def list_ownership_history_by_owner_type_with_http_info(resource_id, owner_type, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.list_ownership_history_by_owner_type".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_ownership_history_by_owner_type") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_ownership_history_by_owner_type")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CSMOwnershipAPI.list_ownership_history_by_owner_type ...' + end + # verify the required parameter 'resource_id' is set + if @api_client.config.client_side_validation && resource_id.nil? + fail ArgumentError, "Missing the required parameter 'resource_id' when calling CSMOwnershipAPI.list_ownership_history_by_owner_type" + end + # verify the required parameter 'owner_type' is set + if @api_client.config.client_side_validation && owner_type.nil? + fail ArgumentError, "Missing the required parameter 'owner_type' when calling CSMOwnershipAPI.list_ownership_history_by_owner_type" + end + # verify enum value + allowable_values = ['user', 'team', 'service', 'unknown'] + if @api_client.config.client_side_validation && !allowable_values.include?(owner_type) + fail ArgumentError, "invalid value for \"owner_type\", must be one of #{allowable_values}" + end + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling CSMOwnershipAPI.list_ownership_history_by_owner_type, must be smaller than or equal to 100.' + end + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling CSMOwnershipAPI.list_ownership_history_by_owner_type, must be greater than or equal to 1.' + end + # resource path + local_var_path = '/api/v2/csm/ownership/{resource_id}/{owner_type}/history'.sub('{resource_id}', CGI.escape(resource_id.to_s).gsub('%2F', '/')).sub('{owner_type}', CGI.escape(owner_type.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil? + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'OwnershipHistoryResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :list_ownership_history_by_owner_type, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CSMOwnershipAPI#list_ownership_history_by_owner_type\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List ownership inferences for a resource. + # + # @see #list_ownership_inferences_with_http_info + def list_ownership_inferences(resource_id, opts = {}) + data, _status_code, _headers = list_ownership_inferences_with_http_info(resource_id, opts) + data + end + + # List ownership inferences for a resource. + # + # Get all current ownership inferences for a resource, one per owner type (`user`, `team`, `service`, `unknown`). + # + # @param resource_id [String] The identifier of the resource to retrieve ownership inferences for. + # @param opts [Hash] the optional parameters + # @return [Array<(OwnershipInferenceListResponse, Integer, Hash)>] OwnershipInferenceListResponse data, response status code and response headers + def list_ownership_inferences_with_http_info(resource_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.list_ownership_inferences".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_ownership_inferences") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_ownership_inferences")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CSMOwnershipAPI.list_ownership_inferences ...' + end + # verify the required parameter 'resource_id' is set + if @api_client.config.client_side_validation && resource_id.nil? + fail ArgumentError, "Missing the required parameter 'resource_id' when calling CSMOwnershipAPI.list_ownership_inferences" + end + # resource path + local_var_path = '/api/v2/csm/ownership/{resource_id}'.sub('{resource_id}', CGI.escape(resource_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'OwnershipInferenceListResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :list_ownership_inferences, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CSMOwnershipAPI#list_ownership_inferences\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/datadog_api_client/v2/models/ownership_evidence_attributes.rb b/lib/datadog_api_client/v2/models/ownership_evidence_attributes.rb new file mode 100644 index 000000000000..77bcad3d1053 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_evidence_attributes.rb @@ -0,0 +1,115 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The attributes of an ownership evidence response. + class OwnershipEvidenceAttributes + include BaseGenericModel + + # The list of evidence versions associated with an inference. + attr_accessor :evidence_versions + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'evidence_versions' => :'evidence_versions' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'evidence_versions' => :'Array>' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'evidence_versions', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::OwnershipEvidenceAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'evidence_versions') + if (value = attributes[:'evidence_versions']).is_a?(Array) + self.evidence_versions = value + end + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + evidence_versions == o.evidence_versions && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [evidence_versions, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ownership_evidence_data.rb b/lib/datadog_api_client/v2/models/ownership_evidence_data.rb new file mode 100644 index 000000000000..891ae2c88b14 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_evidence_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The data wrapper for an ownership evidence response. + class OwnershipEvidenceData + include BaseGenericModel + + # The attributes of an ownership evidence response. + attr_reader :attributes + + # The identifier of the resource the evidence applies to. + attr_reader :id + + # The type of the ownership evidence resource. The value should always be `ownership_evidence`. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'OwnershipEvidenceAttributes', + :'id' => :'String', + :'type' => :'OwnershipEvidenceType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::OwnershipEvidenceData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ownership_evidence_response.rb b/lib/datadog_api_client/v2/models/ownership_evidence_response.rb new file mode 100644 index 000000000000..4a1296449153 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_evidence_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The response returned when retrieving the evidence backing an ownership inference for an owner type. + class OwnershipEvidenceResponse + include BaseGenericModel + + # The data wrapper for an ownership evidence response. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'OwnershipEvidenceData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::OwnershipEvidenceResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ownership_evidence_type.rb b/lib/datadog_api_client/v2/models/ownership_evidence_type.rb new file mode 100644 index 000000000000..f3f659296d55 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_evidence_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The type of the ownership evidence resource. The value should always be `ownership_evidence`. + class OwnershipEvidenceType + include BaseEnumModel + + OWNERSHIP_EVIDENCE = "ownership_evidence".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/ownership_feedback_action.rb b/lib/datadog_api_client/v2/models/ownership_feedback_action.rb new file mode 100644 index 000000000000..62d92b63c03b --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_feedback_action.rb @@ -0,0 +1,29 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The feedback action to apply to an inference. + class OwnershipFeedbackAction + include BaseEnumModel + + CONFIRM = "confirm".freeze + REJECT = "reject".freeze + CORRECT = "correct".freeze + PERSIST = "persist".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/ownership_feedback_request.rb b/lib/datadog_api_client/v2/models/ownership_feedback_request.rb new file mode 100644 index 000000000000..c9d8584cb106 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_feedback_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The request body for submitting ownership feedback. + class OwnershipFeedbackRequest + include BaseGenericModel + + # The data wrapper for an ownership feedback request. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'OwnershipFeedbackRequestData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::OwnershipFeedbackRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ownership_feedback_request_attributes.rb b/lib/datadog_api_client/v2/models/ownership_feedback_request_attributes.rb new file mode 100644 index 000000000000..6328c79edaca --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_feedback_request_attributes.rb @@ -0,0 +1,226 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The attributes of an ownership feedback request. + class OwnershipFeedbackRequestAttributes + include BaseGenericModel + + # The feedback action to apply to an inference. + attr_reader :action + + # The handle of the actor submitting the feedback. + attr_reader :actor_handle + + # The type of actor submitting the feedback, for example `user` or `service`. + attr_reader :actor_type + + # The corrected owner handle. Required when `action` is `correct`. + attr_accessor :corrected_owner_handle + + # The corrected owner type. Required when `action` is `correct`. + attr_accessor :corrected_owner_type + + # The checksum of the inference being acted upon. Must match the current inference checksum or the request returns a conflict. + attr_reader :inference_checksum + + # An optional free-form reason explaining the feedback. + attr_accessor :reason + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'action' => :'action', + :'actor_handle' => :'actor_handle', + :'actor_type' => :'actor_type', + :'corrected_owner_handle' => :'corrected_owner_handle', + :'corrected_owner_type' => :'corrected_owner_type', + :'inference_checksum' => :'inference_checksum', + :'reason' => :'reason' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'action' => :'OwnershipFeedbackAction', + :'actor_handle' => :'String', + :'actor_type' => :'String', + :'corrected_owner_handle' => :'String', + :'corrected_owner_type' => :'String', + :'inference_checksum' => :'String', + :'reason' => :'String' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'corrected_owner_handle', + :'corrected_owner_type', + :'reason', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::OwnershipFeedbackRequestAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'action') + self.action = attributes[:'action'] + end + + if attributes.key?(:'actor_handle') + self.actor_handle = attributes[:'actor_handle'] + end + + if attributes.key?(:'actor_type') + self.actor_type = attributes[:'actor_type'] + end + + if attributes.key?(:'corrected_owner_handle') + self.corrected_owner_handle = attributes[:'corrected_owner_handle'] + end + + if attributes.key?(:'corrected_owner_type') + self.corrected_owner_type = attributes[:'corrected_owner_type'] + end + + if attributes.key?(:'inference_checksum') + self.inference_checksum = attributes[:'inference_checksum'] + end + + if attributes.key?(:'reason') + self.reason = attributes[:'reason'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @action.nil? + return false if @actor_handle.nil? + return false if @actor_type.nil? + return false if @inference_checksum.nil? + true + end + + # Custom attribute writer method with validation + # @param action [Object] Object to be assigned + # @!visibility private + def action=(action) + if action.nil? + fail ArgumentError, 'invalid value for "action", action cannot be nil.' + end + @action = action + end + + # Custom attribute writer method with validation + # @param actor_handle [Object] Object to be assigned + # @!visibility private + def actor_handle=(actor_handle) + if actor_handle.nil? + fail ArgumentError, 'invalid value for "actor_handle", actor_handle cannot be nil.' + end + @actor_handle = actor_handle + end + + # Custom attribute writer method with validation + # @param actor_type [Object] Object to be assigned + # @!visibility private + def actor_type=(actor_type) + if actor_type.nil? + fail ArgumentError, 'invalid value for "actor_type", actor_type cannot be nil.' + end + @actor_type = actor_type + end + + # Custom attribute writer method with validation + # @param inference_checksum [Object] Object to be assigned + # @!visibility private + def inference_checksum=(inference_checksum) + if inference_checksum.nil? + fail ArgumentError, 'invalid value for "inference_checksum", inference_checksum cannot be nil.' + end + @inference_checksum = inference_checksum + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + action == o.action && + actor_handle == o.actor_handle && + actor_type == o.actor_type && + corrected_owner_handle == o.corrected_owner_handle && + corrected_owner_type == o.corrected_owner_type && + inference_checksum == o.inference_checksum && + reason == o.reason && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [action, actor_handle, actor_type, corrected_owner_handle, corrected_owner_type, inference_checksum, reason, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ownership_feedback_request_data.rb b/lib/datadog_api_client/v2/models/ownership_feedback_request_data.rb new file mode 100644 index 000000000000..8b743d1447ab --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_feedback_request_data.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The data wrapper for an ownership feedback request. + class OwnershipFeedbackRequestData + include BaseGenericModel + + # The attributes of an ownership feedback request. + attr_reader :attributes + + # The type of the ownership feedback request resource. The value should always be `ownership_feedback`. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'OwnershipFeedbackRequestAttributes', + :'type' => :'OwnershipFeedbackType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::OwnershipFeedbackRequestData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ownership_feedback_response.rb b/lib/datadog_api_client/v2/models/ownership_feedback_response.rb new file mode 100644 index 000000000000..5ce00c300d91 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_feedback_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The response returned after applying ownership feedback to an inference. + class OwnershipFeedbackResponse + include BaseGenericModel + + # The data wrapper for an ownership feedback result response. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'OwnershipFeedbackResultData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::OwnershipFeedbackResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ownership_feedback_result_attributes.rb b/lib/datadog_api_client/v2/models/ownership_feedback_result_attributes.rb new file mode 100644 index 000000000000..26f659e4e325 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_feedback_result_attributes.rb @@ -0,0 +1,246 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The attributes of an ownership feedback result. + class OwnershipFeedbackResultAttributes + include BaseGenericModel + + # The feedback action to apply to an inference. + attr_reader :action + + # The checksum of the inference after the feedback was applied. + attr_reader :checksum + + # The lifecycle status of an ownership inference. + attr_reader :new_status + + # The owner type for an ownership inference. + attr_reader :owner_type + + # The lifecycle status of an ownership inference. + attr_reader :previous_status + + # The primary contact reference for the inferred owner after the feedback was applied, formatted as `ref:handle/`. + attr_accessor :primary_contact_ref + + # The time when the inference was updated by the feedback. + attr_reader :updated_at + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'action' => :'action', + :'checksum' => :'checksum', + :'new_status' => :'new_status', + :'owner_type' => :'owner_type', + :'previous_status' => :'previous_status', + :'primary_contact_ref' => :'primary_contact_ref', + :'updated_at' => :'updated_at' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'action' => :'OwnershipFeedbackAction', + :'checksum' => :'String', + :'new_status' => :'OwnershipInferenceStatus', + :'owner_type' => :'OwnershipOwnerType', + :'previous_status' => :'OwnershipInferenceStatus', + :'primary_contact_ref' => :'String', + :'updated_at' => :'Time' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'primary_contact_ref', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::OwnershipFeedbackResultAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'action') + self.action = attributes[:'action'] + end + + if attributes.key?(:'checksum') + self.checksum = attributes[:'checksum'] + end + + if attributes.key?(:'new_status') + self.new_status = attributes[:'new_status'] + end + + if attributes.key?(:'owner_type') + self.owner_type = attributes[:'owner_type'] + end + + if attributes.key?(:'previous_status') + self.previous_status = attributes[:'previous_status'] + end + + if attributes.key?(:'primary_contact_ref') + self.primary_contact_ref = attributes[:'primary_contact_ref'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @action.nil? + return false if @checksum.nil? + return false if @new_status.nil? + return false if @owner_type.nil? + return false if @previous_status.nil? + return false if @updated_at.nil? + true + end + + # Custom attribute writer method with validation + # @param action [Object] Object to be assigned + # @!visibility private + def action=(action) + if action.nil? + fail ArgumentError, 'invalid value for "action", action cannot be nil.' + end + @action = action + end + + # Custom attribute writer method with validation + # @param checksum [Object] Object to be assigned + # @!visibility private + def checksum=(checksum) + if checksum.nil? + fail ArgumentError, 'invalid value for "checksum", checksum cannot be nil.' + end + @checksum = checksum + end + + # Custom attribute writer method with validation + # @param new_status [Object] Object to be assigned + # @!visibility private + def new_status=(new_status) + if new_status.nil? + fail ArgumentError, 'invalid value for "new_status", new_status cannot be nil.' + end + @new_status = new_status + end + + # Custom attribute writer method with validation + # @param owner_type [Object] Object to be assigned + # @!visibility private + def owner_type=(owner_type) + if owner_type.nil? + fail ArgumentError, 'invalid value for "owner_type", owner_type cannot be nil.' + end + @owner_type = owner_type + end + + # Custom attribute writer method with validation + # @param previous_status [Object] Object to be assigned + # @!visibility private + def previous_status=(previous_status) + if previous_status.nil? + fail ArgumentError, 'invalid value for "previous_status", previous_status cannot be nil.' + end + @previous_status = previous_status + end + + # Custom attribute writer method with validation + # @param updated_at [Object] Object to be assigned + # @!visibility private + def updated_at=(updated_at) + if updated_at.nil? + fail ArgumentError, 'invalid value for "updated_at", updated_at cannot be nil.' + end + @updated_at = updated_at + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + action == o.action && + checksum == o.checksum && + new_status == o.new_status && + owner_type == o.owner_type && + previous_status == o.previous_status && + primary_contact_ref == o.primary_contact_ref && + updated_at == o.updated_at && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [action, checksum, new_status, owner_type, previous_status, primary_contact_ref, updated_at, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ownership_feedback_result_data.rb b/lib/datadog_api_client/v2/models/ownership_feedback_result_data.rb new file mode 100644 index 000000000000..60198704fe1a --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_feedback_result_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The data wrapper for an ownership feedback result response. + class OwnershipFeedbackResultData + include BaseGenericModel + + # The attributes of an ownership feedback result. + attr_reader :attributes + + # The identifier of the resource that the feedback was applied to. + attr_reader :id + + # The type of the ownership feedback result resource. The value should always be `ownership_feedback_result`. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'OwnershipFeedbackResultAttributes', + :'id' => :'String', + :'type' => :'OwnershipFeedbackResultType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::OwnershipFeedbackResultData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ownership_feedback_result_type.rb b/lib/datadog_api_client/v2/models/ownership_feedback_result_type.rb new file mode 100644 index 000000000000..3d28ffc91ae6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_feedback_result_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The type of the ownership feedback result resource. The value should always be `ownership_feedback_result`. + class OwnershipFeedbackResultType + include BaseEnumModel + + OWNERSHIP_FEEDBACK_RESULT = "ownership_feedback_result".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/ownership_feedback_type.rb b/lib/datadog_api_client/v2/models/ownership_feedback_type.rb new file mode 100644 index 000000000000..c41fcbd3abf3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_feedback_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The type of the ownership feedback request resource. The value should always be `ownership_feedback`. + class OwnershipFeedbackType + include BaseEnumModel + + OWNERSHIP_FEEDBACK = "ownership_feedback".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/ownership_history_attributes.rb b/lib/datadog_api_client/v2/models/ownership_history_attributes.rb new file mode 100644 index 000000000000..d572e70a03e0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_history_attributes.rb @@ -0,0 +1,146 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The attributes of an ownership history response. + class OwnershipHistoryAttributes + include BaseGenericModel + + # The list of history entries returned for this page. + attr_reader :items + + # Cursor-based pagination metadata for the history response. + attr_reader :pagination + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'items' => :'items', + :'pagination' => :'pagination' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'items' => :'Array', + :'pagination' => :'OwnershipHistoryPagination' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::OwnershipHistoryAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'items') + if (value = attributes[:'items']).is_a?(Array) + self.items = value + end + end + + if attributes.key?(:'pagination') + self.pagination = attributes[:'pagination'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @items.nil? + return false if @pagination.nil? + true + end + + # Custom attribute writer method with validation + # @param items [Object] Object to be assigned + # @!visibility private + def items=(items) + if items.nil? + fail ArgumentError, 'invalid value for "items", items cannot be nil.' + end + @items = items + end + + # Custom attribute writer method with validation + # @param pagination [Object] Object to be assigned + # @!visibility private + def pagination=(pagination) + if pagination.nil? + fail ArgumentError, 'invalid value for "pagination", pagination cannot be nil.' + end + @pagination = pagination + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + items == o.items && + pagination == o.pagination && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [items, pagination, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ownership_history_data.rb b/lib/datadog_api_client/v2/models/ownership_history_data.rb new file mode 100644 index 000000000000..51717403cd88 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_history_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The data wrapper for an ownership history response. + class OwnershipHistoryData + include BaseGenericModel + + # The attributes of an ownership history response. + attr_reader :attributes + + # The resource identifier for which history is returned. + attr_reader :id + + # The type of the ownership history resource. The value should always be `ownership_history`. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'OwnershipHistoryAttributes', + :'id' => :'String', + :'type' => :'OwnershipHistoryType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::OwnershipHistoryData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ownership_history_item.rb b/lib/datadog_api_client/v2/models/ownership_history_item.rb new file mode 100644 index 000000000000..f5bc267d1721 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_history_item.rb @@ -0,0 +1,357 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A single ownership inference history entry. + class OwnershipHistoryItem + include BaseGenericModel + + # A checksum identifying the state of the inference at this point in time. + attr_reader :checksum + + # The confidence score of the inference, expressed as a numeric string with up to four decimal places. + attr_reader :confidence + + # The time this history entry was created. + attr_reader :created_at + + # The list of evidence versions associated with an inference. + attr_accessor :evidence_versions + + # A human-readable explanation of how the inference was produced. + attr_reader :explanation + + # The time when this inference failed, if applicable. + attr_accessor :failed_at + + # The reason why this inference failed, if applicable. + attr_accessor :failure_reason + + # The unique identifier of the history entry. + attr_reader :id + + # The owner type for an ownership inference. + attr_reader :owner_type + + # The primary contact reference for the inferred owner, formatted as `ref:handle/`. + attr_accessor :primary_contact_ref + + # The identifier of the resource that the inference applies to. + attr_reader :resource_id + + # The scheduled retry time for a failed inference, if applicable. + attr_accessor :retry_schedule + + # The list of sources backing an ownership inference. Empty when the inference status is not whitelisted to expose sources. + attr_reader :sources + + # The lifecycle status of an ownership inference. + attr_reader :status + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'checksum' => :'checksum', + :'confidence' => :'confidence', + :'created_at' => :'created_at', + :'evidence_versions' => :'evidence_versions', + :'explanation' => :'explanation', + :'failed_at' => :'failed_at', + :'failure_reason' => :'failure_reason', + :'id' => :'id', + :'owner_type' => :'owner_type', + :'primary_contact_ref' => :'primary_contact_ref', + :'resource_id' => :'resource_id', + :'retry_schedule' => :'retry_schedule', + :'sources' => :'sources', + :'status' => :'status' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'checksum' => :'String', + :'confidence' => :'String', + :'created_at' => :'Time', + :'evidence_versions' => :'Array>', + :'explanation' => :'String', + :'failed_at' => :'Time', + :'failure_reason' => :'String', + :'id' => :'Integer', + :'owner_type' => :'OwnershipOwnerType', + :'primary_contact_ref' => :'String', + :'resource_id' => :'String', + :'retry_schedule' => :'Time', + :'sources' => :'Array>', + :'status' => :'OwnershipInferenceStatus' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'evidence_versions', + :'failed_at', + :'failure_reason', + :'primary_contact_ref', + :'retry_schedule', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::OwnershipHistoryItem` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'checksum') + self.checksum = attributes[:'checksum'] + end + + if attributes.key?(:'confidence') + self.confidence = attributes[:'confidence'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'evidence_versions') + if (value = attributes[:'evidence_versions']).is_a?(Array) + self.evidence_versions = value + end + end + + if attributes.key?(:'explanation') + self.explanation = attributes[:'explanation'] + end + + if attributes.key?(:'failed_at') + self.failed_at = attributes[:'failed_at'] + end + + if attributes.key?(:'failure_reason') + self.failure_reason = attributes[:'failure_reason'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'owner_type') + self.owner_type = attributes[:'owner_type'] + end + + if attributes.key?(:'primary_contact_ref') + self.primary_contact_ref = attributes[:'primary_contact_ref'] + end + + if attributes.key?(:'resource_id') + self.resource_id = attributes[:'resource_id'] + end + + if attributes.key?(:'retry_schedule') + self.retry_schedule = attributes[:'retry_schedule'] + end + + if attributes.key?(:'sources') + if (value = attributes[:'sources']).is_a?(Array) + self.sources = value + end + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @checksum.nil? + return false if @confidence.nil? + return false if @created_at.nil? + return false if @explanation.nil? + return false if @id.nil? + return false if @owner_type.nil? + return false if @resource_id.nil? + return false if @sources.nil? + return false if @status.nil? + true + end + + # Custom attribute writer method with validation + # @param checksum [Object] Object to be assigned + # @!visibility private + def checksum=(checksum) + if checksum.nil? + fail ArgumentError, 'invalid value for "checksum", checksum cannot be nil.' + end + @checksum = checksum + end + + # Custom attribute writer method with validation + # @param confidence [Object] Object to be assigned + # @!visibility private + def confidence=(confidence) + if confidence.nil? + fail ArgumentError, 'invalid value for "confidence", confidence cannot be nil.' + end + @confidence = confidence + end + + # Custom attribute writer method with validation + # @param created_at [Object] Object to be assigned + # @!visibility private + def created_at=(created_at) + if created_at.nil? + fail ArgumentError, 'invalid value for "created_at", created_at cannot be nil.' + end + @created_at = created_at + end + + # Custom attribute writer method with validation + # @param explanation [Object] Object to be assigned + # @!visibility private + def explanation=(explanation) + if explanation.nil? + fail ArgumentError, 'invalid value for "explanation", explanation cannot be nil.' + end + @explanation = explanation + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param owner_type [Object] Object to be assigned + # @!visibility private + def owner_type=(owner_type) + if owner_type.nil? + fail ArgumentError, 'invalid value for "owner_type", owner_type cannot be nil.' + end + @owner_type = owner_type + end + + # Custom attribute writer method with validation + # @param resource_id [Object] Object to be assigned + # @!visibility private + def resource_id=(resource_id) + if resource_id.nil? + fail ArgumentError, 'invalid value for "resource_id", resource_id cannot be nil.' + end + @resource_id = resource_id + end + + # Custom attribute writer method with validation + # @param sources [Object] Object to be assigned + # @!visibility private + def sources=(sources) + if sources.nil? + fail ArgumentError, 'invalid value for "sources", sources cannot be nil.' + end + @sources = sources + end + + # Custom attribute writer method with validation + # @param status [Object] Object to be assigned + # @!visibility private + def status=(status) + if status.nil? + fail ArgumentError, 'invalid value for "status", status cannot be nil.' + end + @status = status + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + checksum == o.checksum && + confidence == o.confidence && + created_at == o.created_at && + evidence_versions == o.evidence_versions && + explanation == o.explanation && + failed_at == o.failed_at && + failure_reason == o.failure_reason && + id == o.id && + owner_type == o.owner_type && + primary_contact_ref == o.primary_contact_ref && + resource_id == o.resource_id && + retry_schedule == o.retry_schedule && + sources == o.sources && + status == o.status && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [checksum, confidence, created_at, evidence_versions, explanation, failed_at, failure_reason, id, owner_type, primary_contact_ref, resource_id, retry_schedule, sources, status, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ownership_history_pagination.rb b/lib/datadog_api_client/v2/models/ownership_history_pagination.rb new file mode 100644 index 000000000000..2fbe16849361 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_history_pagination.rb @@ -0,0 +1,141 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Cursor-based pagination metadata for the history response. + class OwnershipHistoryPagination + include BaseGenericModel + + # Whether more history entries are available beyond this page. + attr_reader :has_more + + # 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. + attr_accessor :next_cursor + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'has_more' => :'has_more', + :'next_cursor' => :'next_cursor' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'has_more' => :'Boolean', + :'next_cursor' => :'String' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'next_cursor', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::OwnershipHistoryPagination` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'has_more') + self.has_more = attributes[:'has_more'] + end + + if attributes.key?(:'next_cursor') + self.next_cursor = attributes[:'next_cursor'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @has_more.nil? + true + end + + # Custom attribute writer method with validation + # @param has_more [Object] Object to be assigned + # @!visibility private + def has_more=(has_more) + if has_more.nil? + fail ArgumentError, 'invalid value for "has_more", has_more cannot be nil.' + end + @has_more = has_more + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + has_more == o.has_more && + next_cursor == o.next_cursor && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [has_more, next_cursor, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ownership_history_response.rb b/lib/datadog_api_client/v2/models/ownership_history_response.rb new file mode 100644 index 000000000000..1b6782a628b3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_history_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The response returned when listing the inference history for a resource. + class OwnershipHistoryResponse + include BaseGenericModel + + # The data wrapper for an ownership history response. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'OwnershipHistoryData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::OwnershipHistoryResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ownership_history_type.rb b/lib/datadog_api_client/v2/models/ownership_history_type.rb new file mode 100644 index 000000000000..158ecd88712d --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_history_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The type of the ownership history resource. The value should always be `ownership_history`. + class OwnershipHistoryType + include BaseEnumModel + + OWNERSHIP_HISTORY = "ownership_history".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/ownership_inference_attributes.rb b/lib/datadog_api_client/v2/models/ownership_inference_attributes.rb new file mode 100644 index 000000000000..15fb0e760ad4 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_inference_attributes.rb @@ -0,0 +1,303 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The attributes of a single ownership inference. + class OwnershipInferenceAttributes + include BaseGenericModel + + # A checksum that uniquely identifies the current state of the inference. Required when submitting feedback. + attr_reader :checksum + + # The confidence score of the inference, expressed as a numeric string with up to four decimal places. + attr_reader :confidence + + # The time when the inference was created. + attr_reader :created_at + + # The list of evidence versions associated with an inference. + attr_accessor :evidence_versions + + # A human-readable explanation of how the inference was produced. + attr_reader :explanation + + # The owner type for an ownership inference. + attr_reader :owner_type + + # The primary contact reference for the inferred owner, formatted as `ref:handle/`. + attr_accessor :primary_contact_ref + + # The list of sources backing an ownership inference. Empty when the inference status is not whitelisted to expose sources. + attr_reader :sources + + # The lifecycle status of an ownership inference. + attr_reader :status + + # The time when the inference was last updated. + attr_reader :updated_at + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'checksum' => :'checksum', + :'confidence' => :'confidence', + :'created_at' => :'created_at', + :'evidence_versions' => :'evidence_versions', + :'explanation' => :'explanation', + :'owner_type' => :'owner_type', + :'primary_contact_ref' => :'primary_contact_ref', + :'sources' => :'sources', + :'status' => :'status', + :'updated_at' => :'updated_at' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'checksum' => :'String', + :'confidence' => :'String', + :'created_at' => :'Time', + :'evidence_versions' => :'Array>', + :'explanation' => :'String', + :'owner_type' => :'OwnershipOwnerType', + :'primary_contact_ref' => :'String', + :'sources' => :'Array>', + :'status' => :'OwnershipInferenceStatus', + :'updated_at' => :'Time' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'evidence_versions', + :'primary_contact_ref', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::OwnershipInferenceAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'checksum') + self.checksum = attributes[:'checksum'] + end + + if attributes.key?(:'confidence') + self.confidence = attributes[:'confidence'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'evidence_versions') + if (value = attributes[:'evidence_versions']).is_a?(Array) + self.evidence_versions = value + end + end + + if attributes.key?(:'explanation') + self.explanation = attributes[:'explanation'] + end + + if attributes.key?(:'owner_type') + self.owner_type = attributes[:'owner_type'] + end + + if attributes.key?(:'primary_contact_ref') + self.primary_contact_ref = attributes[:'primary_contact_ref'] + end + + if attributes.key?(:'sources') + if (value = attributes[:'sources']).is_a?(Array) + self.sources = value + end + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @checksum.nil? + return false if @confidence.nil? + return false if @created_at.nil? + return false if @explanation.nil? + return false if @owner_type.nil? + return false if @sources.nil? + return false if @status.nil? + return false if @updated_at.nil? + true + end + + # Custom attribute writer method with validation + # @param checksum [Object] Object to be assigned + # @!visibility private + def checksum=(checksum) + if checksum.nil? + fail ArgumentError, 'invalid value for "checksum", checksum cannot be nil.' + end + @checksum = checksum + end + + # Custom attribute writer method with validation + # @param confidence [Object] Object to be assigned + # @!visibility private + def confidence=(confidence) + if confidence.nil? + fail ArgumentError, 'invalid value for "confidence", confidence cannot be nil.' + end + @confidence = confidence + end + + # Custom attribute writer method with validation + # @param created_at [Object] Object to be assigned + # @!visibility private + def created_at=(created_at) + if created_at.nil? + fail ArgumentError, 'invalid value for "created_at", created_at cannot be nil.' + end + @created_at = created_at + end + + # Custom attribute writer method with validation + # @param explanation [Object] Object to be assigned + # @!visibility private + def explanation=(explanation) + if explanation.nil? + fail ArgumentError, 'invalid value for "explanation", explanation cannot be nil.' + end + @explanation = explanation + end + + # Custom attribute writer method with validation + # @param owner_type [Object] Object to be assigned + # @!visibility private + def owner_type=(owner_type) + if owner_type.nil? + fail ArgumentError, 'invalid value for "owner_type", owner_type cannot be nil.' + end + @owner_type = owner_type + end + + # Custom attribute writer method with validation + # @param sources [Object] Object to be assigned + # @!visibility private + def sources=(sources) + if sources.nil? + fail ArgumentError, 'invalid value for "sources", sources cannot be nil.' + end + @sources = sources + end + + # Custom attribute writer method with validation + # @param status [Object] Object to be assigned + # @!visibility private + def status=(status) + if status.nil? + fail ArgumentError, 'invalid value for "status", status cannot be nil.' + end + @status = status + end + + # Custom attribute writer method with validation + # @param updated_at [Object] Object to be assigned + # @!visibility private + def updated_at=(updated_at) + if updated_at.nil? + fail ArgumentError, 'invalid value for "updated_at", updated_at cannot be nil.' + end + @updated_at = updated_at + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + checksum == o.checksum && + confidence == o.confidence && + created_at == o.created_at && + evidence_versions == o.evidence_versions && + explanation == o.explanation && + owner_type == o.owner_type && + primary_contact_ref == o.primary_contact_ref && + sources == o.sources && + status == o.status && + updated_at == o.updated_at && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [checksum, confidence, created_at, evidence_versions, explanation, owner_type, primary_contact_ref, sources, status, updated_at, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ownership_inference_data.rb b/lib/datadog_api_client/v2/models/ownership_inference_data.rb new file mode 100644 index 000000000000..115d5e270923 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_inference_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The data wrapper for a single ownership inference response. + class OwnershipInferenceData + include BaseGenericModel + + # The attributes of a single ownership inference. + attr_reader :attributes + + # The identifier of the inference, formatted as `resource_id:owner_type`. + attr_reader :id + + # The type of the ownership inference resource. The value should always be `ownership_inference`. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'OwnershipInferenceAttributes', + :'id' => :'String', + :'type' => :'OwnershipInferenceType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::OwnershipInferenceData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ownership_inference_item.rb b/lib/datadog_api_client/v2/models/ownership_inference_item.rb new file mode 100644 index 000000000000..b447e72ccd96 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_inference_item.rb @@ -0,0 +1,324 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A single ownership inference, scoped to a specific owner type. + class OwnershipInferenceItem + include BaseGenericModel + + # A checksum that uniquely identifies the current state of the inference. Required when submitting feedback. + attr_reader :checksum + + # The confidence score of the inference, expressed as a numeric string with up to four decimal places. + attr_reader :confidence + + # The time when the inference was created. + attr_reader :created_at + + # The list of evidence versions associated with an inference. + attr_accessor :evidence_versions + + # A human-readable explanation of how the inference was produced. + attr_reader :explanation + + # The identifier of the inference, formatted as `resource_id:owner_type`. + attr_reader :id + + # The owner type for an ownership inference. + attr_reader :owner_type + + # The primary contact reference for the inferred owner, formatted as `ref:handle/`. + attr_accessor :primary_contact_ref + + # The list of sources backing an ownership inference. Empty when the inference status is not whitelisted to expose sources. + attr_reader :sources + + # The lifecycle status of an ownership inference. + attr_reader :status + + # The time when the inference was last updated. + attr_reader :updated_at + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'checksum' => :'checksum', + :'confidence' => :'confidence', + :'created_at' => :'created_at', + :'evidence_versions' => :'evidence_versions', + :'explanation' => :'explanation', + :'id' => :'id', + :'owner_type' => :'owner_type', + :'primary_contact_ref' => :'primary_contact_ref', + :'sources' => :'sources', + :'status' => :'status', + :'updated_at' => :'updated_at' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'checksum' => :'String', + :'confidence' => :'String', + :'created_at' => :'Time', + :'evidence_versions' => :'Array>', + :'explanation' => :'String', + :'id' => :'String', + :'owner_type' => :'OwnershipOwnerType', + :'primary_contact_ref' => :'String', + :'sources' => :'Array>', + :'status' => :'OwnershipInferenceStatus', + :'updated_at' => :'Time' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'evidence_versions', + :'primary_contact_ref', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::OwnershipInferenceItem` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'checksum') + self.checksum = attributes[:'checksum'] + end + + if attributes.key?(:'confidence') + self.confidence = attributes[:'confidence'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'evidence_versions') + if (value = attributes[:'evidence_versions']).is_a?(Array) + self.evidence_versions = value + end + end + + if attributes.key?(:'explanation') + self.explanation = attributes[:'explanation'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'owner_type') + self.owner_type = attributes[:'owner_type'] + end + + if attributes.key?(:'primary_contact_ref') + self.primary_contact_ref = attributes[:'primary_contact_ref'] + end + + if attributes.key?(:'sources') + if (value = attributes[:'sources']).is_a?(Array) + self.sources = value + end + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @checksum.nil? + return false if @confidence.nil? + return false if @created_at.nil? + return false if @explanation.nil? + return false if @id.nil? + return false if @owner_type.nil? + return false if @sources.nil? + return false if @status.nil? + return false if @updated_at.nil? + true + end + + # Custom attribute writer method with validation + # @param checksum [Object] Object to be assigned + # @!visibility private + def checksum=(checksum) + if checksum.nil? + fail ArgumentError, 'invalid value for "checksum", checksum cannot be nil.' + end + @checksum = checksum + end + + # Custom attribute writer method with validation + # @param confidence [Object] Object to be assigned + # @!visibility private + def confidence=(confidence) + if confidence.nil? + fail ArgumentError, 'invalid value for "confidence", confidence cannot be nil.' + end + @confidence = confidence + end + + # Custom attribute writer method with validation + # @param created_at [Object] Object to be assigned + # @!visibility private + def created_at=(created_at) + if created_at.nil? + fail ArgumentError, 'invalid value for "created_at", created_at cannot be nil.' + end + @created_at = created_at + end + + # Custom attribute writer method with validation + # @param explanation [Object] Object to be assigned + # @!visibility private + def explanation=(explanation) + if explanation.nil? + fail ArgumentError, 'invalid value for "explanation", explanation cannot be nil.' + end + @explanation = explanation + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param owner_type [Object] Object to be assigned + # @!visibility private + def owner_type=(owner_type) + if owner_type.nil? + fail ArgumentError, 'invalid value for "owner_type", owner_type cannot be nil.' + end + @owner_type = owner_type + end + + # Custom attribute writer method with validation + # @param sources [Object] Object to be assigned + # @!visibility private + def sources=(sources) + if sources.nil? + fail ArgumentError, 'invalid value for "sources", sources cannot be nil.' + end + @sources = sources + end + + # Custom attribute writer method with validation + # @param status [Object] Object to be assigned + # @!visibility private + def status=(status) + if status.nil? + fail ArgumentError, 'invalid value for "status", status cannot be nil.' + end + @status = status + end + + # Custom attribute writer method with validation + # @param updated_at [Object] Object to be assigned + # @!visibility private + def updated_at=(updated_at) + if updated_at.nil? + fail ArgumentError, 'invalid value for "updated_at", updated_at cannot be nil.' + end + @updated_at = updated_at + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + checksum == o.checksum && + confidence == o.confidence && + created_at == o.created_at && + evidence_versions == o.evidence_versions && + explanation == o.explanation && + id == o.id && + owner_type == o.owner_type && + primary_contact_ref == o.primary_contact_ref && + sources == o.sources && + status == o.status && + updated_at == o.updated_at && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [checksum, confidence, created_at, evidence_versions, explanation, id, owner_type, primary_contact_ref, sources, status, updated_at, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ownership_inference_list_attributes.rb b/lib/datadog_api_client/v2/models/ownership_inference_list_attributes.rb new file mode 100644 index 000000000000..971976adb3cc --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_inference_list_attributes.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The attributes of the ownership inferences collection response. + class OwnershipInferenceListAttributes + include BaseGenericModel + + # The list of inferences for a resource, with one inference per owner type. + attr_reader :items + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'items' => :'items' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'items' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::OwnershipInferenceListAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'items') + if (value = attributes[:'items']).is_a?(Array) + self.items = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @items.nil? + true + end + + # Custom attribute writer method with validation + # @param items [Object] Object to be assigned + # @!visibility private + def items=(items) + if items.nil? + fail ArgumentError, 'invalid value for "items", items cannot be nil.' + end + @items = items + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + items == o.items && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [items, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ownership_inference_list_data.rb b/lib/datadog_api_client/v2/models/ownership_inference_list_data.rb new file mode 100644 index 000000000000..b58bf747c1aa --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_inference_list_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The data wrapper for the ownership inferences collection response. + class OwnershipInferenceListData + include BaseGenericModel + + # The attributes of the ownership inferences collection response. + attr_reader :attributes + + # The resource identifier associated with the returned inferences. + attr_reader :id + + # The type of the ownership inferences collection resource. The value should always be `ownership_inferences`. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'OwnershipInferenceListAttributes', + :'id' => :'String', + :'type' => :'OwnershipInferencesType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::OwnershipInferenceListData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ownership_inference_list_response.rb b/lib/datadog_api_client/v2/models/ownership_inference_list_response.rb new file mode 100644 index 000000000000..ff74bbb10e8d --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_inference_list_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The response returned when listing all current ownership inferences for a resource. + class OwnershipInferenceListResponse + include BaseGenericModel + + # The data wrapper for the ownership inferences collection response. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'OwnershipInferenceListData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::OwnershipInferenceListResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ownership_inference_response.rb b/lib/datadog_api_client/v2/models/ownership_inference_response.rb new file mode 100644 index 000000000000..9113cab9cf87 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_inference_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The response returned when retrieving a single ownership inference for an owner type. + class OwnershipInferenceResponse + include BaseGenericModel + + # The data wrapper for a single ownership inference response. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'OwnershipInferenceData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::OwnershipInferenceResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ownership_inference_status.rb b/lib/datadog_api_client/v2/models/ownership_inference_status.rb new file mode 100644 index 000000000000..bec86debd3e6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_inference_status.rb @@ -0,0 +1,30 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The lifecycle status of an ownership inference. + class OwnershipInferenceStatus + include BaseEnumModel + + SUGGESTED = "suggested".freeze + PERSISTED = "persisted".freeze + OVERRIDDEN = "overridden".freeze + FAILED = "failed".freeze + UNKNOWN = "unknown".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/ownership_inference_type.rb b/lib/datadog_api_client/v2/models/ownership_inference_type.rb new file mode 100644 index 000000000000..4c0067a1a2ff --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_inference_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The type of the ownership inference resource. The value should always be `ownership_inference`. + class OwnershipInferenceType + include BaseEnumModel + + OWNERSHIP_INFERENCE = "ownership_inference".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/ownership_inferences_type.rb b/lib/datadog_api_client/v2/models/ownership_inferences_type.rb new file mode 100644 index 000000000000..9048ecf5e71f --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_inferences_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The type of the ownership inferences collection resource. The value should always be `ownership_inferences`. + class OwnershipInferencesType + include BaseEnumModel + + OWNERSHIP_INFERENCES = "ownership_inferences".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/ownership_owner_type.rb b/lib/datadog_api_client/v2/models/ownership_owner_type.rb new file mode 100644 index 000000000000..5dde013c0696 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_owner_type.rb @@ -0,0 +1,29 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The owner type for an ownership inference. + class OwnershipOwnerType + include BaseEnumModel + + USER = "user".freeze + TEAM = "team".freeze + SERVICE = "service".freeze + UNKNOWN = "unknown".freeze + end +end