diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 5423824d0a66..c356f73bbfd3 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -44827,6 +44827,57 @@ components: required: - data type: object + ProjectFavorite: + description: Project favorite + properties: + id: + description: The project's identifier + example: d4bbe1af-f36e-42f1-87c1-493ca35c320e + type: string + relationships: + $ref: '#/components/schemas/ProjectFavoriteRelationships' + type: + $ref: '#/components/schemas/ProjectFavoriteResourceType' + required: + - id + - type + - relationships + type: object + ProjectFavoriteRelationships: + description: Project favorite relationships + properties: + user: + $ref: '#/components/schemas/ProjectFavoriteUserRelationship' + required: + - user + type: object + ProjectFavoriteResourceType: + description: Project favorite resource type + enum: + - project_favorite + example: project_favorite + type: string + x-enum-varnames: + - PROJECT_FAVORITE + ProjectFavoriteUserRelationship: + description: Relationship to user + properties: + data: + $ref: '#/components/schemas/UserRelationshipData' + required: + - data + type: object + ProjectFavoritesResponse: + description: Response with project favorites + properties: + data: + description: Array of project favorites + items: + $ref: '#/components/schemas/ProjectFavorite' + type: array + required: + - data + type: object ProjectRelationship: description: Relationship to project properties: @@ -85757,6 +85808,139 @@ paths: tags: - Rum Audience Management x-unstable: '**Note**: This endpoint may be subject to changes.' + /api/v2/projects/favorites: + get: + description: Get all projects marked as favorite by the current user + operationId: ListUserProjectFavorites + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ProjectFavoritesResponse' + 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 + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cases_read + summary: Get user's project favorites + tags: + - Case Management + x-unstable: '**Note**: This endpoint is in preview and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/projects/{project_id}/favorites: + delete: + description: Remove a project from the current user's favorites + operationId: UnfavoriteProject + parameters: + - $ref: '#/components/parameters/ProjectIDPathParameter' + 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 project from favorites + tags: + - Case Management + x-unstable: '**Note**: This endpoint is in preview and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + post: + description: Add a project to the current user's favorites + operationId: FavoriteProject + parameters: + - $ref: '#/components/parameters/ProjectIDPathParameter' + 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: Add project to favorites + tags: + - Case Management + x-unstable: '**Note**: This endpoint is in preview and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/query/scalar: post: description: 'Query scalar values (as seen on Query Value, Table, and Toplist diff --git a/examples/v2/case-management/FavoriteProject.rb b/examples/v2/case-management/FavoriteProject.rb new file mode 100644 index 000000000000..53725e7b2c73 --- /dev/null +++ b/examples/v2/case-management/FavoriteProject.rb @@ -0,0 +1,8 @@ +# Add project to favorites returns "No Content" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.favorite_project".to_sym] = true +end +api_instance = DatadogAPIClient::V2::CaseManagementAPI.new +api_instance.favorite_project("project_id") diff --git a/examples/v2/case-management/ListUserProjectFavorites.rb b/examples/v2/case-management/ListUserProjectFavorites.rb new file mode 100644 index 000000000000..bf4cdc9731f7 --- /dev/null +++ b/examples/v2/case-management/ListUserProjectFavorites.rb @@ -0,0 +1,8 @@ +# Get user's project favorites returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.list_user_project_favorites".to_sym] = true +end +api_instance = DatadogAPIClient::V2::CaseManagementAPI.new +p api_instance.list_user_project_favorites() diff --git a/examples/v2/case-management/UnfavoriteProject.rb b/examples/v2/case-management/UnfavoriteProject.rb new file mode 100644 index 000000000000..ea96493f8616 --- /dev/null +++ b/examples/v2/case-management/UnfavoriteProject.rb @@ -0,0 +1,8 @@ +# Remove project from favorites returns "No Content" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.unfavorite_project".to_sym] = true +end +api_instance = DatadogAPIClient::V2::CaseManagementAPI.new +api_instance.unfavorite_project("project_id") diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 6674c3b1a047..468f6c0bde9b 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -1250,6 +1250,12 @@ "case_id" => "String", "body" => "CaseEmptyRequest", }, + "v2.UnfavoriteProject" => { + "project_id" => "String", + }, + "v2.FavoriteProject" => { + "project_id" => "String", + }, "v2.CreateCaseType" => { "body" => "CaseTypeCreateRequest", }, diff --git a/features/v2/case_management.feature b/features/v2/case_management.feature index 2f239155671f..18f549d42aba 100644 --- a/features/v2/case_management.feature +++ b/features/v2/case_management.feature @@ -10,6 +10,30 @@ 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 project to favorites returns "Bad Request" response + Given operation "FavoriteProject" enabled + And new "FavoriteProject" request + And request contains "project_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 project to favorites returns "No Content" response + Given operation "FavoriteProject" enabled + And new "FavoriteProject" request + And request contains "project_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: Add project to favorites returns "Not Found" response + Given operation "FavoriteProject" enabled + And new "FavoriteProject" request + And request contains "project_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 @@ -247,6 +271,20 @@ Feature: Case Management When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/case-management + Scenario: Get user's project favorites returns "Bad Request" response + Given operation "ListUserProjectFavorites" enabled + And new "ListUserProjectFavorites" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/case-management + Scenario: Get user's project favorites returns "OK" response + Given operation "ListUserProjectFavorites" enabled + And new "ListUserProjectFavorites" request + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/case-management Scenario: Remove a project returns "API error response" response Given new "DeleteProject" request @@ -261,6 +299,30 @@ Feature: Case Management When the request is sent Then the response status is 204 No Content + @generated @skip @team:DataDog/case-management + Scenario: Remove project from favorites returns "Bad Request" response + Given operation "UnfavoriteProject" enabled + And new "UnfavoriteProject" request + And request contains "project_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 project from favorites returns "No Content" response + Given operation "UnfavoriteProject" enabled + And new "UnfavoriteProject" request + And request contains "project_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 project from favorites returns "Not Found" response + Given operation "UnfavoriteProject" enabled + And new "UnfavoriteProject" request + And request contains "project_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..17f4c6d172c0 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -3445,6 +3445,26 @@ "type": "safe" } }, + "ListUserProjectFavorites": { + "tag": "Case Management", + "undo": { + "type": "safe" + } + }, + "UnfavoriteProject": { + "tag": "Case Management", + "undo": { + "type": "idempotent" + } + }, + "FavoriteProject": { + "tag": "Case Management", + "undo": { + "operationId": "TODO", + "parameters": [], + "type": "unsafe" + } + }, "QueryScalarData": { "tag": "Metrics", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 7085b0efde5e..4f211986c40c 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.favorite_project": false, + "v2.list_user_project_favorites": false, + "v2.unfavorite_project": 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..9da45c501343 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -3749,6 +3749,11 @@ def overrides "v2.projected_cost_attributes" => "ProjectedCostAttributes", "v2.projected_cost_response" => "ProjectedCostResponse", "v2.projected_cost_type" => "ProjectedCostType", + "v2.project_favorite" => "ProjectFavorite", + "v2.project_favorite_relationships" => "ProjectFavoriteRelationships", + "v2.project_favorite_resource_type" => "ProjectFavoriteResourceType", + "v2.project_favorites_response" => "ProjectFavoritesResponse", + "v2.project_favorite_user_relationship" => "ProjectFavoriteUserRelationship", "v2.project_relationship" => "ProjectRelationship", "v2.project_relationship_data" => "ProjectRelationshipData", "v2.project_relationships" => "ProjectRelationships", 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..0cfa4cf48cc2 100644 --- a/lib/datadog_api_client/v2/api/case_management_api.rb +++ b/lib/datadog_api_client/v2/api/case_management_api.rb @@ -578,6 +578,77 @@ def delete_project_with_http_info(project_id, opts = {}) return data, status_code, headers end + # Add project to favorites. + # + # @see #favorite_project_with_http_info + def favorite_project(project_id, opts = {}) + favorite_project_with_http_info(project_id, opts) + nil + end + + # Add project to favorites. + # + # Add a project to the current user's favorites + # + # @param project_id [String] Project UUID + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def favorite_project_with_http_info(project_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.favorite_project".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.favorite_project") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.favorite_project")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CaseManagementAPI.favorite_project ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling CaseManagementAPI.favorite_project" + end + # resource path + local_var_path = '/api/v2/projects/{project_id}/favorites'.sub('{project_id}', CGI.escape(project_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 => :favorite_project, + :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#favorite_project\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get the details of a case. # # @see #get_case_with_http_info @@ -768,6 +839,72 @@ def get_projects_with_http_info(opts = {}) return data, status_code, headers end + # Get user's project favorites. + # + # @see #list_user_project_favorites_with_http_info + def list_user_project_favorites(opts = {}) + data, _status_code, _headers = list_user_project_favorites_with_http_info(opts) + data + end + + # Get user's project favorites. + # + # Get all projects marked as favorite by the current user + # + # @param opts [Hash] the optional parameters + # @return [Array<(ProjectFavoritesResponse, Integer, Hash)>] ProjectFavoritesResponse data, response status code and response headers + def list_user_project_favorites_with_http_info(opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.list_user_project_favorites".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_user_project_favorites") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_user_project_favorites")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CaseManagementAPI.list_user_project_favorites ...' + end + # resource path + local_var_path = '/api/v2/projects/favorites' + + # 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] || 'ProjectFavoritesResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :list_user_project_favorites, + :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_user_project_favorites\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 +1145,77 @@ def unassign_case_with_http_info(case_id, body, opts = {}) return data, status_code, headers end + # Remove project from favorites. + # + # @see #unfavorite_project_with_http_info + def unfavorite_project(project_id, opts = {}) + unfavorite_project_with_http_info(project_id, opts) + nil + end + + # Remove project from favorites. + # + # Remove a project from the current user's favorites + # + # @param project_id [String] Project UUID + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def unfavorite_project_with_http_info(project_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.unfavorite_project".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.unfavorite_project") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.unfavorite_project")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CaseManagementAPI.unfavorite_project ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling CaseManagementAPI.unfavorite_project" + end + # resource path + local_var_path = '/api/v2/projects/{project_id}/favorites'.sub('{project_id}', CGI.escape(project_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 => :unfavorite_project, + :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#unfavorite_project\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 diff --git a/lib/datadog_api_client/v2/models/project_favorite.rb b/lib/datadog_api_client/v2/models/project_favorite.rb new file mode 100644 index 000000000000..e7dcd7078091 --- /dev/null +++ b/lib/datadog_api_client/v2/models/project_favorite.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 + # Project favorite + class ProjectFavorite + include BaseGenericModel + + # The project's identifier + attr_reader :id + + # Project favorite relationships + attr_reader :relationships + + # Project favorite 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' => :'ProjectFavoriteRelationships', + :'type' => :'ProjectFavoriteResourceType' + } + 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::ProjectFavorite` 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/project_favorite_relationships.rb b/lib/datadog_api_client/v2/models/project_favorite_relationships.rb new file mode 100644 index 000000000000..06fe61c17611 --- /dev/null +++ b/lib/datadog_api_client/v2/models/project_favorite_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 + # Project favorite relationships + class ProjectFavoriteRelationships + 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' => :'ProjectFavoriteUserRelationship' + } + 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::ProjectFavoriteRelationships` 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/project_favorite_resource_type.rb b/lib/datadog_api_client/v2/models/project_favorite_resource_type.rb new file mode 100644 index 000000000000..b662c815747f --- /dev/null +++ b/lib/datadog_api_client/v2/models/project_favorite_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 + # Project favorite resource type + class ProjectFavoriteResourceType + include BaseEnumModel + + PROJECT_FAVORITE = "project_favorite".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/project_favorite_user_relationship.rb b/lib/datadog_api_client/v2/models/project_favorite_user_relationship.rb new file mode 100644 index 000000000000..afd04b008112 --- /dev/null +++ b/lib/datadog_api_client/v2/models/project_favorite_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 ProjectFavoriteUserRelationship + 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::ProjectFavoriteUserRelationship` 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/project_favorites_response.rb b/lib/datadog_api_client/v2/models/project_favorites_response.rb new file mode 100644 index 000000000000..d7349cc6c12c --- /dev/null +++ b/lib/datadog_api_client/v2/models/project_favorites_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 project favorites + class ProjectFavoritesResponse + include BaseGenericModel + + # Array of project favorites + 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::ProjectFavoritesResponse` 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