diff --git a/.apigentools-info b/.apigentools-info index 5fb17f2cc98..2bd6105f24c 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-09-13 20:35:30.566294", - "spec_repo_commit": "6093038f" + "regenerated": "2024-09-16 14:02:51.222172", + "spec_repo_commit": "966987f5" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-09-13 20:35:30.584522", - "spec_repo_commit": "6093038f" + "regenerated": "2024-09-16 14:02:51.240032", + "spec_repo_commit": "966987f5" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 2a6fbf20fcb..e45da8ea46d 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -16752,6 +16752,181 @@ components: $ref: '#/components/schemas/LogQueryDefinition' sort: $ref: '#/components/schemas/WidgetSortBy' + text_formats: + description: List of text formats for columns produced by tags. + items: + $ref: '#/components/schemas/TableWidgetTextFormat' + type: array + type: object + TableWidgetTextFormat: + description: Text format rules for a tag-based column within a table widget. + example: + - match: + type: is + value: fruit + replace: + type: all + with: vegetable + - match: + type: is + value: cake + palette: white_on_green + items: + $ref: '#/components/schemas/TableWidgetTextFormatRule' + minItems: 1 + type: array + TableWidgetTextFormatMatch: + description: Match rule for the table widget text format. + example: + type: is + value: fruit + properties: + type: + $ref: '#/components/schemas/TableWidgetTextFormatMatchType' + value: + description: Table Widget Match String. + example: Match Value + type: string + required: + - type + - value + type: object + TableWidgetTextFormatMatchType: + description: Match or compare option. + enum: + - is + - is_not + - contains + - does_not_contain + - starts_with + - ends_with + example: is + type: string + x-enum-varnames: + - IS + - IS_NOT + - CONTAINS + - DOES_NOT_CONTAIN + - STARTS_WITH + - ENDS_WITH + TableWidgetTextFormatPalette: + default: white_on_green + description: Color-on-color palette to highlight replaced text. + enum: + - white_on_red + - white_on_yellow + - white_on_green + - black_on_light_red + - black_on_light_yellow + - black_on_light_green + - red_on_white + - yellow_on_white + - green_on_white + - custom_bg + - custom_text + type: string + x-enum-varnames: + - WHITE_ON_RED + - WHITE_ON_YELLOW + - WHITE_ON_GREEN + - BLACK_ON_LIGHT_RED + - BLACK_ON_LIGHT_YELLOW + - BLACK_ON_LIGHT_GREEN + - RED_ON_WHITE + - YELLOW_ON_WHITE + - GREEN_ON_WHITE + - CUSTOM_BG + - CUSTOM_TEXT + TableWidgetTextFormatReplace: + description: Replace rule for the table widget text format. + example: + type: all + with: vegetable + oneOf: + - $ref: '#/components/schemas/TableWidgetTextFormatReplaceAll' + - $ref: '#/components/schemas/TableWidgetTextFormatReplaceSubstring' + TableWidgetTextFormatReplaceAll: + description: Match All definition. + example: + type: all + with: vegetable + properties: + type: + $ref: '#/components/schemas/TableWidgetTextFormatReplaceAllType' + with: + description: Replace All type. + example: all + type: string + required: + - type + - with + type: object + TableWidgetTextFormatReplaceAllType: + description: Table widget text format replace all type. + enum: + - all + example: all + type: string + x-enum-varnames: + - ALL + TableWidgetTextFormatReplaceSubstring: + description: Match Sub-string definition. + example: + substring: fruit + type: substring + with: vegetable + properties: + substring: + description: Text that will be replaced. + example: string to replace + type: string + type: + $ref: '#/components/schemas/TableWidgetTextFormatReplaceSubstringType' + with: + description: Text that will replace original sub-string. + example: replacement + type: string + required: + - type + - with + - substring + type: object + TableWidgetTextFormatReplaceSubstringType: + description: Table widget text format replace sub-string type. + enum: + - substring + example: substring + type: string + x-enum-varnames: + - SUBSTRING + TableWidgetTextFormatRule: + description: Text format rules. + example: + match: + type: is + value: apple + replace: + type: all + with: vegetable + properties: + custom_bg_color: + description: Hex representation of the custom background color. Used with + custom background palette option. + example: '#632ca6' + type: string + custom_fg_color: + description: Hex representation of the custom text color. Used with custom + text palette option. + example: '#632ca6' + type: string + match: + $ref: '#/components/schemas/TableWidgetTextFormatMatch' + palette: + $ref: '#/components/schemas/TableWidgetTextFormatPalette' + replace: + $ref: '#/components/schemas/TableWidgetTextFormatReplace' + required: + - match type: object TagToHosts: description: In this object, the key is the tag, the value is a list of host diff --git a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-query-table-widget-and-text-formatting.frozen b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-query-table-widget-and-text-formatting.frozen new file mode 100644 index 00000000000..8c1436deff0 --- /dev/null +++ b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-query-table-widget-and-text-formatting.frozen @@ -0,0 +1 @@ +2024-09-11T14:33:18.508Z \ No newline at end of file diff --git a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-query-table-widget-and-text-formatting.yml b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-query-table-widget-and-text-formatting.yml new file mode 100644 index 00000000000..de964126986 --- /dev/null +++ b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-query-table-widget-and-text-formatting.yml @@ -0,0 +1,50 @@ +http_interactions: +- recorded_at: Wed, 11 Sep 2024 14:33:18 GMT + request: + body: + encoding: UTF-8 + string: '{"description":"","is_read_only":false,"layout_type":"free","notify_list":[],"template_variables":[],"title":"Test-Create_a_new_dashboard_with_query_table_widget_and_text_formatting-1726065198","widgets":[{"definition":{"has_search_bar":"never","requests":[{"formulas":[],"queries":[{"aggregator":"avg","data_source":"metrics","name":"query1","query":"avg:aws.stream.globalaccelerator.processed_bytes_in{*} + by {aws_account,acceleratoripaddress}"},{"aggregator":"avg","data_source":"metrics","name":"query2","query":"avg:aws.stream.globalaccelerator.processed_bytes_out{*} + by {aws_account,acceleratoripaddress}"}],"response_format":"scalar","text_formats":[[{"match":{"type":"is","value":"fruit"},"palette":"white_on_red","replace":{"type":"all","with":"vegetable"}},{"custom_bg_color":"#632ca6","match":{"type":"is","value":"animal"},"palette":"custom_bg"},{"match":{"type":"is","value":"robot"},"palette":"red_on_white"},{"match":{"type":"is","value":"ai"},"palette":"yellow_on_white"}],[{"match":{"type":"is_not","value":"xyz"},"palette":"white_on_yellow"}],[{"match":{"type":"contains","value":"test"},"palette":"white_on_green","replace":{"type":"all","with":"vegetable"}}],[{"match":{"type":"does_not_contain","value":"blah"},"palette":"black_on_light_red"}],[{"match":{"type":"starts_with","value":"abc"},"palette":"black_on_light_yellow"}],[{"match":{"type":"ends_with","value":"xyz"},"palette":"black_on_light_green"},{"match":{"type":"ends_with","value":"zzz"},"palette":"green_on_white"},{"custom_fg_color":"#632ca6","match":{"type":"is","value":"animal"},"palette":"custom_text"}]]}],"title":"","title_align":"left","title_size":"16","type":"query_table"},"layout":{"height":4,"width":4,"x":0,"y":0}}]}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v1/dashboard + response: + body: + encoding: UTF-8 + string: '{"id":"462-puf-hkg","title":"Test-Create_a_new_dashboard_with_query_table_widget_and_text_formatting-1726065198","description":"","author_handle":"frog@datadoghq.com","author_name":null,"layout_type":"free","url":"/dashboard/462-puf-hkg/test-createanewdashboardwithquerytablewidgetandtextformatting-1726065198","is_read_only":false,"template_variables":[],"widgets":[{"definition":{"has_search_bar":"never","requests":[{"formulas":[],"queries":[{"aggregator":"avg","data_source":"metrics","name":"query1","query":"avg:aws.stream.globalaccelerator.processed_bytes_in{*} + by {aws_account,acceleratoripaddress}"},{"aggregator":"avg","data_source":"metrics","name":"query2","query":"avg:aws.stream.globalaccelerator.processed_bytes_out{*} + by {aws_account,acceleratoripaddress}"}],"response_format":"scalar","text_formats":[[{"match":{"type":"is","value":"fruit"},"palette":"white_on_red","replace":{"type":"all","with":"vegetable"}},{"custom_bg_color":"#632ca6","match":{"type":"is","value":"animal"},"palette":"custom_bg"},{"match":{"type":"is","value":"robot"},"palette":"red_on_white"},{"match":{"type":"is","value":"ai"},"palette":"yellow_on_white"}],[{"match":{"type":"is_not","value":"xyz"},"palette":"white_on_yellow"}],[{"match":{"type":"contains","value":"test"},"palette":"white_on_green","replace":{"type":"all","with":"vegetable"}}],[{"match":{"type":"does_not_contain","value":"blah"},"palette":"black_on_light_red"}],[{"match":{"type":"starts_with","value":"abc"},"palette":"black_on_light_yellow"}],[{"match":{"type":"ends_with","value":"xyz"},"palette":"black_on_light_green"},{"match":{"type":"ends_with","value":"zzz"},"palette":"green_on_white"},{"custom_fg_color":"#632ca6","match":{"type":"is","value":"animal"},"palette":"custom_text"}]]}],"title":"","title_align":"left","title_size":"16","type":"query_table"},"layout":{"height":4,"width":4,"x":0,"y":0},"id":3373154044387493}],"notify_list":[],"created_at":"2024-09-11T14:33:18.843540+00:00","modified_at":"2024-09-11T14:33:18.843540+00:00","experience_type":"default","restricted_roles":[]} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Wed, 11 Sep 2024 14:33:18 GMT + request: + body: null + headers: + Accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v1/dashboard/462-puf-hkg + response: + body: + encoding: UTF-8 + string: '{"deleted_dashboard_id":"462-puf-hkg"} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/examples/v1/dashboards/CreateDashboard_794302680.rb b/examples/v1/dashboards/CreateDashboard_794302680.rb new file mode 100644 index 00000000000..3bfba10edd8 --- /dev/null +++ b/examples/v1/dashboards/CreateDashboard_794302680.rb @@ -0,0 +1,152 @@ +# Create a new dashboard with query_table widget and text formatting + +require "datadog_api_client" +api_instance = DatadogAPIClient::V1::DashboardsAPI.new + +body = DatadogAPIClient::V1::Dashboard.new({ + title: "Example-Dashboard", + description: "", + widgets: [ + DatadogAPIClient::V1::Widget.new({ + definition: DatadogAPIClient::V1::TableWidgetDefinition.new({ + title: "", + title_size: "16", + title_align: DatadogAPIClient::V1::WidgetTextAlign::LEFT, + type: DatadogAPIClient::V1::TableWidgetDefinitionType::QUERY_TABLE, + requests: [ + DatadogAPIClient::V1::TableWidgetRequest.new({ + queries: [ + DatadogAPIClient::V1::FormulaAndFunctionMetricQueryDefinition.new({ + aggregator: DatadogAPIClient::V1::FormulaAndFunctionMetricAggregation::AVG, + data_source: DatadogAPIClient::V1::FormulaAndFunctionMetricDataSource::METRICS, + name: "query1", + query: "avg:aws.stream.globalaccelerator.processed_bytes_in{*} by {aws_account,acceleratoripaddress}", + }), + DatadogAPIClient::V1::FormulaAndFunctionMetricQueryDefinition.new({ + aggregator: DatadogAPIClient::V1::FormulaAndFunctionMetricAggregation::AVG, + data_source: DatadogAPIClient::V1::FormulaAndFunctionMetricDataSource::METRICS, + name: "query2", + query: "avg:aws.stream.globalaccelerator.processed_bytes_out{*} by {aws_account,acceleratoripaddress}", + }), + ], + response_format: DatadogAPIClient::V1::FormulaAndFunctionResponseFormat::SCALAR, + text_formats: [ + [ + DatadogAPIClient::V1::TableWidgetTextFormatRule.new({ + match: DatadogAPIClient::V1::TableWidgetTextFormatMatch.new({ + type: DatadogAPIClient::V1::TableWidgetTextFormatMatchType::IS, + value: "fruit", + }), + palette: DatadogAPIClient::V1::TableWidgetTextFormatPalette::WHITE_ON_RED, + replace: DatadogAPIClient::V1::TableWidgetTextFormatReplaceAll.new({ + type: DatadogAPIClient::V1::TableWidgetTextFormatReplaceAllType::ALL, + with: "vegetable", + }), + }), + DatadogAPIClient::V1::TableWidgetTextFormatRule.new({ + match: DatadogAPIClient::V1::TableWidgetTextFormatMatch.new({ + type: DatadogAPIClient::V1::TableWidgetTextFormatMatchType::IS, + value: "animal", + }), + palette: DatadogAPIClient::V1::TableWidgetTextFormatPalette::CUSTOM_BG, + custom_bg_color: "#632ca6", + }), + DatadogAPIClient::V1::TableWidgetTextFormatRule.new({ + match: DatadogAPIClient::V1::TableWidgetTextFormatMatch.new({ + type: DatadogAPIClient::V1::TableWidgetTextFormatMatchType::IS, + value: "robot", + }), + palette: DatadogAPIClient::V1::TableWidgetTextFormatPalette::RED_ON_WHITE, + }), + DatadogAPIClient::V1::TableWidgetTextFormatRule.new({ + match: DatadogAPIClient::V1::TableWidgetTextFormatMatch.new({ + type: DatadogAPIClient::V1::TableWidgetTextFormatMatchType::IS, + value: "ai", + }), + palette: DatadogAPIClient::V1::TableWidgetTextFormatPalette::YELLOW_ON_WHITE, + }), + ], + [ + DatadogAPIClient::V1::TableWidgetTextFormatRule.new({ + match: DatadogAPIClient::V1::TableWidgetTextFormatMatch.new({ + type: DatadogAPIClient::V1::TableWidgetTextFormatMatchType::IS_NOT, + value: "xyz", + }), + palette: DatadogAPIClient::V1::TableWidgetTextFormatPalette::WHITE_ON_YELLOW, + }), + ], + [ + DatadogAPIClient::V1::TableWidgetTextFormatRule.new({ + match: DatadogAPIClient::V1::TableWidgetTextFormatMatch.new({ + type: DatadogAPIClient::V1::TableWidgetTextFormatMatchType::CONTAINS, + value: "test", + }), + palette: DatadogAPIClient::V1::TableWidgetTextFormatPalette::WHITE_ON_GREEN, + replace: DatadogAPIClient::V1::TableWidgetTextFormatReplaceAll.new({ + type: DatadogAPIClient::V1::TableWidgetTextFormatReplaceAllType::ALL, + with: "vegetable", + }), + }), + ], + [ + DatadogAPIClient::V1::TableWidgetTextFormatRule.new({ + match: DatadogAPIClient::V1::TableWidgetTextFormatMatch.new({ + type: DatadogAPIClient::V1::TableWidgetTextFormatMatchType::DOES_NOT_CONTAIN, + value: "blah", + }), + palette: DatadogAPIClient::V1::TableWidgetTextFormatPalette::BLACK_ON_LIGHT_RED, + }), + ], + [ + DatadogAPIClient::V1::TableWidgetTextFormatRule.new({ + match: DatadogAPIClient::V1::TableWidgetTextFormatMatch.new({ + type: DatadogAPIClient::V1::TableWidgetTextFormatMatchType::STARTS_WITH, + value: "abc", + }), + palette: DatadogAPIClient::V1::TableWidgetTextFormatPalette::BLACK_ON_LIGHT_YELLOW, + }), + ], + [ + DatadogAPIClient::V1::TableWidgetTextFormatRule.new({ + match: DatadogAPIClient::V1::TableWidgetTextFormatMatch.new({ + type: DatadogAPIClient::V1::TableWidgetTextFormatMatchType::ENDS_WITH, + value: "xyz", + }), + palette: DatadogAPIClient::V1::TableWidgetTextFormatPalette::BLACK_ON_LIGHT_GREEN, + }), + DatadogAPIClient::V1::TableWidgetTextFormatRule.new({ + match: DatadogAPIClient::V1::TableWidgetTextFormatMatch.new({ + type: DatadogAPIClient::V1::TableWidgetTextFormatMatchType::ENDS_WITH, + value: "zzz", + }), + palette: DatadogAPIClient::V1::TableWidgetTextFormatPalette::GREEN_ON_WHITE, + }), + DatadogAPIClient::V1::TableWidgetTextFormatRule.new({ + match: DatadogAPIClient::V1::TableWidgetTextFormatMatch.new({ + type: DatadogAPIClient::V1::TableWidgetTextFormatMatchType::IS, + value: "animal", + }), + palette: DatadogAPIClient::V1::TableWidgetTextFormatPalette::CUSTOM_TEXT, + custom_fg_color: "#632ca6", + }), + ], + ], + formulas: [], + }), + ], + has_search_bar: DatadogAPIClient::V1::TableWidgetHasSearchBar::NEVER, + }), + layout: DatadogAPIClient::V1::WidgetLayout.new({ + x: 0, + y: 0, + width: 4, + height: 4, + }), + }), + ], + template_variables: [], + layout_type: DatadogAPIClient::V1::DashboardLayoutType::FREE, + is_read_only: false, + notify_list: [], +}) +p api_instance.create_dashboard(body) diff --git a/features/v1/dashboards.feature b/features/v1/dashboards.feature index 27f714940da..33eaed7f4cc 100644 --- a/features/v1/dashboards.feature +++ b/features/v1/dashboards.feature @@ -580,6 +580,22 @@ Feature: Dashboards And the response "widgets[0].definition.requests[0].sort.order_by[0].type" is equal to "formula" And the response "widgets[0].definition.requests[0].sort.order_by[0].index" is equal to 0 + @team:DataDog/dashboards-backend + Scenario: Create a new dashboard with query_table widget and text formatting + Given new "CreateDashboard" request + And body from file "dashboards_json_payload/query_table_widget_text_formatting.json" + When the request is sent + Then the response status is 200 OK + And the response "widgets[0].definition.type" is equal to "query_table" + And the response "widgets[0].definition.requests[0].text_formats[0][0].match.type" is equal to "is" + And the response "widgets[0].definition.requests[0].text_formats[0][0].match.value" is equal to "fruit" + And the response "widgets[0].definition.requests[0].text_formats[0][0].palette" is equal to "white_on_red" + And the response "widgets[0].definition.requests[0].text_formats[0][0].replace.type" is equal to "all" + And the response "widgets[0].definition.requests[0].text_formats[0][0].replace.with" is equal to "vegetable" + And the response "widgets[0].definition.requests[0].text_formats[0][1].palette" is equal to "custom_bg" + And the response "widgets[0].definition.requests[0].text_formats[0][1].custom_bg_color" is equal to "#632ca6" + And the response "widgets[0].definition.requests[0].text_formats[5][2].custom_fg_color" is equal to "#632ca6" + @team:DataDog/dashboards-backend Scenario: Create a new dashboard with query_value widget Given new "CreateDashboard" request diff --git a/features/v1/dashboards_json_payload/query_table_widget_text_formatting.json b/features/v1/dashboards_json_payload/query_table_widget_text_formatting.json new file mode 100644 index 00000000000..16ab243051d --- /dev/null +++ b/features/v1/dashboards_json_payload/query_table_widget_text_formatting.json @@ -0,0 +1,147 @@ +{ + "title": "{{ unique }}", + "description": "", + "widgets": [ + { + "definition": { + "title": "", + "title_size": "16", + "title_align": "left", + "type": "query_table", + "requests": [ + { + "queries": [ + { + "aggregator": "avg", + "data_source": "metrics", + "name": "query1", + "query": "avg:aws.stream.globalaccelerator.processed_bytes_in{*} by {aws_account,acceleratoripaddress}" + }, + { + "aggregator": "avg", + "data_source": "metrics", + "name": "query2", + "query": "avg:aws.stream.globalaccelerator.processed_bytes_out{*} by {aws_account,acceleratoripaddress}" + } + ], + "response_format": "scalar", + "text_formats": [ + [ + { + "match": { + "type": "is", + "value": "fruit" + }, + "palette": "white_on_red", + "replace": { + "type": "all", + "with": "vegetable" + } + }, + { + "match": { + "type": "is", + "value": "animal" + }, + "palette": "custom_bg", + "custom_bg_color": "#632ca6" + }, + { + "match": { + "type": "is", + "value": "robot" + }, + "palette": "red_on_white" + }, + { + "match": { + "type": "is", + "value": "ai" + }, + "palette": "yellow_on_white" + } + ], + [ + { + "match": { + "type": "is_not", + "value": "xyz" + }, + "palette": "white_on_yellow" + } + ], + [ + { + "match": { + "type": "contains", + "value": "test" + }, + "palette": "white_on_green", + "replace": { + "type": "all", + "with": "vegetable" + } + } + ], + [ + { + "match": { + "type": "does_not_contain", + "value": "blah" + }, + "palette": "black_on_light_red" + } + ], + [ + { + "match": { + "type": "starts_with", + "value": "abc" + }, + "palette": "black_on_light_yellow" + } + ], + [ + { + "match": { + "type": "ends_with", + "value": "xyz" + }, + "palette": "black_on_light_green" + }, + { + "match": { + "type": "ends_with", + "value": "zzz" + }, + "palette": "green_on_white" + }, + { + "match": { + "type": "is", + "value": "animal" + }, + "palette": "custom_text", + "custom_fg_color": "#632ca6" + } + ] + ], + "formulas": [ + ] + } + ], + "has_search_bar": "never" + }, + "layout": { + "x": 0, + "y": 0, + "width": 4, + "height": 4 + } + } + ], + "template_variables": [], + "layout_type": "free", + "is_read_only": false, + "notify_list": [] +} diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 4cce0650120..f2d9d0c4b69 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -692,6 +692,15 @@ def overrides "v1.table_widget_definition_type" => "TableWidgetDefinitionType", "v1.table_widget_has_search_bar" => "TableWidgetHasSearchBar", "v1.table_widget_request" => "TableWidgetRequest", + "v1.table_widget_text_format_match" => "TableWidgetTextFormatMatch", + "v1.table_widget_text_format_match_type" => "TableWidgetTextFormatMatchType", + "v1.table_widget_text_format_palette" => "TableWidgetTextFormatPalette", + "v1.table_widget_text_format_replace" => "TableWidgetTextFormatReplace", + "v1.table_widget_text_format_replace_all" => "TableWidgetTextFormatReplaceAll", + "v1.table_widget_text_format_replace_all_type" => "TableWidgetTextFormatReplaceAllType", + "v1.table_widget_text_format_replace_substring" => "TableWidgetTextFormatReplaceSubstring", + "v1.table_widget_text_format_replace_substring_type" => "TableWidgetTextFormatReplaceSubstringType", + "v1.table_widget_text_format_rule" => "TableWidgetTextFormatRule", "v1.tag_to_hosts" => "TagToHosts", "v1.target_format_type" => "TargetFormatType", "v1.timeseries_background" => "TimeseriesBackground", diff --git a/lib/datadog_api_client/v1/models/table_widget_request.rb b/lib/datadog_api_client/v1/models/table_widget_request.rb index fea7f99bc81..c0b97c72e94 100644 --- a/lib/datadog_api_client/v1/models/table_widget_request.rb +++ b/lib/datadog_api_client/v1/models/table_widget_request.rb @@ -81,6 +81,9 @@ class TableWidgetRequest # The controls for sorting the widget. attr_accessor :sort + # List of text formats for columns produced by tags. + attr_accessor :text_formats + attr_accessor :additional_properties # Attribute mapping from ruby-style variable name to JSON key. @@ -106,7 +109,8 @@ def self.attribute_map :'response_format' => :'response_format', :'rum_query' => :'rum_query', :'security_query' => :'security_query', - :'sort' => :'sort' + :'sort' => :'sort', + :'text_formats' => :'text_formats' } end @@ -133,7 +137,8 @@ def self.openapi_types :'response_format' => :'FormulaAndFunctionResponseFormat', :'rum_query' => :'LogQueryDefinition', :'security_query' => :'LogQueryDefinition', - :'sort' => :'WidgetSortBy' + :'sort' => :'WidgetSortBy', + :'text_formats' => :'Array>' } end @@ -242,6 +247,12 @@ def initialize(attributes = {}) if attributes.key?(:'sort') self.sort = attributes[:'sort'] end + + if attributes.key?(:'text_formats') + if (value = attributes[:'text_formats']).is_a?(Array) + self.text_formats = value + end + end end # Returns the object in the form of hash, with additionalProperties support. @@ -289,7 +300,8 @@ def ==(o) response_format == o.response_format && rum_query == o.rum_query && security_query == o.security_query && - sort == o.sort + sort == o.sort && + text_formats == o.text_formats additional_properties == o.additional_properties end @@ -297,7 +309,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [aggregator, _alias, apm_query, apm_stats_query, cell_display_mode, conditional_formats, event_query, formulas, limit, log_query, network_query, order, process_query, profile_metrics_query, q, queries, response_format, rum_query, security_query, sort].hash + [aggregator, _alias, apm_query, apm_stats_query, cell_display_mode, conditional_formats, event_query, formulas, limit, log_query, network_query, order, process_query, profile_metrics_query, q, queries, response_format, rum_query, security_query, sort, text_formats].hash end end end diff --git a/lib/datadog_api_client/v1/models/table_widget_text_format_match.rb b/lib/datadog_api_client/v1/models/table_widget_text_format_match.rb new file mode 100644 index 00000000000..b076d6a0e15 --- /dev/null +++ b/lib/datadog_api_client/v1/models/table_widget_text_format_match.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V1 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::V1 + # Match rule for the table widget text format. + class TableWidgetTextFormatMatch + include BaseGenericModel + + # Match or compare option. + attr_reader :type + + # Table Widget Match String. + attr_reader :value + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'type' => :'type', + :'value' => :'value' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'type' => :'TableWidgetTextFormatMatchType', + :'value' => :'String' + } + 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::V1::TableWidgetTextFormatMatch` 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?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'value') + self.value = attributes[:'value'] + 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 @type.nil? + return false if @value.nil? + true + 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 + + # Custom attribute writer method with validation + # @param value [Object] Object to be assigned + # @!visibility private + def value=(value) + if value.nil? + fail ArgumentError, 'invalid value for "value", value cannot be nil.' + end + @value = value + 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 && + type == o.type && + value == o.value + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [type, value].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/table_widget_text_format_match_type.rb b/lib/datadog_api_client/v1/models/table_widget_text_format_match_type.rb new file mode 100644 index 00000000000..a15a1352e11 --- /dev/null +++ b/lib/datadog_api_client/v1/models/table_widget_text_format_match_type.rb @@ -0,0 +1,31 @@ +=begin +#Datadog API V1 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::V1 + # Match or compare option. + class TableWidgetTextFormatMatchType + include BaseEnumModel + + IS = "is".freeze + IS_NOT = "is_not".freeze + CONTAINS = "contains".freeze + DOES_NOT_CONTAIN = "does_not_contain".freeze + STARTS_WITH = "starts_with".freeze + ENDS_WITH = "ends_with".freeze + end +end diff --git a/lib/datadog_api_client/v1/models/table_widget_text_format_palette.rb b/lib/datadog_api_client/v1/models/table_widget_text_format_palette.rb new file mode 100644 index 00000000000..7afddc78ec7 --- /dev/null +++ b/lib/datadog_api_client/v1/models/table_widget_text_format_palette.rb @@ -0,0 +1,36 @@ +=begin +#Datadog API V1 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::V1 + # Color-on-color palette to highlight replaced text. + class TableWidgetTextFormatPalette + include BaseEnumModel + + WHITE_ON_RED = "white_on_red".freeze + WHITE_ON_YELLOW = "white_on_yellow".freeze + WHITE_ON_GREEN = "white_on_green".freeze + BLACK_ON_LIGHT_RED = "black_on_light_red".freeze + BLACK_ON_LIGHT_YELLOW = "black_on_light_yellow".freeze + BLACK_ON_LIGHT_GREEN = "black_on_light_green".freeze + RED_ON_WHITE = "red_on_white".freeze + YELLOW_ON_WHITE = "yellow_on_white".freeze + GREEN_ON_WHITE = "green_on_white".freeze + CUSTOM_BG = "custom_bg".freeze + CUSTOM_TEXT = "custom_text".freeze + end +end diff --git a/lib/datadog_api_client/v1/models/table_widget_text_format_replace.rb b/lib/datadog_api_client/v1/models/table_widget_text_format_replace.rb new file mode 100644 index 00000000000..8703a20ead1 --- /dev/null +++ b/lib/datadog_api_client/v1/models/table_widget_text_format_replace.rb @@ -0,0 +1,63 @@ +=begin +#Datadog API V1 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::V1 + # Replace rule for the table widget text format. + module TableWidgetTextFormatReplace + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'TableWidgetTextFormatReplaceAll', + :'TableWidgetTextFormatReplaceSubstring' + ] + end + # Builds the object + # @param data [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) + end + end + end + end +end diff --git a/lib/datadog_api_client/v1/models/table_widget_text_format_replace_all.rb b/lib/datadog_api_client/v1/models/table_widget_text_format_replace_all.rb new file mode 100644 index 00000000000..289d7c5808e --- /dev/null +++ b/lib/datadog_api_client/v1/models/table_widget_text_format_replace_all.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V1 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::V1 + # Match All definition. + class TableWidgetTextFormatReplaceAll + include BaseGenericModel + + # Table widget text format replace all type. + attr_reader :type + + # Replace All type. + attr_reader :with + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'type' => :'type', + :'with' => :'with' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'type' => :'TableWidgetTextFormatReplaceAllType', + :'with' => :'String' + } + 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::V1::TableWidgetTextFormatReplaceAll` 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?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'with') + self.with = attributes[:'with'] + 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 @type.nil? + return false if @with.nil? + true + 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 + + # Custom attribute writer method with validation + # @param with [Object] Object to be assigned + # @!visibility private + def with=(with) + if with.nil? + fail ArgumentError, 'invalid value for "with", with cannot be nil.' + end + @with = with + 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 && + type == o.type && + with == o.with + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [type, with].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/table_widget_text_format_replace_all_type.rb b/lib/datadog_api_client/v1/models/table_widget_text_format_replace_all_type.rb new file mode 100644 index 00000000000..9937deb1ec5 --- /dev/null +++ b/lib/datadog_api_client/v1/models/table_widget_text_format_replace_all_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V1 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::V1 + # Table widget text format replace all type. + class TableWidgetTextFormatReplaceAllType + include BaseEnumModel + + ALL = "all".freeze + end +end diff --git a/lib/datadog_api_client/v1/models/table_widget_text_format_replace_substring.rb b/lib/datadog_api_client/v1/models/table_widget_text_format_replace_substring.rb new file mode 100644 index 00000000000..0aa8e2bdec9 --- /dev/null +++ b/lib/datadog_api_client/v1/models/table_widget_text_format_replace_substring.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V1 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::V1 + # Match Sub-string definition. + class TableWidgetTextFormatReplaceSubstring + include BaseGenericModel + + # Text that will be replaced. + attr_reader :substring + + # Table widget text format replace sub-string type. + attr_reader :type + + # Text that will replace original sub-string. + attr_reader :with + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'substring' => :'substring', + :'type' => :'type', + :'with' => :'with' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'substring' => :'String', + :'type' => :'TableWidgetTextFormatReplaceSubstringType', + :'with' => :'String' + } + 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::V1::TableWidgetTextFormatReplaceSubstring` 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?(:'substring') + self.substring = attributes[:'substring'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'with') + self.with = attributes[:'with'] + 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 @substring.nil? + return false if @type.nil? + return false if @with.nil? + true + end + + # Custom attribute writer method with validation + # @param substring [Object] Object to be assigned + # @!visibility private + def substring=(substring) + if substring.nil? + fail ArgumentError, 'invalid value for "substring", substring cannot be nil.' + end + @substring = substring + 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 + + # Custom attribute writer method with validation + # @param with [Object] Object to be assigned + # @!visibility private + def with=(with) + if with.nil? + fail ArgumentError, 'invalid value for "with", with cannot be nil.' + end + @with = with + 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 && + substring == o.substring && + type == o.type && + with == o.with + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [substring, type, with].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/table_widget_text_format_replace_substring_type.rb b/lib/datadog_api_client/v1/models/table_widget_text_format_replace_substring_type.rb new file mode 100644 index 00000000000..881c0c07be2 --- /dev/null +++ b/lib/datadog_api_client/v1/models/table_widget_text_format_replace_substring_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V1 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::V1 + # Table widget text format replace sub-string type. + class TableWidgetTextFormatReplaceSubstringType + include BaseEnumModel + + SUBSTRING = "substring".freeze + end +end diff --git a/lib/datadog_api_client/v1/models/table_widget_text_format_rule.rb b/lib/datadog_api_client/v1/models/table_widget_text_format_rule.rb new file mode 100644 index 00000000000..38517329f06 --- /dev/null +++ b/lib/datadog_api_client/v1/models/table_widget_text_format_rule.rb @@ -0,0 +1,163 @@ +=begin +#Datadog API V1 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::V1 + # Text format rules. + class TableWidgetTextFormatRule + include BaseGenericModel + + # Hex representation of the custom background color. Used with custom background palette option. + attr_accessor :custom_bg_color + + # Hex representation of the custom text color. Used with custom text palette option. + attr_accessor :custom_fg_color + + # Match rule for the table widget text format. + attr_reader :match + + # Color-on-color palette to highlight replaced text. + attr_accessor :palette + + # Replace rule for the table widget text format. + attr_accessor :replace + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'custom_bg_color' => :'custom_bg_color', + :'custom_fg_color' => :'custom_fg_color', + :'match' => :'match', + :'palette' => :'palette', + :'replace' => :'replace' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'custom_bg_color' => :'String', + :'custom_fg_color' => :'String', + :'match' => :'TableWidgetTextFormatMatch', + :'palette' => :'TableWidgetTextFormatPalette', + :'replace' => :'TableWidgetTextFormatReplace' + } + 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::V1::TableWidgetTextFormatRule` 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?(:'custom_bg_color') + self.custom_bg_color = attributes[:'custom_bg_color'] + end + + if attributes.key?(:'custom_fg_color') + self.custom_fg_color = attributes[:'custom_fg_color'] + end + + if attributes.key?(:'match') + self.match = attributes[:'match'] + end + + if attributes.key?(:'palette') + self.palette = attributes[:'palette'] + end + + if attributes.key?(:'replace') + self.replace = attributes[:'replace'] + 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 @match.nil? + true + end + + # Custom attribute writer method with validation + # @param match [Object] Object to be assigned + # @!visibility private + def match=(match) + if match.nil? + fail ArgumentError, 'invalid value for "match", match cannot be nil.' + end + @match = match + 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 && + custom_bg_color == o.custom_bg_color && + custom_fg_color == o.custom_fg_color && + match == o.match && + palette == o.palette && + replace == o.replace + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [custom_bg_color, custom_fg_color, match, palette, replace].hash + end + end +end