From ac65eac9700b105d1c92120b4bd0f24048c9c55b Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Thu, 23 Jul 2026 10:52:55 +0200 Subject: [PATCH] Regenerate client from commit 77aa226 of spec repo (#3594) Co-authored-by: ci.datadog-api-spec --- .generator/schemas/v2/openapi.yaml | 280 ++++++++++++++++++ .../v2/csm-ownership/GetOwnershipSettings.rb | 8 + .../GetOwnershipUntaggedFindings.rb | 8 + .../v2/csm-ownership/PostOwnershipSettings.rb | 18 ++ features/scenarios_model_mapping.rb | 3 + features/v2/csm_ownership.feature | 30 ++ features/v2/undo.json | 18 ++ lib/datadog_api_client/configuration.rb | 3 + lib/datadog_api_client/inflector.rb | 12 + .../v2/api/csm_ownership_api.rb | 205 +++++++++++++ .../v2/models/ownership_confidence_level.rb | 28 ++ .../models/ownership_settings_attributes.rb | 165 +++++++++++ .../v2/models/ownership_settings_data.rb | 165 +++++++++++ .../v2/models/ownership_settings_request.rb | 123 ++++++++ .../ownership_settings_request_attributes.rb | 144 +++++++++ .../models/ownership_settings_request_data.rb | 144 +++++++++ .../v2/models/ownership_settings_response.rb | 123 ++++++++ .../v2/models/ownership_settings_type.rb | 26 ++ .../ownership_untagged_findings_attributes.rb | 186 ++++++++++++ .../ownership_untagged_findings_data.rb | 165 +++++++++++ .../ownership_untagged_findings_response.rb | 123 ++++++++ .../ownership_untagged_findings_type.rb | 26 ++ 22 files changed, 2003 insertions(+) create mode 100644 examples/v2/csm-ownership/GetOwnershipSettings.rb create mode 100644 examples/v2/csm-ownership/GetOwnershipUntaggedFindings.rb create mode 100644 examples/v2/csm-ownership/PostOwnershipSettings.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_confidence_level.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_settings_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_settings_data.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_settings_request.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_settings_request_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_settings_request_data.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_settings_response.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_settings_type.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_untagged_findings_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_untagged_findings_data.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_untagged_findings_response.rb create mode 100644 lib/datadog_api_client/v2/models/ownership_untagged_findings_type.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 90e1196820ee..53a4ea6a1a50 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -75076,6 +75076,18 @@ components: required: - data type: object + OwnershipConfidenceLevel: + description: The ownership confidence level. + enum: + - high + - medium + - low + example: high + type: string + x-enum-varnames: + - HIGH + - MEDIUM + - LOW OwnershipEvidenceAttributes: description: The attributes of an ownership evidence response. properties: @@ -75639,6 +75651,152 @@ components: - TEAM - SERVICE - UNKNOWN + OwnershipSettingsAttributes: + description: The attributes of the ownership settings response. + properties: + auto_tag: + description: Whether automatic ownership tagging is enabled. + example: true + type: boolean + confidence_level: + $ref: "#/components/schemas/OwnershipConfidenceLevel" + version: + description: The current version of the ownership settings. + example: 1 + format: int64 + type: integer + required: + - version + - auto_tag + - confidence_level + type: object + OwnershipSettingsData: + description: The data wrapper for an ownership settings response. + properties: + attributes: + $ref: "#/components/schemas/OwnershipSettingsAttributes" + id: + description: The identifier of the ownership settings resource. + example: settings + type: string + type: + $ref: "#/components/schemas/OwnershipSettingsType" + required: + - id + - type + - attributes + type: object + OwnershipSettingsRequest: + description: The request body for updating ownership settings. + properties: + data: + $ref: "#/components/schemas/OwnershipSettingsRequestData" + required: + - data + type: object + OwnershipSettingsRequestAttributes: + description: The attributes of an ownership settings request. + properties: + auto_tag: + description: Whether automatic ownership tagging is enabled. + example: true + type: boolean + confidence_level: + $ref: "#/components/schemas/OwnershipConfidenceLevel" + required: + - auto_tag + - confidence_level + type: object + OwnershipSettingsRequestData: + description: The data wrapper for an ownership settings request. + properties: + attributes: + $ref: "#/components/schemas/OwnershipSettingsRequestAttributes" + type: + $ref: "#/components/schemas/OwnershipSettingsType" + required: + - type + - attributes + type: object + OwnershipSettingsResponse: + description: The response returned when retrieving or updating ownership settings. + properties: + data: + $ref: "#/components/schemas/OwnershipSettingsData" + required: + - data + type: object + OwnershipSettingsType: + default: ownership_settings + description: The type of the ownership settings resource. The value should always be `ownership_settings`. + enum: + - ownership_settings + example: ownership_settings + type: string + x-enum-varnames: + - OWNERSHIP_SETTINGS + OwnershipUntaggedFindingsAttributes: + description: The counts of findings without a team tag by ownership confidence. + properties: + high_confidence: + description: The number of high confidence findings without a team tag. + example: 30 + format: int64 + type: integer + low_confidence: + description: The number of low confidence findings without a team tag. + example: 42 + format: int64 + type: integer + medium_confidence: + description: The number of medium confidence findings without a team tag. + example: 70 + format: int64 + type: integer + total: + description: The total number of findings without a team tag. + example: 142 + format: int64 + type: integer + required: + - total + - high_confidence + - medium_confidence + - low_confidence + type: object + OwnershipUntaggedFindingsData: + description: The data wrapper for an ownership untagged findings response. + properties: + attributes: + $ref: "#/components/schemas/OwnershipUntaggedFindingsAttributes" + id: + description: The identifier of the ownership untagged findings resource. + example: untagged + type: string + type: + $ref: "#/components/schemas/OwnershipUntaggedFindingsType" + required: + - id + - type + - attributes + type: object + OwnershipUntaggedFindingsResponse: + description: The response returned when counting findings without a team tag by ownership confidence. + properties: + data: + $ref: "#/components/schemas/OwnershipUntaggedFindingsData" + required: + - data + type: object + OwnershipUntaggedFindingsType: + default: ownership_untagged_findings + description: The type of the ownership untagged findings resource. The value should always be `ownership_untagged_findings`. + enum: + - ownership_untagged_findings + example: ownership_untagged_findings + type: string + x-enum-varnames: + - OWNERSHIP_UNTAGGED_FINDINGS PageAnnotationsAttributes: description: Attributes of the annotations on a page. properties: @@ -132295,6 +132453,128 @@ paths: $ref: "#/components/responses/TooManyRequestsResponse" summary: Get all CSM Serverless Agents tags: ["CSM Agents"] + /api/v2/csm/ownership/settings: + get: + description: Get ownership settings for the org. When settings are unset, the API returns the default opt-out configuration with `auto_tag` set to `true` and `confidence_level` set to `high`. + operationId: GetOwnershipSettings + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + auto_tag: true + confidence_level: high + version: 1 + id: settings + type: ownership_settings + schema: + $ref: "#/components/schemas/OwnershipSettingsResponse" + description: OK + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Get ownership settings for the org + 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/). + post: + description: Update ownership settings for the org. + operationId: PostOwnershipSettings + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + auto_tag: true + confidence_level: high + type: ownership_settings + schema: + $ref: "#/components/schemas/OwnershipSettingsRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + auto_tag: true + confidence_level: high + version: 1 + id: settings + type: ownership_settings + schema: + $ref: "#/components/schemas/OwnershipSettingsResponse" + 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: Update ownership settings for the org + 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/settings/untagged: + get: + description: Count findings with no team tag, grouped by ownership confidence level. + operationId: GetOwnershipUntaggedFindings + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + high_confidence: 30 + low_confidence: 42 + medium_confidence: 70 + total: 142 + id: untagged + type: ownership_untagged_findings + schema: + $ref: "#/components/schemas/OwnershipUntaggedFindingsResponse" + description: OK + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Count untagged findings by ownership confidence + 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}: get: description: Get all current ownership inferences for a resource, one per owner type (`user`, `team`, `service`, `unknown`). diff --git a/examples/v2/csm-ownership/GetOwnershipSettings.rb b/examples/v2/csm-ownership/GetOwnershipSettings.rb new file mode 100644 index 000000000000..d43d06ec10da --- /dev/null +++ b/examples/v2/csm-ownership/GetOwnershipSettings.rb @@ -0,0 +1,8 @@ +# Get ownership settings for the org returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_ownership_settings".to_sym] = true +end +api_instance = DatadogAPIClient::V2::CSMOwnershipAPI.new +p api_instance.get_ownership_settings() diff --git a/examples/v2/csm-ownership/GetOwnershipUntaggedFindings.rb b/examples/v2/csm-ownership/GetOwnershipUntaggedFindings.rb new file mode 100644 index 000000000000..2c8b34867a96 --- /dev/null +++ b/examples/v2/csm-ownership/GetOwnershipUntaggedFindings.rb @@ -0,0 +1,8 @@ +# Count untagged findings by ownership confidence returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_ownership_untagged_findings".to_sym] = true +end +api_instance = DatadogAPIClient::V2::CSMOwnershipAPI.new +p api_instance.get_ownership_untagged_findings() diff --git a/examples/v2/csm-ownership/PostOwnershipSettings.rb b/examples/v2/csm-ownership/PostOwnershipSettings.rb new file mode 100644 index 000000000000..49c18689abdc --- /dev/null +++ b/examples/v2/csm-ownership/PostOwnershipSettings.rb @@ -0,0 +1,18 @@ +# Update ownership settings for the org returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.post_ownership_settings".to_sym] = true +end +api_instance = DatadogAPIClient::V2::CSMOwnershipAPI.new + +body = DatadogAPIClient::V2::OwnershipSettingsRequest.new({ + data: DatadogAPIClient::V2::OwnershipSettingsRequestData.new({ + attributes: DatadogAPIClient::V2::OwnershipSettingsRequestAttributes.new({ + auto_tag: true, + confidence_level: DatadogAPIClient::V2::OwnershipConfidenceLevel::HIGH, + }), + type: DatadogAPIClient::V2::OwnershipSettingsType::OWNERSHIP_SETTINGS, + }), +}) +p api_instance.post_ownership_settings(body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 422ed8b0de7c..8e5d75fdcb23 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -3030,6 +3030,9 @@ "query" => "String", "order_direction" => "OrderDirection", }, + "v2.PostOwnershipSettings" => { + "body" => "OwnershipSettingsRequest", + }, "v2.ListOwnershipInferences" => { "resource_id" => "String", }, diff --git a/features/v2/csm_ownership.feature b/features/v2/csm_ownership.feature index 58498ca15502..661e420b5c2f 100644 --- a/features/v2/csm_ownership.feature +++ b/features/v2/csm_ownership.feature @@ -12,6 +12,13 @@ Feature: CSM Ownership And a valid "appKeyAuth" key in the system And an instance of "CSMOwnership" API + @generated @skip @team:DataDog/k9-misconfigs + Scenario: Count untagged findings by ownership confidence returns "OK" response + Given operation "GetOwnershipUntaggedFindings" enabled + And new "GetOwnershipUntaggedFindings" request + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/k9-misconfigs Scenario: Get an ownership inference by owner type returns "Bad Request" response Given operation "GetOwnershipInference" enabled @@ -39,6 +46,13 @@ Feature: CSM Ownership When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/k9-misconfigs + Scenario: Get ownership settings for the org returns "OK" response + Given operation "GetOwnershipSettings" enabled + And new "GetOwnershipSettings" request + 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 @@ -163,3 +177,19 @@ Feature: CSM Ownership 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 + + @generated @skip @team:DataDog/k9-misconfigs + Scenario: Update ownership settings for the org returns "Bad Request" response + Given operation "PostOwnershipSettings" enabled + And new "PostOwnershipSettings" request + And body with value {"data": {"attributes": {"auto_tag": true, "confidence_level": "high"}, "type": "ownership_settings"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-misconfigs + Scenario: Update ownership settings for the org returns "OK" response + Given operation "PostOwnershipSettings" enabled + And new "PostOwnershipSettings" request + And body with value {"data": {"attributes": {"auto_tag": true, "confidence_level": "high"}, "type": "ownership_settings"}} + When the request is sent + Then the response status is 200 OK diff --git a/features/v2/undo.json b/features/v2/undo.json index e72767d8e0d5..10ae8ac71d43 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -2049,6 +2049,24 @@ "type": "safe" } }, + "GetOwnershipSettings": { + "tag": "CSM Ownership", + "undo": { + "type": "safe" + } + }, + "PostOwnershipSettings": { + "tag": "CSM Ownership", + "undo": { + "type": "idempotent" + } + }, + "GetOwnershipUntaggedFindings": { + "tag": "CSM Ownership", + "undo": { + "type": "safe" + } + }, "ListOwnershipInferences": { "tag": "CSM Ownership", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 03e3dca8a1d1..f199ec2102af 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -407,9 +407,12 @@ def initialize "v2.create_ownership_feedback": false, "v2.get_ownership_evidence": false, "v2.get_ownership_inference": false, + "v2.get_ownership_settings": false, + "v2.get_ownership_untagged_findings": false, "v2.list_ownership_history": false, "v2.list_ownership_history_by_owner_type": false, "v2.list_ownership_inferences": false, + "v2.post_ownership_settings": 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 7e745a19486c..38e5bfee1558 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -5634,6 +5634,7 @@ def overrides "v2.output_schema_parameters" => "OutputSchemaParameters", "v2.output_schema_parameters_type" => "OutputSchemaParametersType", "v2.overwrite_allocations_request" => "OverwriteAllocationsRequest", + "v2.ownership_confidence_level" => "OwnershipConfidenceLevel", "v2.ownership_evidence_attributes" => "OwnershipEvidenceAttributes", "v2.ownership_evidence_data" => "OwnershipEvidenceData", "v2.ownership_evidence_response" => "OwnershipEvidenceResponse", @@ -5664,6 +5665,17 @@ def overrides "v2.ownership_inferences_type" => "OwnershipInferencesType", "v2.ownership_inference_type" => "OwnershipInferenceType", "v2.ownership_owner_type" => "OwnershipOwnerType", + "v2.ownership_settings_attributes" => "OwnershipSettingsAttributes", + "v2.ownership_settings_data" => "OwnershipSettingsData", + "v2.ownership_settings_request" => "OwnershipSettingsRequest", + "v2.ownership_settings_request_attributes" => "OwnershipSettingsRequestAttributes", + "v2.ownership_settings_request_data" => "OwnershipSettingsRequestData", + "v2.ownership_settings_response" => "OwnershipSettingsResponse", + "v2.ownership_settings_type" => "OwnershipSettingsType", + "v2.ownership_untagged_findings_attributes" => "OwnershipUntaggedFindingsAttributes", + "v2.ownership_untagged_findings_data" => "OwnershipUntaggedFindingsData", + "v2.ownership_untagged_findings_response" => "OwnershipUntaggedFindingsResponse", + "v2.ownership_untagged_findings_type" => "OwnershipUntaggedFindingsType", "v2.page_annotations_attributes" => "PageAnnotationsAttributes", "v2.page_annotations_data" => "PageAnnotationsData", "v2.page_annotations_response" => "PageAnnotationsResponse", diff --git a/lib/datadog_api_client/v2/api/csm_ownership_api.rb b/lib/datadog_api_client/v2/api/csm_ownership_api.rb index a2a2cec66935..cc185cd58f6c 100644 --- a/lib/datadog_api_client/v2/api/csm_ownership_api.rb +++ b/lib/datadog_api_client/v2/api/csm_ownership_api.rb @@ -285,6 +285,138 @@ def get_ownership_inference_with_http_info(resource_id, owner_type, opts = {}) return data, status_code, headers end + # Get ownership settings for the org. + # + # @see #get_ownership_settings_with_http_info + def get_ownership_settings(opts = {}) + data, _status_code, _headers = get_ownership_settings_with_http_info(opts) + data + end + + # Get ownership settings for the org. + # + # Get ownership settings for the org. When settings are unset, the API returns the default opt-out configuration with `auto_tag` set to `true` and `confidence_level` set to `high`. + # + # @param opts [Hash] the optional parameters + # @return [Array<(OwnershipSettingsResponse, Integer, Hash)>] OwnershipSettingsResponse data, response status code and response headers + def get_ownership_settings_with_http_info(opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_ownership_settings".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_ownership_settings") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_ownership_settings")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CSMOwnershipAPI.get_ownership_settings ...' + end + # resource path + local_var_path = '/api/v2/csm/ownership/settings' + + # 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] || 'OwnershipSettingsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :get_ownership_settings, + :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_settings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Count untagged findings by ownership confidence. + # + # @see #get_ownership_untagged_findings_with_http_info + def get_ownership_untagged_findings(opts = {}) + data, _status_code, _headers = get_ownership_untagged_findings_with_http_info(opts) + data + end + + # Count untagged findings by ownership confidence. + # + # Count findings with no team tag, grouped by ownership confidence level. + # + # @param opts [Hash] the optional parameters + # @return [Array<(OwnershipUntaggedFindingsResponse, Integer, Hash)>] OwnershipUntaggedFindingsResponse data, response status code and response headers + def get_ownership_untagged_findings_with_http_info(opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_ownership_untagged_findings".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_ownership_untagged_findings") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_ownership_untagged_findings")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CSMOwnershipAPI.get_ownership_untagged_findings ...' + end + # resource path + local_var_path = '/api/v2/csm/ownership/settings/untagged' + + # 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] || 'OwnershipUntaggedFindingsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :get_ownership_untagged_findings, + :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_untagged_findings\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 @@ -527,5 +659,78 @@ def list_ownership_inferences_with_http_info(resource_id, opts = {}) end return data, status_code, headers end + + # Update ownership settings for the org. + # + # @see #post_ownership_settings_with_http_info + def post_ownership_settings(body, opts = {}) + data, _status_code, _headers = post_ownership_settings_with_http_info(body, opts) + data + end + + # Update ownership settings for the org. + # + # Update ownership settings for the org. + # + # @param body [OwnershipSettingsRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(OwnershipSettingsResponse, Integer, Hash)>] OwnershipSettingsResponse data, response status code and response headers + def post_ownership_settings_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.post_ownership_settings".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.post_ownership_settings") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.post_ownership_settings")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CSMOwnershipAPI.post_ownership_settings ...' + 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.post_ownership_settings" + end + # resource path + local_var_path = '/api/v2/csm/ownership/settings' + + # 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] || 'OwnershipSettingsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :post_ownership_settings, + :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#post_ownership_settings\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_confidence_level.rb b/lib/datadog_api_client/v2/models/ownership_confidence_level.rb new file mode 100644 index 000000000000..2d0d2e30d9a8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_confidence_level.rb @@ -0,0 +1,28 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The ownership confidence level. + class OwnershipConfidenceLevel + include BaseEnumModel + + HIGH = "high".freeze + MEDIUM = "medium".freeze + LOW = "low".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/ownership_settings_attributes.rb b/lib/datadog_api_client/v2/models/ownership_settings_attributes.rb new file mode 100644 index 000000000000..f99fcaf4507a --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_settings_attributes.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 attributes of the ownership settings response. + class OwnershipSettingsAttributes + include BaseGenericModel + + # Whether automatic ownership tagging is enabled. + attr_reader :auto_tag + + # The ownership confidence level. + attr_reader :confidence_level + + # The current version of the ownership settings. + attr_reader :version + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'auto_tag' => :'auto_tag', + :'confidence_level' => :'confidence_level', + :'version' => :'version' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'auto_tag' => :'Boolean', + :'confidence_level' => :'OwnershipConfidenceLevel', + :'version' => :'Integer' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::OwnershipSettingsAttributes` 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?(:'auto_tag') + self.auto_tag = attributes[:'auto_tag'] + end + + if attributes.key?(:'confidence_level') + self.confidence_level = attributes[:'confidence_level'] + end + + if attributes.key?(:'version') + self.version = attributes[:'version'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @auto_tag.nil? + return false if @confidence_level.nil? + return false if @version.nil? + true + end + + # Custom attribute writer method with validation + # @param auto_tag [Object] Object to be assigned + # @!visibility private + def auto_tag=(auto_tag) + if auto_tag.nil? + fail ArgumentError, 'invalid value for "auto_tag", auto_tag cannot be nil.' + end + @auto_tag = auto_tag + end + + # Custom attribute writer method with validation + # @param confidence_level [Object] Object to be assigned + # @!visibility private + def confidence_level=(confidence_level) + if confidence_level.nil? + fail ArgumentError, 'invalid value for "confidence_level", confidence_level cannot be nil.' + end + @confidence_level = confidence_level + end + + # Custom attribute writer method with validation + # @param version [Object] Object to be assigned + # @!visibility private + def version=(version) + if version.nil? + fail ArgumentError, 'invalid value for "version", version cannot be nil.' + end + @version = version + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + auto_tag == o.auto_tag && + confidence_level == o.confidence_level && + version == o.version && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [auto_tag, confidence_level, version, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ownership_settings_data.rb b/lib/datadog_api_client/v2/models/ownership_settings_data.rb new file mode 100644 index 000000000000..99373e4e2c33 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_settings_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 settings response. + class OwnershipSettingsData + include BaseGenericModel + + # The attributes of the ownership settings response. + attr_reader :attributes + + # The identifier of the ownership settings resource. + attr_reader :id + + # The type of the ownership settings resource. The value should always be `ownership_settings`. + 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' => :'OwnershipSettingsAttributes', + :'id' => :'String', + :'type' => :'OwnershipSettingsType' + } + 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::OwnershipSettingsData` 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_settings_request.rb b/lib/datadog_api_client/v2/models/ownership_settings_request.rb new file mode 100644 index 000000000000..9ad33cab9a1e --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_settings_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 updating ownership settings. + class OwnershipSettingsRequest + include BaseGenericModel + + # The data wrapper for an ownership settings 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' => :'OwnershipSettingsRequestData' + } + 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::OwnershipSettingsRequest` 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_settings_request_attributes.rb b/lib/datadog_api_client/v2/models/ownership_settings_request_attributes.rb new file mode 100644 index 000000000000..41a3e03fd5b0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_settings_request_attributes.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 attributes of an ownership settings request. + class OwnershipSettingsRequestAttributes + include BaseGenericModel + + # Whether automatic ownership tagging is enabled. + attr_reader :auto_tag + + # The ownership confidence level. + attr_reader :confidence_level + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'auto_tag' => :'auto_tag', + :'confidence_level' => :'confidence_level' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'auto_tag' => :'Boolean', + :'confidence_level' => :'OwnershipConfidenceLevel' + } + 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::OwnershipSettingsRequestAttributes` 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?(:'auto_tag') + self.auto_tag = attributes[:'auto_tag'] + end + + if attributes.key?(:'confidence_level') + self.confidence_level = attributes[:'confidence_level'] + 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 @auto_tag.nil? + return false if @confidence_level.nil? + true + end + + # Custom attribute writer method with validation + # @param auto_tag [Object] Object to be assigned + # @!visibility private + def auto_tag=(auto_tag) + if auto_tag.nil? + fail ArgumentError, 'invalid value for "auto_tag", auto_tag cannot be nil.' + end + @auto_tag = auto_tag + end + + # Custom attribute writer method with validation + # @param confidence_level [Object] Object to be assigned + # @!visibility private + def confidence_level=(confidence_level) + if confidence_level.nil? + fail ArgumentError, 'invalid value for "confidence_level", confidence_level cannot be nil.' + end + @confidence_level = confidence_level + 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 && + auto_tag == o.auto_tag && + confidence_level == o.confidence_level && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [auto_tag, confidence_level, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ownership_settings_request_data.rb b/lib/datadog_api_client/v2/models/ownership_settings_request_data.rb new file mode 100644 index 000000000000..fd3ff99cf22d --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_settings_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 settings request. + class OwnershipSettingsRequestData + include BaseGenericModel + + # The attributes of an ownership settings request. + attr_reader :attributes + + # The type of the ownership settings resource. The value should always be `ownership_settings`. + 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' => :'OwnershipSettingsRequestAttributes', + :'type' => :'OwnershipSettingsType' + } + 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::OwnershipSettingsRequestData` 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_settings_response.rb b/lib/datadog_api_client/v2/models/ownership_settings_response.rb new file mode 100644 index 000000000000..7014a6f1a7cc --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_settings_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 or updating ownership settings. + class OwnershipSettingsResponse + include BaseGenericModel + + # The data wrapper for an ownership settings 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' => :'OwnershipSettingsData' + } + 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::OwnershipSettingsResponse` 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_settings_type.rb b/lib/datadog_api_client/v2/models/ownership_settings_type.rb new file mode 100644 index 000000000000..f8946e658a0a --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_settings_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 settings resource. The value should always be `ownership_settings`. + class OwnershipSettingsType + include BaseEnumModel + + OWNERSHIP_SETTINGS = "ownership_settings".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/ownership_untagged_findings_attributes.rb b/lib/datadog_api_client/v2/models/ownership_untagged_findings_attributes.rb new file mode 100644 index 000000000000..3e6ee4fc2a23 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_untagged_findings_attributes.rb @@ -0,0 +1,186 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The counts of findings without a team tag by ownership confidence. + class OwnershipUntaggedFindingsAttributes + include BaseGenericModel + + # The number of high confidence findings without a team tag. + attr_reader :high_confidence + + # The number of low confidence findings without a team tag. + attr_reader :low_confidence + + # The number of medium confidence findings without a team tag. + attr_reader :medium_confidence + + # The total number of findings without a team tag. + attr_reader :total + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'high_confidence' => :'high_confidence', + :'low_confidence' => :'low_confidence', + :'medium_confidence' => :'medium_confidence', + :'total' => :'total' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'high_confidence' => :'Integer', + :'low_confidence' => :'Integer', + :'medium_confidence' => :'Integer', + :'total' => :'Integer' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::OwnershipUntaggedFindingsAttributes` 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?(:'high_confidence') + self.high_confidence = attributes[:'high_confidence'] + end + + if attributes.key?(:'low_confidence') + self.low_confidence = attributes[:'low_confidence'] + end + + if attributes.key?(:'medium_confidence') + self.medium_confidence = attributes[:'medium_confidence'] + end + + if attributes.key?(:'total') + self.total = attributes[:'total'] + 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 @high_confidence.nil? + return false if @low_confidence.nil? + return false if @medium_confidence.nil? + return false if @total.nil? + true + end + + # Custom attribute writer method with validation + # @param high_confidence [Object] Object to be assigned + # @!visibility private + def high_confidence=(high_confidence) + if high_confidence.nil? + fail ArgumentError, 'invalid value for "high_confidence", high_confidence cannot be nil.' + end + @high_confidence = high_confidence + end + + # Custom attribute writer method with validation + # @param low_confidence [Object] Object to be assigned + # @!visibility private + def low_confidence=(low_confidence) + if low_confidence.nil? + fail ArgumentError, 'invalid value for "low_confidence", low_confidence cannot be nil.' + end + @low_confidence = low_confidence + end + + # Custom attribute writer method with validation + # @param medium_confidence [Object] Object to be assigned + # @!visibility private + def medium_confidence=(medium_confidence) + if medium_confidence.nil? + fail ArgumentError, 'invalid value for "medium_confidence", medium_confidence cannot be nil.' + end + @medium_confidence = medium_confidence + end + + # Custom attribute writer method with validation + # @param total [Object] Object to be assigned + # @!visibility private + def total=(total) + if total.nil? + fail ArgumentError, 'invalid value for "total", total cannot be nil.' + end + @total = total + 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 && + high_confidence == o.high_confidence && + low_confidence == o.low_confidence && + medium_confidence == o.medium_confidence && + total == o.total && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [high_confidence, low_confidence, medium_confidence, total, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ownership_untagged_findings_data.rb b/lib/datadog_api_client/v2/models/ownership_untagged_findings_data.rb new file mode 100644 index 000000000000..9676d2205c50 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_untagged_findings_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 untagged findings response. + class OwnershipUntaggedFindingsData + include BaseGenericModel + + # The counts of findings without a team tag by ownership confidence. + attr_reader :attributes + + # The identifier of the ownership untagged findings resource. + attr_reader :id + + # The type of the ownership untagged findings resource. The value should always be `ownership_untagged_findings`. + 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' => :'OwnershipUntaggedFindingsAttributes', + :'id' => :'String', + :'type' => :'OwnershipUntaggedFindingsType' + } + 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::OwnershipUntaggedFindingsData` 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_untagged_findings_response.rb b/lib/datadog_api_client/v2/models/ownership_untagged_findings_response.rb new file mode 100644 index 000000000000..88cedfe4a379 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_untagged_findings_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 counting findings without a team tag by ownership confidence. + class OwnershipUntaggedFindingsResponse + include BaseGenericModel + + # The data wrapper for an ownership untagged findings 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' => :'OwnershipUntaggedFindingsData' + } + 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::OwnershipUntaggedFindingsResponse` 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_untagged_findings_type.rb b/lib/datadog_api_client/v2/models/ownership_untagged_findings_type.rb new file mode 100644 index 000000000000..6186b02e3abf --- /dev/null +++ b/lib/datadog_api_client/v2/models/ownership_untagged_findings_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 untagged findings resource. The value should always be `ownership_untagged_findings`. + class OwnershipUntaggedFindingsType + include BaseEnumModel + + OWNERSHIP_UNTAGGED_FINDINGS = "ownership_untagged_findings".freeze + end +end