From 5929b5409d477fe2ce7a5dca39b16fe9545ed675 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 27 Jan 2026 16:47:23 +0000 Subject: [PATCH] Regenerate client from commit d98173c of spec repo --- .generator/schemas/v2/openapi.yaml | 202 ++++++++++++++++ .../v2/case-management/ListCaseWatchers.rb | 8 + examples/v2/case-management/UnwatchCase.rb | 8 + examples/v2/case-management/WatchCase.rb | 8 + features/scenarios_model_mapping.rb | 11 + features/v2/case_management.feature | 78 ++++++ features/v2/undo.json | 20 ++ lib/datadog_api_client/configuration.rb | 3 + lib/datadog_api_client/inflector.rb | 5 + .../v2/api/case_management_api.rb | 223 ++++++++++++++++++ lib/datadog_api_client/v2/models/watcher.rb | 165 +++++++++++++ .../v2/models/watcher_relationships.rb | 123 ++++++++++ .../v2/models/watcher_resource_type.rb | 26 ++ .../v2/models/watcher_user_relationship.rb | 123 ++++++++++ .../v2/models/watchers_response.rb | 125 ++++++++++ 15 files changed, 1128 insertions(+) create mode 100644 examples/v2/case-management/ListCaseWatchers.rb create mode 100644 examples/v2/case-management/UnwatchCase.rb create mode 100644 examples/v2/case-management/WatchCase.rb create mode 100644 lib/datadog_api_client/v2/models/watcher.rb create mode 100644 lib/datadog_api_client/v2/models/watcher_relationships.rb create mode 100644 lib/datadog_api_client/v2/models/watcher_resource_type.rb create mode 100644 lib/datadog_api_client/v2/models/watcher_user_relationship.rb create mode 100644 lib/datadog_api_client/v2/models/watchers_response.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index ca425e6bd9f2..685088a65d17 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1125,6 +1125,14 @@ components: schema: example: 00000000-0000-9999-0000-000000000000 type: string + UserUUIDPathParameter: + description: User UUID + example: 8146583c-0b5f-11ec-abf8-da7ad0900001 + in: path + name: user_id + required: true + schema: + type: string WorkflowId: description: The ID of the workflow. in: path @@ -64692,6 +64700,57 @@ components: - X_CONTENT_TYPE_HEADER_MISSING - X_PATH_INJECTION - XSS + Watcher: + description: Case watcher + properties: + id: + description: User UUID of the watcher + example: 8146583c-0b5f-11ec-abf8-da7ad0900001 + type: string + relationships: + $ref: '#/components/schemas/WatcherRelationships' + type: + $ref: '#/components/schemas/WatcherResourceType' + required: + - id + - type + - relationships + type: object + WatcherRelationships: + description: Watcher relationships + properties: + user: + $ref: '#/components/schemas/WatcherUserRelationship' + required: + - user + type: object + WatcherResourceType: + description: Watcher resource type + enum: + - watcher + example: watcher + type: string + x-enum-varnames: + - WATCHER + WatcherUserRelationship: + description: Relationship to user + properties: + data: + $ref: '#/components/schemas/UserRelationshipData' + required: + - data + type: object + WatchersResponse: + description: Response with case watchers + properties: + data: + description: Array of watchers + items: + $ref: '#/components/schemas/Watcher' + type: array + required: + - data + type: object Weekday: description: A day of the week. enum: @@ -70202,6 +70261,149 @@ paths: summary: Unassign case tags: - Case Management + /api/v2/cases/{case_id}/watchers: + get: + description: Get all users watching a case + operationId: ListCaseWatchers + parameters: + - $ref: '#/components/parameters/CaseIDPathParameter' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/WatchersResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cases_read + summary: Get case watchers + tags: + - Case Management + x-unstable: '**Note**: This endpoint is in public beta and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/cases/{case_id}/watchers/{user_id}: + delete: + description: Remove a user from the watchers list for a case + operationId: UnwatchCase + parameters: + - $ref: '#/components/parameters/CaseIDPathParameter' + - $ref: '#/components/parameters/UserUUIDPathParameter' + responses: + '204': + description: No Content + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cases_write + summary: Remove user as watcher + tags: + - Case Management + x-unstable: '**Note**: This endpoint is in public beta and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + post: + description: Add a user as a watcher for a case + operationId: WatchCase + parameters: + - $ref: '#/components/parameters/CaseIDPathParameter' + - $ref: '#/components/parameters/UserUUIDPathParameter' + responses: + '201': + 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 + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cases_write + summary: Add user as watcher + tags: + - Case Management + x-unstable: '**Note**: This endpoint is in public beta and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/catalog/entity: get: description: Get a list of entities from Software Catalog. diff --git a/examples/v2/case-management/ListCaseWatchers.rb b/examples/v2/case-management/ListCaseWatchers.rb new file mode 100644 index 000000000000..f8594bc4e1de --- /dev/null +++ b/examples/v2/case-management/ListCaseWatchers.rb @@ -0,0 +1,8 @@ +# Get case watchers returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.list_case_watchers".to_sym] = true +end +api_instance = DatadogAPIClient::V2::CaseManagementAPI.new +p api_instance.list_case_watchers("case_id") diff --git a/examples/v2/case-management/UnwatchCase.rb b/examples/v2/case-management/UnwatchCase.rb new file mode 100644 index 000000000000..226534528117 --- /dev/null +++ b/examples/v2/case-management/UnwatchCase.rb @@ -0,0 +1,8 @@ +# Remove user as watcher returns "No Content" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.unwatch_case".to_sym] = true +end +api_instance = DatadogAPIClient::V2::CaseManagementAPI.new +api_instance.unwatch_case("case_id", "user_id") diff --git a/examples/v2/case-management/WatchCase.rb b/examples/v2/case-management/WatchCase.rb new file mode 100644 index 000000000000..a862bfa238b5 --- /dev/null +++ b/examples/v2/case-management/WatchCase.rb @@ -0,0 +1,8 @@ +# Add user as watcher returns "Created" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.watch_case".to_sym] = true +end +api_instance = DatadogAPIClient::V2::CaseManagementAPI.new +p api_instance.watch_case("case_id", "user_id") diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 6674c3b1a047..36c5005ad4b4 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -1250,6 +1250,17 @@ "case_id" => "String", "body" => "CaseEmptyRequest", }, + "v2.ListCaseWatchers" => { + "case_id" => "String", + }, + "v2.UnwatchCase" => { + "case_id" => "String", + "user_id" => "String", + }, + "v2.WatchCase" => { + "case_id" => "String", + "user_id" => "String", + }, "v2.CreateCaseType" => { "body" => "CaseTypeCreateRequest", }, diff --git a/features/v2/case_management.feature b/features/v2/case_management.feature index 2f239155671f..4f3de0519bd4 100644 --- a/features/v2/case_management.feature +++ b/features/v2/case_management.feature @@ -10,6 +10,33 @@ Feature: Case Management And a valid "appKeyAuth" key in the system And an instance of "CaseManagement" API + @generated @skip @team:DataDog/case-management + Scenario: Add user as watcher returns "Bad Request" response + Given operation "WatchCase" enabled + And new "WatchCase" request + And request contains "case_id" parameter from "REPLACE.ME" + And request contains "user_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/case-management + Scenario: Add user as watcher returns "Created" response + Given operation "WatchCase" enabled + And new "WatchCase" request + And request contains "case_id" parameter from "REPLACE.ME" + And request contains "user_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 201 Created + + @generated @skip @team:DataDog/case-management + Scenario: Add user as watcher returns "Not Found" response + Given operation "WatchCase" enabled + And new "WatchCase" request + And request contains "case_id" parameter from "REPLACE.ME" + And request contains "user_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + @team:DataDog/case-management Scenario: Archive case returns "Bad Request" response Given new "ArchiveCase" request @@ -203,6 +230,30 @@ Feature: Case Management When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/case-management + Scenario: Get case watchers returns "Bad Request" response + Given operation "ListCaseWatchers" enabled + And new "ListCaseWatchers" request + And request contains "case_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/case-management + Scenario: Get case watchers returns "Not Found" response + Given operation "ListCaseWatchers" enabled + And new "ListCaseWatchers" request + And request contains "case_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/case-management + Scenario: Get case watchers returns "OK" response + Given operation "ListCaseWatchers" enabled + And new "ListCaseWatchers" request + And request contains "case_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @skip @team:DataDog/case-management Scenario: Get the details of a case returns "Bad Request" response Given new "GetCase" request @@ -261,6 +312,33 @@ Feature: Case Management When the request is sent Then the response status is 204 No Content + @generated @skip @team:DataDog/case-management + Scenario: Remove user as watcher returns "Bad Request" response + Given operation "UnwatchCase" enabled + And new "UnwatchCase" request + And request contains "case_id" parameter from "REPLACE.ME" + And request contains "user_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/case-management + Scenario: Remove user as watcher returns "No Content" response + Given operation "UnwatchCase" enabled + And new "UnwatchCase" request + And request contains "case_id" parameter from "REPLACE.ME" + And request contains "user_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/case-management + Scenario: Remove user as watcher returns "Not Found" response + Given operation "UnwatchCase" enabled + And new "UnwatchCase" request + And request contains "case_id" parameter from "REPLACE.ME" + And request contains "user_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + @generated @skip @team:DataDog/case-management Scenario: Search cases returns "Bad Request" response Given new "SearchCases" request diff --git a/features/v2/undo.json b/features/v2/undo.json index 5a347bddf111..6e3e67d08e9a 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -819,6 +819,26 @@ "type": "idempotent" } }, + "ListCaseWatchers": { + "tag": "Case Management", + "undo": { + "type": "safe" + } + }, + "UnwatchCase": { + "tag": "Case Management", + "undo": { + "type": "idempotent" + } + }, + "WatchCase": { + "tag": "Case Management", + "undo": { + "operationId": "TODO", + "parameters": [], + "type": "unsafe" + } + }, "ListCatalogEntity": { "tag": "Software Catalog", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 7085b0efde5e..6a6bc3bdc076 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -208,6 +208,9 @@ def initialize "v2.get_open_api": false, "v2.list_apis": false, "v2.update_open_api": false, + "v2.list_case_watchers": false, + "v2.unwatch_case": false, + "v2.watch_case": false, "v2.cancel_threat_hunting_job": false, "v2.convert_job_result_to_signal": false, "v2.delete_threat_hunting_job": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 1b7a7bac0e8b..353a59f01b41 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -5033,6 +5033,11 @@ def overrides "v2.vulnerability_status" => "VulnerabilityStatus", "v2.vulnerability_tool" => "VulnerabilityTool", "v2.vulnerability_type" => "VulnerabilityType", + "v2.watcher" => "Watcher", + "v2.watcher_relationships" => "WatcherRelationships", + "v2.watcher_resource_type" => "WatcherResourceType", + "v2.watchers_response" => "WatchersResponse", + "v2.watcher_user_relationship" => "WatcherUserRelationship", "v2.weekday" => "Weekday", "v2.widget_live_span" => "WidgetLiveSpan", "v2.workflow_data" => "WorkflowData", diff --git a/lib/datadog_api_client/v2/api/case_management_api.rb b/lib/datadog_api_client/v2/api/case_management_api.rb index 06055c264dd4..a8d45166fbbd 100644 --- a/lib/datadog_api_client/v2/api/case_management_api.rb +++ b/lib/datadog_api_client/v2/api/case_management_api.rb @@ -768,6 +768,77 @@ def get_projects_with_http_info(opts = {}) return data, status_code, headers end + # Get case watchers. + # + # @see #list_case_watchers_with_http_info + def list_case_watchers(case_id, opts = {}) + data, _status_code, _headers = list_case_watchers_with_http_info(case_id, opts) + data + end + + # Get case watchers. + # + # Get all users watching a case + # + # @param case_id [String] Case's UUID or key + # @param opts [Hash] the optional parameters + # @return [Array<(WatchersResponse, Integer, Hash)>] WatchersResponse data, response status code and response headers + def list_case_watchers_with_http_info(case_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.list_case_watchers".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_case_watchers") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_case_watchers")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CaseManagementAPI.list_case_watchers ...' + end + # verify the required parameter 'case_id' is set + if @api_client.config.client_side_validation && case_id.nil? + fail ArgumentError, "Missing the required parameter 'case_id' when calling CaseManagementAPI.list_case_watchers" + end + # resource path + local_var_path = '/api/v2/cases/{case_id}/watchers'.sub('{case_id}', CGI.escape(case_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] || 'WatchersResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :list_case_watchers, + :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: CaseManagementAPI#list_case_watchers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Search cases. # # @see #search_cases_with_http_info @@ -1008,6 +1079,82 @@ def unassign_case_with_http_info(case_id, body, opts = {}) return data, status_code, headers end + # Remove user as watcher. + # + # @see #unwatch_case_with_http_info + def unwatch_case(case_id, user_id, opts = {}) + unwatch_case_with_http_info(case_id, user_id, opts) + nil + end + + # Remove user as watcher. + # + # Remove a user from the watchers list for a case + # + # @param case_id [String] Case's UUID or key + # @param user_id [String] User UUID + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def unwatch_case_with_http_info(case_id, user_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.unwatch_case".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.unwatch_case") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.unwatch_case")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CaseManagementAPI.unwatch_case ...' + end + # verify the required parameter 'case_id' is set + if @api_client.config.client_side_validation && case_id.nil? + fail ArgumentError, "Missing the required parameter 'case_id' when calling CaseManagementAPI.unwatch_case" + end + # verify the required parameter 'user_id' is set + if @api_client.config.client_side_validation && user_id.nil? + fail ArgumentError, "Missing the required parameter 'user_id' when calling CaseManagementAPI.unwatch_case" + end + # resource path + local_var_path = '/api/v2/cases/{case_id}/watchers/{user_id}'.sub('{case_id}', CGI.escape(case_id.to_s).gsub('%2F', '/')).sub('{user_id}', CGI.escape(user_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(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :unwatch_case, + :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::Delete, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CaseManagementAPI#unwatch_case\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Update case attributes. # # @see #update_attributes_with_http_info @@ -1444,5 +1591,81 @@ def update_status_with_http_info(case_id, body, opts = {}) end return data, status_code, headers end + + # Add user as watcher. + # + # @see #watch_case_with_http_info + def watch_case(case_id, user_id, opts = {}) + watch_case_with_http_info(case_id, user_id, opts) + nil + end + + # Add user as watcher. + # + # Add a user as a watcher for a case + # + # @param case_id [String] Case's UUID or key + # @param user_id [String] User UUID + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def watch_case_with_http_info(case_id, user_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.watch_case".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.watch_case") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.watch_case")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CaseManagementAPI.watch_case ...' + end + # verify the required parameter 'case_id' is set + if @api_client.config.client_side_validation && case_id.nil? + fail ArgumentError, "Missing the required parameter 'case_id' when calling CaseManagementAPI.watch_case" + end + # verify the required parameter 'user_id' is set + if @api_client.config.client_side_validation && user_id.nil? + fail ArgumentError, "Missing the required parameter 'user_id' when calling CaseManagementAPI.watch_case" + end + # resource path + local_var_path = '/api/v2/cases/{case_id}/watchers/{user_id}'.sub('{case_id}', CGI.escape(case_id.to_s).gsub('%2F', '/')).sub('{user_id}', CGI.escape(user_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(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :watch_case, + :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: CaseManagementAPI#watch_case\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/watcher.rb b/lib/datadog_api_client/v2/models/watcher.rb new file mode 100644 index 000000000000..53341e726d3d --- /dev/null +++ b/lib/datadog_api_client/v2/models/watcher.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 + # Case watcher + class Watcher + include BaseGenericModel + + # User UUID of the watcher + attr_reader :id + + # Watcher relationships + attr_reader :relationships + + # Watcher resource type + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id', + :'relationships' => :'relationships', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'String', + :'relationships' => :'WatcherRelationships', + :'type' => :'WatcherResourceType' + } + 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::Watcher` 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'relationships') + self.relationships = attributes[:'relationships'] + 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 @id.nil? + return false if @relationships.nil? + return false if @type.nil? + true + 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 relationships [Object] Object to be assigned + # @!visibility private + def relationships=(relationships) + if relationships.nil? + fail ArgumentError, 'invalid value for "relationships", relationships cannot be nil.' + end + @relationships = relationships + 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 && + id == o.id && + relationships == o.relationships && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [id, relationships, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/watcher_relationships.rb b/lib/datadog_api_client/v2/models/watcher_relationships.rb new file mode 100644 index 000000000000..b10ca1e0bfeb --- /dev/null +++ b/lib/datadog_api_client/v2/models/watcher_relationships.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 + # Watcher relationships + class WatcherRelationships + include BaseGenericModel + + # Relationship to user + attr_reader :user + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'user' => :'user' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'user' => :'WatcherUserRelationship' + } + 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::WatcherRelationships` 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?(:'user') + self.user = attributes[:'user'] + 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 @user.nil? + true + end + + # Custom attribute writer method with validation + # @param user [Object] Object to be assigned + # @!visibility private + def user=(user) + if user.nil? + fail ArgumentError, 'invalid value for "user", user cannot be nil.' + end + @user = user + 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 && + user == o.user && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [user, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/watcher_resource_type.rb b/lib/datadog_api_client/v2/models/watcher_resource_type.rb new file mode 100644 index 000000000000..0327a36a1b6a --- /dev/null +++ b/lib/datadog_api_client/v2/models/watcher_resource_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 + # Watcher resource type + class WatcherResourceType + include BaseEnumModel + + WATCHER = "watcher".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/watcher_user_relationship.rb b/lib/datadog_api_client/v2/models/watcher_user_relationship.rb new file mode 100644 index 000000000000..6f855717b62d --- /dev/null +++ b/lib/datadog_api_client/v2/models/watcher_user_relationship.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 + # Relationship to user + class WatcherUserRelationship + include BaseGenericModel + + # Relationship to user object. + 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' => :'UserRelationshipData' + } + 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::WatcherUserRelationship` 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/watchers_response.rb b/lib/datadog_api_client/v2/models/watchers_response.rb new file mode 100644 index 000000000000..9fe8fea9a6c0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/watchers_response.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 + # Response with case watchers + class WatchersResponse + include BaseGenericModel + + # Array of watchers + 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' => :'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::WatchersResponse` 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') + if (value = attributes[:'data']).is_a?(Array) + self.data = 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 @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