diff --git a/.apigentools-info b/.apigentools-info index ba437d41fb6d..5f069d32873d 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.4", - "regenerated": "2023-03-24 16:41:55.214844", - "spec_repo_commit": "9bdb5ee6" + "regenerated": "2023-03-27 19:48:11.680896", + "spec_repo_commit": "b6741167" }, "v2": { "apigentools_version": "1.6.4", - "regenerated": "2023-03-24 16:41:55.227275", - "spec_repo_commit": "9bdb5ee6" + "regenerated": "2023-03-27 19:48:11.693806", + "spec_repo_commit": "b6741167" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index e028210fe1fc..8207e424a0a1 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -1006,6 +1006,14 @@ components: description: A role UUID. type: string type: array + tags: + description: List of team names representing ownership of a dashboard. + items: + description: The name of a Datadog team of the form `team:` + type: string + maxItems: 5 + nullable: true + type: array template_variable_presets: description: Array of template variables saved views. items: diff --git a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-invalid-team-tags-returns-Bad-Request-response.frozen b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-invalid-team-tags-returns-Bad-Request-response.frozen new file mode 100644 index 000000000000..f42aca7bd61b --- /dev/null +++ b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-invalid-team-tags-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2023-03-08T22:44:59.472Z \ No newline at end of file diff --git a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-invalid-team-tags-returns-Bad-Request-response.yml b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-invalid-team-tags-returns-Bad-Request-response.yml new file mode 100644 index 000000000000..190974b83288 --- /dev/null +++ b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-invalid-team-tags-returns-Bad-Request-response.yml @@ -0,0 +1,24 @@ +http_interactions: +- recorded_at: Wed, 08 Mar 2023 22:44:59 GMT + request: + body: + encoding: UTF-8 + string: '{"layout_type":"ordered","tags":["tm:foobar"],"title":"Test-Create_a_new_dashboard_with_invalid_team_tags_returns_Bad_Request_response-1678315499","widgets":[{"definition":{"requests":[{"change_type":"absolute","compare_to":"hour_before","formulas":[{"formula":"hour_before(query1)"},{"formula":"query1"}],"increase_good":true,"order_by":"change","order_dir":"desc","queries":[{"compute":{"aggregation":"count"},"data_source":"logs","group_by":[],"indexes":["*"],"name":"query1","search":{"query":""}}],"response_format":"scalar"}],"time":{},"title":"","title_align":"left","title_size":"16","type":"change"},"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: '{"errors":["Invalid tag format. Tag key must be `team`."]}' + headers: + Content-Type: + - application/json + status: + code: 400 + message: Bad Request +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-team-tags-returns-OK-response.frozen b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-team-tags-returns-OK-response.frozen new file mode 100644 index 000000000000..1d5de377733c --- /dev/null +++ b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-team-tags-returns-OK-response.frozen @@ -0,0 +1 @@ +2023-03-08T20:53:52.326Z \ No newline at end of file diff --git a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-team-tags-returns-OK-response.yml b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-team-tags-returns-OK-response.yml new file mode 100644 index 000000000000..dca63fbde84a --- /dev/null +++ b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-team-tags-returns-OK-response.yml @@ -0,0 +1,46 @@ +http_interactions: +- recorded_at: Wed, 08 Mar 2023 20:53:52 GMT + request: + body: + encoding: UTF-8 + string: '{"layout_type":"ordered","tags":["team:foobar"],"title":"Test-Create_a_new_dashboard_with_team_tags_returns_OK_response-1678308832","widgets":[{"definition":{"requests":[{"change_type":"absolute","compare_to":"hour_before","formulas":[{"formula":"hour_before(query1)"},{"formula":"query1"}],"increase_good":true,"order_by":"change","order_dir":"desc","queries":[{"compute":{"aggregation":"count"},"data_source":"logs","group_by":[],"indexes":["*"],"name":"query1","search":{"query":""}}],"response_format":"scalar"}],"time":{},"title":"","title_align":"left","title_size":"16","type":"change"},"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":"cvx-m2c-ntf","title":"Test-Create_a_new_dashboard_with_team_tags_returns_OK_response-1678308832","description":null,"author_handle":"frog@datadoghq.com","author_name":null,"layout_type":"ordered","url":"/dashboard/cvx-m2c-ntf/test-createanewdashboardwithteamtagsreturnsokresponse-1678308832","is_read_only":false,"template_variables":null,"widgets":[{"definition":{"requests":[{"change_type":"absolute","compare_to":"hour_before","formulas":[{"formula":"hour_before(query1)"},{"formula":"query1"}],"increase_good":true,"order_by":"change","order_dir":"desc","queries":[{"compute":{"aggregation":"count"},"data_source":"logs","group_by":[],"indexes":["*"],"name":"query1","search":{"query":""}}],"response_format":"scalar"}],"time":{},"title":"","title_align":"left","title_size":"16","type":"change"},"layout":{"height":4,"width":4,"x":0,"y":0},"id":3494387223047491}],"notify_list":null,"created_at":"2023-03-08T20:53:52.690739+00:00","modified_at":"2023-03-08T20:53:52.690739+00:00","tags":["team:foobar"],"restricted_roles":[]} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Wed, 08 Mar 2023 20:53:52 GMT + request: + body: null + headers: + Accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v1/dashboard/cvx-m2c-ntf + response: + body: + encoding: UTF-8 + string: '{"deleted_dashboard_id":"cvx-m2c-ntf"} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v1/dashboards/Update-a-dashboard-with-tags-returns-OK-response.frozen b/cassettes/features/v1/dashboards/Update-a-dashboard-with-tags-returns-OK-response.frozen new file mode 100644 index 000000000000..09bab8b8312b --- /dev/null +++ b/cassettes/features/v1/dashboards/Update-a-dashboard-with-tags-returns-OK-response.frozen @@ -0,0 +1 @@ +2023-03-10T23:23:35.716Z \ No newline at end of file diff --git a/cassettes/features/v1/dashboards/Update-a-dashboard-with-tags-returns-OK-response.yml b/cassettes/features/v1/dashboards/Update-a-dashboard-with-tags-returns-OK-response.yml new file mode 100644 index 000000000000..e2925f91c61d --- /dev/null +++ b/cassettes/features/v1/dashboards/Update-a-dashboard-with-tags-returns-OK-response.yml @@ -0,0 +1,74 @@ +http_interactions: +- recorded_at: Fri, 10 Mar 2023 23:23:35 GMT + request: + body: + encoding: UTF-8 + string: '{"layout_type":"ordered","title":"Test-Update_a_dashboard_with_tags_returns_OK_response-1678490615 + with Profile Metrics Query","widgets":[{"definition":{"requests":[{"profile_metrics_query":{"compute":{"aggregation":"sum","facet":"@prof_core_cpu_cores"},"group_by":[{"facet":"service","limit":10,"sort":{"aggregation":"sum","facet":"@prof_core_cpu_cores","order":"desc"}}],"search":{"query":"runtime:jvm"}}}],"type":"timeseries"}}]}' + 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":"ad2-8ch-y8s","title":"Test-Update_a_dashboard_with_tags_returns_OK_response-1678490615 + with Profile Metrics Query","description":null,"author_handle":"frog@datadoghq.com","author_name":null,"layout_type":"ordered","url":"/dashboard/ad2-8ch-y8s/test-updateadashboardwithtagsreturnsokresponse-1678490615-with-profile-metrics-q","is_read_only":false,"template_variables":null,"widgets":[{"definition":{"requests":[{"profile_metrics_query":{"compute":{"aggregation":"sum","facet":"@prof_core_cpu_cores"},"group_by":[{"facet":"service","limit":10,"sort":{"aggregation":"sum","facet":"@prof_core_cpu_cores","order":"desc"}}],"search":{"query":"runtime:jvm"}}}],"type":"timeseries"},"id":6897153580739865}],"notify_list":null,"created_at":"2023-03-10T23:23:35.908079+00:00","modified_at":"2023-03-10T23:23:35.908079+00:00","tags":[],"restricted_roles":[]} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Fri, 10 Mar 2023 23:23:35 GMT + request: + body: + encoding: UTF-8 + string: '{"description":"Updated description","layout_type":"ordered","tags":["team:foo","team:bar"],"title":"Test-Update_a_dashboard_with_tags_returns_OK_response-1678490615 + with list_stream widget","widgets":[{"definition":{"requests":[{"columns":[{"field":"timestamp","width":"auto"}],"query":{"data_source":"apm_issue_stream","query_string":""},"response_format":"event_list"}],"type":"list_stream"}}]}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PUT + uri: https://api.datadoghq.com/api/v1/dashboard/ad2-8ch-y8s + response: + body: + encoding: UTF-8 + string: '{"id":"ad2-8ch-y8s","title":"Test-Update_a_dashboard_with_tags_returns_OK_response-1678490615 + with list_stream widget","description":"Updated description","author_handle":"frog@datadoghq.com","author_name":null,"layout_type":"ordered","url":"/dashboard/ad2-8ch-y8s/test-updateadashboardwithtagsreturnsokresponse-1678490615-with-liststream-widget","is_read_only":false,"template_variables":null,"widgets":[{"definition":{"requests":[{"columns":[{"field":"timestamp","width":"auto"}],"query":{"data_source":"apm_issue_stream","query_string":""},"response_format":"event_list"}],"type":"list_stream"},"id":4545330920817753}],"notify_list":null,"created_at":"2023-03-10T23:23:35.908079+00:00","modified_at":"2023-03-10T23:23:36.124521+00:00","tags":["team:foo","team:bar"],"restricted_roles":[]} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Fri, 10 Mar 2023 23:23:35 GMT + request: + body: null + headers: + Accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v1/dashboard/ad2-8ch-y8s + response: + body: + encoding: UTF-8 + string: '{"deleted_dashboard_id":"ad2-8ch-y8s"} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/examples/v1/dashboards/CreateDashboard_2064651578.rb b/examples/v1/dashboards/CreateDashboard_2064651578.rb new file mode 100644 index 000000000000..898efcea63b6 --- /dev/null +++ b/examples/v1/dashboards/CreateDashboard_2064651578.rb @@ -0,0 +1,64 @@ +# Create a new dashboard with team tags returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V1::DashboardsAPI.new + +body = DatadogAPIClient::V1::Dashboard.new({ + title: "Example-Create_a_new_dashboard_with_team_tags_returns_OK_response", + widgets: [ + DatadogAPIClient::V1::Widget.new({ + definition: DatadogAPIClient::V1::ChangeWidgetDefinition.new({ + title: "", + title_size: "16", + title_align: DatadogAPIClient::V1::WidgetTextAlign::LEFT, + time: DatadogAPIClient::V1::WidgetTime.new({}), + type: DatadogAPIClient::V1::ChangeWidgetDefinitionType::CHANGE, + requests: [ + DatadogAPIClient::V1::ChangeWidgetRequest.new({ + formulas: [ + DatadogAPIClient::V1::WidgetFormula.new({ + formula: "hour_before(query1)", + }), + DatadogAPIClient::V1::WidgetFormula.new({ + formula: "query1", + }), + ], + queries: [ + DatadogAPIClient::V1::FormulaAndFunctionEventQueryDefinition.new({ + data_source: DatadogAPIClient::V1::FormulaAndFunctionEventsDataSource::LOGS, + name: "query1", + search: DatadogAPIClient::V1::FormulaAndFunctionEventQueryDefinitionSearch.new({ + query: "", + }), + indexes: [ + "*", + ], + compute: DatadogAPIClient::V1::FormulaAndFunctionEventQueryDefinitionCompute.new({ + aggregation: DatadogAPIClient::V1::FormulaAndFunctionEventAggregation::COUNT, + }), + group_by: [], + }), + ], + response_format: DatadogAPIClient::V1::FormulaAndFunctionResponseFormat::SCALAR, + compare_to: DatadogAPIClient::V1::WidgetCompareTo::HOUR_BEFORE, + increase_good: true, + order_by: DatadogAPIClient::V1::WidgetOrderBy::CHANGE, + change_type: DatadogAPIClient::V1::WidgetChangeType::ABSOLUTE, + order_dir: DatadogAPIClient::V1::WidgetSort::DESCENDING, + }), + ], + }), + layout: DatadogAPIClient::V1::WidgetLayout.new({ + x: 0, + y: 0, + width: 4, + height: 4, + }), + }), + ], + tags: [ + "team:foobar", + ], + layout_type: DatadogAPIClient::V1::DashboardLayoutType::ORDERED, +}) +p api_instance.create_dashboard(body) diff --git a/examples/v1/dashboards/UpdateDashboard_3454865944.rb b/examples/v1/dashboards/UpdateDashboard_3454865944.rb new file mode 100644 index 000000000000..bd8081d11ea3 --- /dev/null +++ b/examples/v1/dashboards/UpdateDashboard_3454865944.rb @@ -0,0 +1,40 @@ +# Update a dashboard with tags returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V1::DashboardsAPI.new + +# there is a valid "dashboard" in the system +DASHBOARD_ID = ENV["DASHBOARD_ID"] + +body = DatadogAPIClient::V1::Dashboard.new({ + layout_type: DatadogAPIClient::V1::DashboardLayoutType::ORDERED, + title: "Example-Update_a_dashboard_with_tags_returns_OK_response with list_stream widget", + description: "Updated description", + tags: [ + "team:foo", + "team:bar", + ], + widgets: [ + DatadogAPIClient::V1::Widget.new({ + definition: DatadogAPIClient::V1::ListStreamWidgetDefinition.new({ + type: DatadogAPIClient::V1::ListStreamWidgetDefinitionType::LIST_STREAM, + requests: [ + DatadogAPIClient::V1::ListStreamWidgetRequest.new({ + columns: [ + DatadogAPIClient::V1::ListStreamColumn.new({ + width: DatadogAPIClient::V1::ListStreamColumnWidth::AUTO, + field: "timestamp", + }), + ], + query: DatadogAPIClient::V1::ListStreamQuery.new({ + data_source: DatadogAPIClient::V1::ListStreamSource::APM_ISSUE_STREAM, + query_string: "", + }), + response_format: DatadogAPIClient::V1::ListStreamResponseFormat::EVENT_LIST, + }), + ], + }), + }), + ], +}) +p api_instance.update_dashboard(DASHBOARD_ID, body) diff --git a/features/v1/dashboards.feature b/features/v1/dashboards.feature index f27db4533f85..1c0e23ee79e0 100644 --- a/features/v1/dashboards.feature +++ b/features/v1/dashboards.feature @@ -57,7 +57,7 @@ Feature: Dashboards @generated @skip @team:DataDog/dashboards Scenario: Create a new dashboard returns "Bad Request" response Given new "CreateDashboard" request - And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]} + And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]} When the request is sent Then the response status is 400 Bad Request @@ -353,6 +353,13 @@ Feature: Dashboards And the response "widgets[0].definition.type" is equal to "image" And the response "widgets[0].definition.url" is equal to "https://example.com/image.png" + @team:DataDog/dashboards + Scenario: Create a new dashboard with invalid team tags returns "Bad Request" response + Given new "CreateDashboard" request + And body with value { "title": "{{ unique }}", "widgets": [ { "definition": { "title": "", "title_size": "16", "title_align": "left", "time": {}, "type": "change", "requests": [ { "formulas": [ { "formula": "hour_before(query1)" }, { "formula": "query1" } ], "queries": [ { "data_source": "logs", "name": "query1", "search": { "query": "" }, "indexes": [ "*" ], "compute": { "aggregation": "count" }, "group_by": [] } ], "response_format": "scalar", "compare_to": "hour_before", "increase_good": true, "order_by": "change", "change_type": "absolute", "order_dir": "desc" } ] }, "layout": { "x": 0, "y": 0, "width": 4, "height": 4 } } ], "tags": ["tm:foobar"], "layout_type": "ordered" } + When the request is sent + Then the response status is 400 Bad Request + @team:DataDog/dashboards Scenario: Create a new dashboard with list_stream widget Given new "CreateDashboard" request @@ -539,6 +546,15 @@ Feature: Dashboards And the response "widgets[0].definition.requests[0].queries[0].aggregator" is equal to "sum" And the response "widgets[0].definition.requests[0].formulas[0].formula" is equal to "query1" + @team:DataDog/dashboards + Scenario: Create a new dashboard with team tags returns "OK" response + Given new "CreateDashboard" request + And body with value { "title": "{{ unique }}", "widgets": [ { "definition": { "title": "", "title_size": "16", "title_align": "left", "time": {}, "type": "change", "requests": [ { "formulas": [ { "formula": "hour_before(query1)" }, { "formula": "query1" } ], "queries": [ { "data_source": "logs", "name": "query1", "search": { "query": "" }, "indexes": [ "*" ], "compute": { "aggregation": "count" }, "group_by": [] } ], "response_format": "scalar", "compare_to": "hour_before", "increase_good": true, "order_by": "change", "change_type": "absolute", "order_dir": "desc" } ] }, "layout": { "x": 0, "y": 0, "width": 4, "height": 4 } } ], "tags": ["team:foobar"], "layout_type": "ordered" } + When the request is sent + Then the response status is 200 OK + And the response "title" is equal to "{{ unique }}" + And the response "tags[0]" is equal to "team:foobar" + @team:DataDog/dashboards Scenario: Create a new dashboard with template variable defaults and default returns "Bad Request" response Given new "CreateDashboard" request @@ -759,7 +775,7 @@ Feature: Dashboards Scenario: Update a dashboard returns "Bad Request" response Given new "UpdateDashboard" request And request contains "dashboard_id" parameter from "REPLACE.ME" - And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]} + And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]} When the request is sent Then the response status is 400 Bad Request @@ -767,7 +783,7 @@ Feature: Dashboards Scenario: Update a dashboard returns "Item Not Found" response Given new "UpdateDashboard" request And request contains "dashboard_id" parameter from "REPLACE.ME" - And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]} + And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]} When the request is sent Then the response status is 404 Item Not Found @@ -780,3 +796,13 @@ Feature: Dashboards When the request is sent Then the response status is 200 OK And the response "description" is equal to "Updated description" + + @team:DataDog/dashboards + Scenario: Update a dashboard with tags returns "OK" response + Given there is a valid "dashboard" in the system + And new "UpdateDashboard" request + And request contains "dashboard_id" parameter from "dashboard.id" + And body with value {"layout_type": "ordered", "title": "{{ unique }} with list_stream widget","description":"Updated description", "tags": ["team:foo", "team:bar"], "widgets": [{"definition": {"type": "list_stream","requests": [{"columns":[{"width":"auto","field":"timestamp"}],"query":{"data_source":"apm_issue_stream","query_string":""},"response_format":"event_list"}]}}]} + When the request is sent + Then the response status is 200 OK + And the response "tags" is equal to ["team:foo", "team:bar"] diff --git a/lib/datadog_api_client/v1/models/dashboard.rb b/lib/datadog_api_client/v1/models/dashboard.rb index a00bdad35181..95187e7a3cbe 100644 --- a/lib/datadog_api_client/v1/models/dashboard.rb +++ b/lib/datadog_api_client/v1/models/dashboard.rb @@ -61,6 +61,9 @@ class Dashboard # A list of role identifiers. Only the author and users associated with at least one of these roles can edit this dashboard. attr_accessor :restricted_roles + # List of team names representing ownership of a dashboard. + attr_reader :tags + # Array of template variables saved views. attr_accessor :template_variable_presets @@ -91,6 +94,7 @@ def self.attribute_map :'notify_list' => :'notify_list', :'reflow_type' => :'reflow_type', :'restricted_roles' => :'restricted_roles', + :'tags' => :'tags', :'template_variable_presets' => :'template_variable_presets', :'template_variables' => :'template_variables', :'title' => :'title', @@ -114,6 +118,7 @@ def self.openapi_types :'notify_list' => :'Array', :'reflow_type' => :'DashboardReflowType', :'restricted_roles' => :'Array', + :'tags' => :'Array', :'template_variable_presets' => :'Array', :'template_variables' => :'Array', :'title' => :'String', @@ -129,6 +134,7 @@ def self.openapi_nullable :'author_name', :'description', :'notify_list', + :'tags', :'template_variable_presets', :'template_variables', ]) @@ -198,6 +204,12 @@ def initialize(attributes = {}) end end + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + if attributes.key?(:'template_variable_presets') if (value = attributes[:'template_variable_presets']).is_a?(Array) self.template_variable_presets = value @@ -230,6 +242,7 @@ def initialize(attributes = {}) # @!visibility private def valid? return false if @layout_type.nil? + return false if !@tags.nil? && @tags.length > 5 return false if @title.nil? return false if @widgets.nil? true @@ -245,6 +258,16 @@ def layout_type=(layout_type) @layout_type = layout_type end + # Custom attribute writer method with validation + # @param tags [Object] Object to be assigned + # @!visibility private + def tags=(tags) + if !tags.nil? && tags.length > 5 + fail ArgumentError, 'invalid value for "tags", number of items must be less than or equal to 5.' + end + @tags = tags + end + # Custom attribute writer method with validation # @param title [Object] Object to be assigned # @!visibility private @@ -282,6 +305,7 @@ def ==(o) notify_list == o.notify_list && reflow_type == o.reflow_type && restricted_roles == o.restricted_roles && + tags == o.tags && template_variable_presets == o.template_variable_presets && template_variables == o.template_variables && title == o.title && @@ -293,7 +317,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [author_handle, author_name, created_at, description, id, is_read_only, layout_type, modified_at, notify_list, reflow_type, restricted_roles, template_variable_presets, template_variables, title, url, widgets].hash + [author_handle, author_name, created_at, description, id, is_read_only, layout_type, modified_at, notify_list, reflow_type, restricted_roles, tags, template_variable_presets, template_variables, title, url, widgets].hash end end end