diff --git a/.apigentools-info b/.apigentools-info index d368e8674ce5..6d6c16cd3df2 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2023-10-05 18:57:59.339412", - "spec_repo_commit": "faa2c8d3" + "regenerated": "2023-10-05 20:05:32.830782", + "spec_repo_commit": "f7a95272" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2023-10-05 18:57:59.356074", - "spec_repo_commit": "faa2c8d3" + "regenerated": "2023-10-05 20:05:32.849531", + "spec_repo_commit": "f7a95272" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index ee82ba9f1016..0eca5ce93f5d 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -5482,24 +5482,6 @@ components: type: string x-enum-varnames: - GCP_SERVICE_ACCOUNT - GetAllPowerpacksResponse: - description: Response object which includes all powerpack configurations. - properties: - data: - description: List of powerpack definitions. - items: - $ref: '#/components/schemas/PowerpackData' - type: array - included: - description: Array of objects related to the users. - items: - $ref: '#/components/schemas/User' - type: array - links: - $ref: '#/components/schemas/PowerpackResponseLinks' - meta: - $ref: '#/components/schemas/PowerpacksResponseMeta' - type: object GetFindingResponse: description: The expected response schema when getting a finding. properties: @@ -7677,6 +7659,24 @@ components: - data - meta type: object + ListPowerpacksResponse: + description: Response object which includes all powerpack configurations. + properties: + data: + description: List of powerpack definitions. + items: + $ref: '#/components/schemas/PowerpackData' + type: array + included: + description: Array of objects related to the users. + items: + $ref: '#/components/schemas/User' + type: array + links: + $ref: '#/components/schemas/PowerpackResponseLinks' + meta: + $ref: '#/components/schemas/PowerpacksResponseMeta' + type: object ListTeamsInclude: description: Included related resources optionally requested. enum: @@ -10596,18 +10596,7 @@ components: example: Powerpack for ABC type: string group_widget: - additionalProperties: {} - description: Templated group of dashboard widgets for the powerpack. - example: - layout_type: ordered - tags: - - tag:foo1 - type: group - widgets: - - definition: - content: example - type: note - type: object + $ref: '#/components/schemas/PowerpackGroupWidget' name: description: Name of the powerpack. example: Sample Powerpack @@ -10649,6 +10638,141 @@ components: example: powerpack type: string type: object + PowerpackGroupWidget: + description: Powerpack group widget definition object. + properties: + definition: + $ref: '#/components/schemas/PowerpackGroupWidgetDefinition' + layout: + $ref: '#/components/schemas/PowerpackGroupWidgetLayout' + required: + - definition + type: object + PowerpackGroupWidgetDefinition: + description: Powerpack group widget object. + properties: + layout_type: + description: Layout type of widgets. + example: ordered + type: string + show_title: + description: Boolean indicating whether powerpack group title should be + visible or not. + example: true + type: boolean + title: + description: Name for the group widget. + example: Sample Powerpack + type: string + type: + description: Type of widget, must be group. + example: group + type: string + widgets: + description: Widgets inside the powerpack. + example: + - definition: + content: example + type: note + layout: + height: 5 + width: 10 + x: 0 + y: 0 + items: + $ref: '#/components/schemas/PowerpackInnerWidgets' + type: array + required: + - widgets + - layout_type + - type + type: object + PowerpackGroupWidgetLayout: + description: Powerpack group widget layout. + properties: + height: + description: The height of the widget. Should be a non-negative integer. + example: 0 + format: int64 + minimum: 0 + type: integer + width: + description: The width of the widget. Should be a non-negative integer. + example: 0 + format: int64 + minimum: 0 + type: integer + x: + description: The position of the widget on the x (horizontal) axis. Should + be a non-negative integer. + example: 0 + format: int64 + minimum: 0 + type: integer + y: + description: The position of the widget on the y (vertical) axis. Should + be a non-negative integer. + example: 0 + format: int64 + minimum: 0 + type: integer + required: + - x + - y + - width + - height + type: object + PowerpackInnerWidgetLayout: + description: Powerpack inner widget layout. + properties: + height: + description: The height of the widget. Should be a non-negative integer. + example: 0 + format: int64 + minimum: 0 + type: integer + width: + description: The width of the widget. Should be a non-negative integer. + example: 0 + format: int64 + minimum: 0 + type: integer + x: + description: The position of the widget on the x (horizontal) axis. Should + be a non-negative integer. + example: 0 + format: int64 + minimum: 0 + type: integer + y: + description: The position of the widget on the y (vertical) axis. Should + be a non-negative integer. + example: 0 + format: int64 + minimum: 0 + type: integer + required: + - x + - y + - width + - height + type: object + PowerpackInnerWidgets: + description: Powerpack group widget definition of individual widgets. + properties: + definition: + additionalProperties: {} + description: Information about widget. + example: + definition: + content: example + type: note + type: object + layout: + $ref: '#/components/schemas/PowerpackInnerWidgetLayout' + required: + - definition + type: object PowerpackRelationships: description: Powerpack relationship object. properties: @@ -23570,13 +23694,13 @@ paths: /api/v2/powerpacks: get: description: Get a list of all powerpacks. - operationId: GetAllPowerpacks + operationId: ListPowerpacks responses: '200': content: application/json: schema: - $ref: '#/components/schemas/GetAllPowerpacksResponse' + $ref: '#/components/schemas/ListPowerpacksResponse' description: OK '429': $ref: '#/components/responses/TooManyRequestsResponse' diff --git a/cassettes/features/v2/powerpack/Create-a-new-powerpack-returns-Bad-Request-response.frozen b/cassettes/features/v2/powerpack/Create-a-new-powerpack-returns-Bad-Request-response.frozen index 8de3b1c8fe48..572764c79fa8 100644 --- a/cassettes/features/v2/powerpack/Create-a-new-powerpack-returns-Bad-Request-response.frozen +++ b/cassettes/features/v2/powerpack/Create-a-new-powerpack-returns-Bad-Request-response.frozen @@ -1 +1 @@ -2023-09-19T20:34:17.937Z \ No newline at end of file +2023-10-05T15:56:23.491Z \ No newline at end of file diff --git a/cassettes/features/v2/powerpack/Create-a-new-powerpack-returns-Bad-Request-response.yml b/cassettes/features/v2/powerpack/Create-a-new-powerpack-returns-Bad-Request-response.yml index 2cead08db541..6af62cbfd61a 100644 --- a/cassettes/features/v2/powerpack/Create-a-new-powerpack-returns-Bad-Request-response.yml +++ b/cassettes/features/v2/powerpack/Create-a-new-powerpack-returns-Bad-Request-response.yml @@ -1,9 +1,9 @@ http_interactions: -- recorded_at: Tue, 19 Sep 2023 20:34:17 GMT +- recorded_at: Thu, 05 Oct 2023 15:56:23 GMT request: body: encoding: UTF-8 - string: '{"data":{"attributes":{"description":"Powerpack for ABC","group_widget":{"layout_type":"ordered","tags":["tag:foo1"],"type":"group","widgets":[{"definition":{"content":"example","type":"note"}}]},"name":"Sample + string: '{"data":{"attributes":{"description":"Powerpack for ABC","group_widget":{"definition":{"layout_type":"ordered","type":"group1","widgets":[]}},"name":"Sample Powerpack","tags":["tag:foo1"],"template_variables":[{"defaults":["*"],"name":"test"}]},"type":"powerpack"}}' headers: Accept: @@ -15,30 +15,9 @@ http_interactions: response: body: encoding: UTF-8 - string: '{"errors":["Invalid group widget for powerpack. Error: ''type'' is - a required property\n\nFailed validating ''required'' in schema:\n {''additionalProperties'': - False,\n ''properties'': {''background_color'': {''type'': ''string''},\n ''banner_img'': - {''type'': ''string''},\n ''layout_type'': {''enum'': [''ordered'']},\n ''reflow_type'': - {''enum'': [''auto'', ''fixed'']},\n ''show_title'': {''type'': - ''boolean''},\n ''title'': {''type'': ''string''},\n ''title_align'': - {''enum'': [''center'', ''left'', ''right'']},\n ''type'': - {''enum'': [''group'']},\n ''widgets'': {''items'': {''additionalProperties'': - False,\n ''properties'': {''definition'': - {''additionalProperties'': True,\n ''properties'': - {''type'': {''enum'': [''alert_graph'',\n ''alert_value'',\n ''change'',\n ''check_status'',\n ''distribution'',\n ''geomap'',\n ''heatmap'',\n ''hostmap'',\n ''note'',\n ''query_value'',\n ''scatterplot'',\n ''servicemap'',\n ''topology_map'',\n ''query_table'',\n ''timeseries'',\n ''toplist'',\n ''list_stream'',\n ''treemap'',\n ''uptime'',\n ''slo'',\n ''funnel'',\n ''custom'',\n ''experimental'',\n ''sunburst'',\n ''wildcard'',\n ''slo_list'',\n ''flame_graph'',\n ''run_workflow'',\n ''embedded_app'',\n ''log_stream'',\n ''iframe'',\n ''free_text'',\n ''event_stream'',\n ''event_timeline'',\n ''manage_status'',\n ''trace_service'',\n ''image'']}},\n ''required'': - [''type''],\n ''type'': - ''object''},\n ''id'': - {''type'': ''integer''},\n ''layout'': - {''additionalProperties'': False,\n ''properties'': - {''height'': {''type'': ''number''},\n ''is_column_break'': - {''type'': ''boolean''},\n ''width'': - {''type'': ''number''},\n ''x'': - {''type'': ''number''},\n ''y'': - {''type'': ''number''}},\n ''type'': - ''object''}},\n ''required'': [''definition''],\n ''type'': - ''object''},\n ''type'': ''array''}},\n ''required'': - [''type'', ''layout_type'', ''widgets''],\n ''type'': ''object''}\n\nOn - instance:\n {}."]}' + string: '{"errors":["Invalid group widget for powerpack. Error: ''group1'' is + not one of [''group'']\n\nFailed validating ''enum'' in schema[''properties''][''type'']:\n {''enum'': + [''group'']}\n\nOn instance[''type'']:\n ''group1''."]}' headers: Content-Type: - application/json diff --git a/cassettes/features/v2/powerpack/Create-a-new-powerpack-with-missing-group-widget-returns-Bad-Request-response.frozen b/cassettes/features/v2/powerpack/Create-a-new-powerpack-with-missing-group-widget-returns-Bad-Request-response.frozen index 6636089c7a2b..8693788b95e3 100644 --- a/cassettes/features/v2/powerpack/Create-a-new-powerpack-with-missing-group-widget-returns-Bad-Request-response.frozen +++ b/cassettes/features/v2/powerpack/Create-a-new-powerpack-with-missing-group-widget-returns-Bad-Request-response.frozen @@ -1 +1 @@ -2023-09-19T20:34:19.633Z \ No newline at end of file +2023-10-04T19:18:49.142Z \ No newline at end of file diff --git a/cassettes/features/v2/powerpack/Create-a-new-powerpack-with-missing-group-widget-returns-Bad-Request-response.yml b/cassettes/features/v2/powerpack/Create-a-new-powerpack-with-missing-group-widget-returns-Bad-Request-response.yml index 324c1403011e..fd6194dee568 100644 --- a/cassettes/features/v2/powerpack/Create-a-new-powerpack-with-missing-group-widget-returns-Bad-Request-response.yml +++ b/cassettes/features/v2/powerpack/Create-a-new-powerpack-with-missing-group-widget-returns-Bad-Request-response.yml @@ -1,9 +1,9 @@ http_interactions: -- recorded_at: Tue, 19 Sep 2023 20:34:19 GMT +- recorded_at: Wed, 04 Oct 2023 19:18:49 GMT request: body: encoding: UTF-8 - string: '{"data":{"attributes":{"description":"Sample powerpack","group_widget":{},"name":"Sample + string: '{"data":{"attributes":{"description":"Sample powerpack","name":"Sample Powerpack","tags":["tag:sample"],"template_variables":[{"defaults":["*"],"name":"sample"}]},"type":"powerpack"}}' headers: Accept: @@ -15,30 +15,8 @@ http_interactions: response: body: encoding: UTF-8 - string: '{"errors":["Invalid group widget for powerpack. Error: ''type'' is - a required property\n\nFailed validating ''required'' in schema:\n {''additionalProperties'': - False,\n ''properties'': {''background_color'': {''type'': ''string''},\n ''banner_img'': - {''type'': ''string''},\n ''layout_type'': {''enum'': [''ordered'']},\n ''reflow_type'': - {''enum'': [''auto'', ''fixed'']},\n ''show_title'': {''type'': - ''boolean''},\n ''title'': {''type'': ''string''},\n ''title_align'': - {''enum'': [''center'', ''left'', ''right'']},\n ''type'': - {''enum'': [''group'']},\n ''widgets'': {''items'': {''additionalProperties'': - False,\n ''properties'': {''definition'': - {''additionalProperties'': True,\n ''properties'': - {''type'': {''enum'': [''alert_graph'',\n ''alert_value'',\n ''change'',\n ''check_status'',\n ''distribution'',\n ''geomap'',\n ''heatmap'',\n ''hostmap'',\n ''note'',\n ''query_value'',\n ''scatterplot'',\n ''servicemap'',\n ''topology_map'',\n ''query_table'',\n ''timeseries'',\n ''toplist'',\n ''list_stream'',\n ''treemap'',\n ''uptime'',\n ''slo'',\n ''funnel'',\n ''custom'',\n ''experimental'',\n ''sunburst'',\n ''wildcard'',\n ''slo_list'',\n ''flame_graph'',\n ''run_workflow'',\n ''embedded_app'',\n ''log_stream'',\n ''iframe'',\n ''free_text'',\n ''event_stream'',\n ''event_timeline'',\n ''manage_status'',\n ''trace_service'',\n ''image'']}},\n ''required'': - [''type''],\n ''type'': - ''object''},\n ''id'': - {''type'': ''integer''},\n ''layout'': - {''additionalProperties'': False,\n ''properties'': - {''height'': {''type'': ''number''},\n ''is_column_break'': - {''type'': ''boolean''},\n ''width'': - {''type'': ''number''},\n ''x'': - {''type'': ''number''},\n ''y'': - {''type'': ''number''}},\n ''type'': - ''object''}},\n ''required'': [''definition''],\n ''type'': - ''object''},\n ''type'': ''array''}},\n ''required'': - [''type'', ''layout_type'', ''widgets''],\n ''type'': ''object''}\n\nOn - instance:\n {}."]}' + string: '{"errors":["API input validation failed: {''group_widget'': [''Missing + data for required field.'']}"]}' headers: Content-Type: - application/json diff --git a/cassettes/features/v2/powerpack/Update-a-powerpack-returns-Bad-Request-response.frozen b/cassettes/features/v2/powerpack/Update-a-powerpack-returns-Bad-Request-response.frozen index d30592128ac2..8d5b8f216516 100644 --- a/cassettes/features/v2/powerpack/Update-a-powerpack-returns-Bad-Request-response.frozen +++ b/cassettes/features/v2/powerpack/Update-a-powerpack-returns-Bad-Request-response.frozen @@ -1 +1 @@ -2023-09-19T20:34:23.150Z \ No newline at end of file +2023-10-05T15:56:24.178Z \ No newline at end of file diff --git a/cassettes/features/v2/powerpack/Update-a-powerpack-returns-Bad-Request-response.yml b/cassettes/features/v2/powerpack/Update-a-powerpack-returns-Bad-Request-response.yml index f511f2197d88..caa3d62e8687 100644 --- a/cassettes/features/v2/powerpack/Update-a-powerpack-returns-Bad-Request-response.yml +++ b/cassettes/features/v2/powerpack/Update-a-powerpack-returns-Bad-Request-response.yml @@ -1,5 +1,5 @@ http_interactions: -- recorded_at: Tue, 19 Sep 2023 20:34:23 GMT +- recorded_at: Thu, 05 Oct 2023 15:56:24 GMT request: body: encoding: UTF-8 @@ -16,9 +16,10 @@ http_interactions: response: body: encoding: UTF-8 - string: '{"data":{"type":"powerpack","id":"eb0c0428-572b-11ee-92ec-da7ad0900002","attributes":{"name":"Sample + string: '{"data":{"type":"powerpack","id":"bc22abe4-6397-11ee-865e-da7ad0900002","attributes":{"name":"Sample Powerpack","description":"Sample powerpack","group_widget":{"definition":{"layout_type":"ordered","show_title":true,"title":"Sample - Powerpack","type":"group","widgets":[{"definition":{"content":"test","type":"note"},"id":8888289347240039}]},"layout":{"height":3,"width":12,"x":0,"y":0}},"template_variables":[{"defaults":["*"],"name":"sample"}],"tags":["tag:sample"]},"relationships":{"author":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}}},"included":[{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"name":null,"email":"frog@datadoghq.com"}}]} + Powerpack","type":"group","widgets":[{"definition":{"content":"test","type":"note"},"id":1043184765896296}]},"layout":{"height":3,"width":12,"x":0,"y":0}},"template_variables":[{"defaults":["*"],"name":"sample"}],"tags":["tag:sample"]},"relationships":{"author":{"data":{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}},"included":[{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","attributes":{"name":"CI + Account","email":"team-intg-tools-libs-spam@datadoghq.com"}}]} ' headers: @@ -27,11 +28,11 @@ http_interactions: status: code: 200 message: OK -- recorded_at: Tue, 19 Sep 2023 20:34:23 GMT +- recorded_at: Thu, 05 Oct 2023 15:56:24 GMT request: body: encoding: UTF-8 - string: '{"data":{"attributes":{"description":"Sample powerpack","group_widget":{},"name":"Sample + string: '{"data":{"attributes":{"description":"Sample powerpack","group_widget":{"definition":{"layout_type":"ordered","type":"group1","widgets":[]}},"name":"Sample Powerpack","tags":["tag:sample"],"template_variables":[{"defaults":["*"],"name":"sample"}]},"type":"powerpack"}}' headers: Accept: @@ -39,48 +40,27 @@ http_interactions: Content-Type: - application/json method: PATCH - uri: https://api.datadoghq.com/api/v2/powerpacks/eb0c0428-572b-11ee-92ec-da7ad0900002 + uri: https://api.datadoghq.com/api/v2/powerpacks/bc22abe4-6397-11ee-865e-da7ad0900002 response: body: encoding: UTF-8 - string: '{"errors":["Invalid group widget for powerpack. Error: ''type'' is - a required property\n\nFailed validating ''required'' in schema:\n {''additionalProperties'': - False,\n ''properties'': {''background_color'': {''type'': ''string''},\n ''banner_img'': - {''type'': ''string''},\n ''layout_type'': {''enum'': [''ordered'']},\n ''reflow_type'': - {''enum'': [''auto'', ''fixed'']},\n ''show_title'': {''type'': - ''boolean''},\n ''title'': {''type'': ''string''},\n ''title_align'': - {''enum'': [''center'', ''left'', ''right'']},\n ''type'': - {''enum'': [''group'']},\n ''widgets'': {''items'': {''additionalProperties'': - False,\n ''properties'': {''definition'': - {''additionalProperties'': True,\n ''properties'': - {''type'': {''enum'': [''alert_graph'',\n ''alert_value'',\n ''change'',\n ''check_status'',\n ''distribution'',\n ''geomap'',\n ''heatmap'',\n ''hostmap'',\n ''note'',\n ''query_value'',\n ''scatterplot'',\n ''servicemap'',\n ''topology_map'',\n ''query_table'',\n ''timeseries'',\n ''toplist'',\n ''list_stream'',\n ''treemap'',\n ''uptime'',\n ''slo'',\n ''funnel'',\n ''custom'',\n ''experimental'',\n ''sunburst'',\n ''wildcard'',\n ''slo_list'',\n ''flame_graph'',\n ''run_workflow'',\n ''embedded_app'',\n ''log_stream'',\n ''iframe'',\n ''free_text'',\n ''event_stream'',\n ''event_timeline'',\n ''manage_status'',\n ''trace_service'',\n ''image'']}},\n ''required'': - [''type''],\n ''type'': - ''object''},\n ''id'': - {''type'': ''integer''},\n ''layout'': - {''additionalProperties'': False,\n ''properties'': - {''height'': {''type'': ''number''},\n ''is_column_break'': - {''type'': ''boolean''},\n ''width'': - {''type'': ''number''},\n ''x'': - {''type'': ''number''},\n ''y'': - {''type'': ''number''}},\n ''type'': - ''object''}},\n ''required'': [''definition''],\n ''type'': - ''object''},\n ''type'': ''array''}},\n ''required'': - [''type'', ''layout_type'', ''widgets''],\n ''type'': ''object''}\n\nOn - instance:\n {}."]}' + string: '{"errors":["Invalid group widget for powerpack. Error: ''group1'' is + not one of [''group'']\n\nFailed validating ''enum'' in schema[''properties''][''type'']:\n {''enum'': + [''group'']}\n\nOn instance[''type'']:\n ''group1''."]}' headers: Content-Type: - application/json status: code: 400 message: Bad Request -- recorded_at: Tue, 19 Sep 2023 20:34:23 GMT +- recorded_at: Thu, 05 Oct 2023 15:56:24 GMT request: body: null headers: Accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/powerpacks/eb0c0428-572b-11ee-92ec-da7ad0900002 + uri: https://api.datadoghq.com/api/v2/powerpacks/bc22abe4-6397-11ee-865e-da7ad0900002 response: body: encoding: UTF-8 diff --git a/examples/v2/powerpack/CreatePowerpack.rb b/examples/v2/powerpack/CreatePowerpack.rb index 190d3d25eba1..0b5e1374dd1f 100644 --- a/examples/v2/powerpack/CreatePowerpack.rb +++ b/examples/v2/powerpack/CreatePowerpack.rb @@ -7,9 +7,27 @@ data: DatadogAPIClient::V2::PowerpackData.new({ attributes: DatadogAPIClient::V2::PowerpackAttributes.new({ description: "Sample powerpack", - group_widget: { - "definition": "{'layout_type': 'ordered', 'show_title': True, 'title': 'Sample Powerpack', 'type': 'group', 'widgets': [{'definition': {'content': 'test', 'type': 'note'}}]}", "layout": "{'height': 3, 'width': 12, 'x': 0, 'y': 0}", - }, + group_widget: DatadogAPIClient::V2::PowerpackGroupWidget.new({ + definition: DatadogAPIClient::V2::PowerpackGroupWidgetDefinition.new({ + layout_type: "ordered", + show_title: true, + title: "Sample Powerpack", + type: "group", + widgets: [ + DatadogAPIClient::V2::PowerpackInnerWidgets.new({ + definition: { + "content": "test", "type": "note", + }, + }), + ], + }), + layout: DatadogAPIClient::V2::PowerpackGroupWidgetLayout.new({ + height: 3, + width: 12, + x: 0, + y: 0, + }), + }), name: "Sample Powerpack", tags: [ "tag:sample", diff --git a/examples/v2/powerpack/GetAllPowerpacks.rb b/examples/v2/powerpack/ListPowerpacks.rb similarity index 77% rename from examples/v2/powerpack/GetAllPowerpacks.rb rename to examples/v2/powerpack/ListPowerpacks.rb index 2a12e425e2f4..2df75f726017 100644 --- a/examples/v2/powerpack/GetAllPowerpacks.rb +++ b/examples/v2/powerpack/ListPowerpacks.rb @@ -2,4 +2,4 @@ require "datadog_api_client" api_instance = DatadogAPIClient::V2::PowerpackAPI.new -p api_instance.get_all_powerpacks() +p api_instance.list_powerpacks() diff --git a/examples/v2/powerpack/UpdatePowerpack.rb b/examples/v2/powerpack/UpdatePowerpack.rb index ea32e2bce625..6d65779db84f 100644 --- a/examples/v2/powerpack/UpdatePowerpack.rb +++ b/examples/v2/powerpack/UpdatePowerpack.rb @@ -10,9 +10,27 @@ data: DatadogAPIClient::V2::PowerpackData.new({ attributes: DatadogAPIClient::V2::PowerpackAttributes.new({ description: "Sample powerpack", - group_widget: { - "definition": "{'layout_type': 'ordered', 'show_title': True, 'title': 'Sample Powerpack', 'type': 'group', 'widgets': [{'definition': {'content': 'test', 'type': 'note'}}]}", "layout": "{'height': 3, 'width': 12, 'x': 0, 'y': 0}", - }, + group_widget: DatadogAPIClient::V2::PowerpackGroupWidget.new({ + definition: DatadogAPIClient::V2::PowerpackGroupWidgetDefinition.new({ + layout_type: "ordered", + show_title: true, + title: "Sample Powerpack", + type: "group", + widgets: [ + DatadogAPIClient::V2::PowerpackInnerWidgets.new({ + definition: { + "content": "test", "type": "note", + }, + }), + ], + }), + layout: DatadogAPIClient::V2::PowerpackGroupWidgetLayout.new({ + height: 3, + width: 12, + x: 0, + y: 0, + }), + }), name: "Sample Powerpack", tags: [ "tag:sample", diff --git a/features/v2/powerpack.feature b/features/v2/powerpack.feature index c3a474969ce2..e14ebfb65202 100644 --- a/features/v2/powerpack.feature +++ b/features/v2/powerpack.feature @@ -13,7 +13,7 @@ Feature: Powerpack @team:DataDog/dashboards-backend Scenario: Create a new powerpack returns "Bad Request" response Given new "CreatePowerpack" request - And body with value {"data": {"attributes": {"description": "Powerpack for ABC", "group_widget": {"layout_type": "ordered", "tags": ["tag:foo1"], "type": "group", "widgets": [{"definition": {"content": "example", "type": "note"}}]}, "name": "Sample Powerpack", "tags": ["tag:foo1"], "template_variables": [{"defaults": ["*"], "name": "test"}]}, "type": "powerpack"}} + And body with value {"data": {"attributes": {"description": "Powerpack for ABC", "group_widget": {"definition": {"type": "group1", "layout_type": "ordered", "widgets": []}}, "name": "Sample Powerpack", "tags": ["tag:foo1"], "template_variables": [{"defaults": ["*"], "name": "test"}]}, "type": "powerpack"}} When the request is sent Then the response status is 400 Bad Request @@ -38,13 +38,6 @@ Feature: Powerpack And the response "data.attributes.group_widget.definition.title" is equal to "Sample Powerpack" And the response "data.attributes.group_widget.definition.widgets[0].definition.type" is equal to "note" - @team:DataDog/dashboards-backend - Scenario: Create a new powerpack with missing group_widget returns "Bad Request" response - Given new "CreatePowerpack" request - And body with value {"data":{"type": "powerpack","attributes": {"name": "Sample Powerpack","description": "Sample powerpack","group_widget": {},"template_variables": [{"name": "sample", "defaults": ["*"]}],"tags": ["tag:sample"]}}} - When the request is sent - Then the response status is 400 Bad Request - @team:DataDog/dashboards-backend Scenario: Delete a powerpack returns "OK" response Given there is a valid "powerpack" in the system @@ -93,7 +86,7 @@ Feature: Powerpack @team:DataDog/dashboards-backend Scenario: Get all powerpacks returns "OK" response Given there is a valid "powerpack" in the system - And new "GetAllPowerpacks" request + And new "ListPowerpacks" request When the request is sent Then the response status is 200 OK And the response "data" has item with field "type" with value "powerpack" @@ -117,7 +110,7 @@ Feature: Powerpack Given there is a valid "powerpack" in the system And new "UpdatePowerpack" request And request contains "powerpack_id" parameter from "powerpack.data.id" - And body with value {"data":{"type": "powerpack","attributes": {"name": "Sample Powerpack","description": "Sample powerpack","group_widget": {},"template_variables": [{"name": "sample", "defaults": ["*"]}],"tags": ["tag:sample"]}}} + And body with value {"data":{"type": "powerpack","attributes": {"name": "Sample Powerpack","description": "Sample powerpack","group_widget": {"definition": {"type": "group1", "layout_type": "ordered", "widgets": []}},"template_variables": [{"name": "sample", "defaults": ["*"]}],"tags": ["tag:sample"]}}} When the request is sent Then the response status is 400 Bad Request diff --git a/features/v2/undo.json b/features/v2/undo.json index 0eacdd54f48b..a127541e6504 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -1023,7 +1023,7 @@ "type": "safe" } }, - "GetAllPowerpacks": { + "ListPowerpacks": { "tag": "Powerpack", "undo": { "type": "safe" diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index fa000290d95b..dbf511a1aea8 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1125,7 +1125,6 @@ def overrides "v2.gcpsts_service_accounts_response" => "GCPSTSServiceAccountsResponse", "v2.gcpsts_service_account_update_request" => "GCPSTSServiceAccountUpdateRequest", "v2.gcpsts_service_account_update_request_data" => "GCPSTSServiceAccountUpdateRequestData", - "v2.get_all_powerpacks_response" => "GetAllPowerpacksResponse", "v2.get_finding_response" => "GetFindingResponse", "v2.get_team_memberships_sort" => "GetTeamMembershipsSort", "v2.group_scalar_column" => "GroupScalarColumn", @@ -1271,6 +1270,7 @@ def overrides "v2.list_findings_meta" => "ListFindingsMeta", "v2.list_findings_page" => "ListFindingsPage", "v2.list_findings_response" => "ListFindingsResponse", + "v2.list_powerpacks_response" => "ListPowerpacksResponse", "v2.list_teams_include" => "ListTeamsInclude", "v2.list_teams_sort" => "ListTeamsSort", "v2.log" => "Log", @@ -1471,6 +1471,11 @@ def overrides "v2.powerpack" => "Powerpack", "v2.powerpack_attributes" => "PowerpackAttributes", "v2.powerpack_data" => "PowerpackData", + "v2.powerpack_group_widget" => "PowerpackGroupWidget", + "v2.powerpack_group_widget_definition" => "PowerpackGroupWidgetDefinition", + "v2.powerpack_group_widget_layout" => "PowerpackGroupWidgetLayout", + "v2.powerpack_inner_widget_layout" => "PowerpackInnerWidgetLayout", + "v2.powerpack_inner_widgets" => "PowerpackInnerWidgets", "v2.powerpack_relationships" => "PowerpackRelationships", "v2.powerpack_response" => "PowerpackResponse", "v2.powerpack_response_links" => "PowerpackResponseLinks", diff --git a/lib/datadog_api_client/v2/api/powerpack_api.rb b/lib/datadog_api_client/v2/api/powerpack_api.rb index 5d9769faabab..d885bc3f7065 100644 --- a/lib/datadog_api_client/v2/api/powerpack_api.rb +++ b/lib/datadog_api_client/v2/api/powerpack_api.rb @@ -155,27 +155,32 @@ def delete_powerpack_with_http_info(powerpack_id, opts = {}) return data, status_code, headers end - # Get all powerpacks. + # Get a Powerpack. # - # @see #get_all_powerpacks_with_http_info - def get_all_powerpacks(opts = {}) - data, _status_code, _headers = get_all_powerpacks_with_http_info(opts) + # @see #get_powerpack_with_http_info + def get_powerpack(powerpack_id, opts = {}) + data, _status_code, _headers = get_powerpack_with_http_info(powerpack_id, opts) data end - # Get all powerpacks. + # Get a Powerpack. # - # Get a list of all powerpacks. + # Get a powerpack. # + # @param powerpack_id [String] ID of the powerpack. # @param opts [Hash] the optional parameters - # @return [Array<(GetAllPowerpacksResponse, Integer, Hash)>] GetAllPowerpacksResponse data, response status code and response headers - def get_all_powerpacks_with_http_info(opts = {}) + # @return [Array<(PowerpackResponse, Integer, Hash)>] PowerpackResponse data, response status code and response headers + def get_powerpack_with_http_info(powerpack_id, opts = {}) if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: PowerpackAPI.get_all_powerpacks ...' + @api_client.config.logger.debug 'Calling API: PowerpackAPI.get_powerpack ...' + end + # verify the required parameter 'powerpack_id' is set + if @api_client.config.client_side_validation && powerpack_id.nil? + fail ArgumentError, "Missing the required parameter 'powerpack_id' when calling PowerpackAPI.get_powerpack" end # resource path - local_var_path = '/api/v2/powerpacks' + local_var_path = '/api/v2/powerpacks/{powerpack_id}'.sub('{powerpack_id}', CGI.escape(powerpack_id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} @@ -192,13 +197,13 @@ def get_all_powerpacks_with_http_info(opts = {}) post_body = opts[:debug_body] # return_type - return_type = opts[:debug_return_type] || 'GetAllPowerpacksResponse' + return_type = opts[:debug_return_type] || 'PowerpackResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] new_options = opts.merge( - :operation => :get_all_powerpacks, + :operation => :get_powerpack, :header_params => header_params, :query_params => query_params, :form_params => form_params, @@ -210,37 +215,32 @@ def get_all_powerpacks_with_http_info(opts = {}) 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: PowerpackAPI#get_all_powerpacks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: PowerpackAPI#get_powerpack\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end - # Get a Powerpack. + # Get all powerpacks. # - # @see #get_powerpack_with_http_info - def get_powerpack(powerpack_id, opts = {}) - data, _status_code, _headers = get_powerpack_with_http_info(powerpack_id, opts) + # @see #list_powerpacks_with_http_info + def list_powerpacks(opts = {}) + data, _status_code, _headers = list_powerpacks_with_http_info(opts) data end - # Get a Powerpack. + # Get all powerpacks. # - # Get a powerpack. + # Get a list of all powerpacks. # - # @param powerpack_id [String] ID of the powerpack. # @param opts [Hash] the optional parameters - # @return [Array<(PowerpackResponse, Integer, Hash)>] PowerpackResponse data, response status code and response headers - def get_powerpack_with_http_info(powerpack_id, opts = {}) + # @return [Array<(ListPowerpacksResponse, Integer, Hash)>] ListPowerpacksResponse data, response status code and response headers + def list_powerpacks_with_http_info(opts = {}) if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: PowerpackAPI.get_powerpack ...' - end - # verify the required parameter 'powerpack_id' is set - if @api_client.config.client_side_validation && powerpack_id.nil? - fail ArgumentError, "Missing the required parameter 'powerpack_id' when calling PowerpackAPI.get_powerpack" + @api_client.config.logger.debug 'Calling API: PowerpackAPI.list_powerpacks ...' end # resource path - local_var_path = '/api/v2/powerpacks/{powerpack_id}'.sub('{powerpack_id}', CGI.escape(powerpack_id.to_s).gsub('%2F', '/')) + local_var_path = '/api/v2/powerpacks' # query parameters query_params = opts[:query_params] || {} @@ -257,13 +257,13 @@ def get_powerpack_with_http_info(powerpack_id, opts = {}) post_body = opts[:debug_body] # return_type - return_type = opts[:debug_return_type] || 'PowerpackResponse' + return_type = opts[:debug_return_type] || 'ListPowerpacksResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] new_options = opts.merge( - :operation => :get_powerpack, + :operation => :list_powerpacks, :header_params => header_params, :query_params => query_params, :form_params => form_params, @@ -275,7 +275,7 @@ def get_powerpack_with_http_info(powerpack_id, opts = {}) 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: PowerpackAPI#get_powerpack\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: PowerpackAPI#list_powerpacks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end diff --git a/lib/datadog_api_client/v2/models/get_all_powerpacks_response.rb b/lib/datadog_api_client/v2/models/list_powerpacks_response.rb similarity index 91% rename from lib/datadog_api_client/v2/models/get_all_powerpacks_response.rb rename to lib/datadog_api_client/v2/models/list_powerpacks_response.rb index def1fc5fe1ff..0fc32fd07cad 100644 --- a/lib/datadog_api_client/v2/models/get_all_powerpacks_response.rb +++ b/lib/datadog_api_client/v2/models/list_powerpacks_response.rb @@ -18,7 +18,7 @@ module DatadogAPIClient::V2 # Response object which includes all powerpack configurations. - class GetAllPowerpacksResponse + class ListPowerpacksResponse include BaseGenericModel # List of powerpack definitions. @@ -60,13 +60,13 @@ def self.openapi_types # @!visibility private def initialize(attributes = {}) if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::GetAllPowerpacksResponse` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ListPowerpacksResponse` initialize method" end # 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)) - fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::GetAllPowerpacksResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::ListPowerpacksResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/lib/datadog_api_client/v2/models/powerpack_attributes.rb b/lib/datadog_api_client/v2/models/powerpack_attributes.rb index 8019ba0347e9..41e5f4410c90 100644 --- a/lib/datadog_api_client/v2/models/powerpack_attributes.rb +++ b/lib/datadog_api_client/v2/models/powerpack_attributes.rb @@ -24,7 +24,7 @@ class PowerpackAttributes # Description of this powerpack. attr_accessor :description - # Templated group of dashboard widgets for the powerpack. + # Powerpack group widget definition object. attr_reader :group_widget # Name of the powerpack. @@ -53,7 +53,7 @@ def self.attribute_map def self.openapi_types { :'description' => :'String', - :'group_widget' => :'Hash', + :'group_widget' => :'PowerpackGroupWidget', :'name' => :'String', :'tags' => :'Array', :'template_variables' => :'Array' diff --git a/lib/datadog_api_client/v2/models/powerpack_group_widget.rb b/lib/datadog_api_client/v2/models/powerpack_group_widget.rb new file mode 100644 index 000000000000..b2ceb8f5d515 --- /dev/null +++ b/lib/datadog_api_client/v2/models/powerpack_group_widget.rb @@ -0,0 +1,108 @@ +=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 + # Powerpack group widget definition object. + class PowerpackGroupWidget + include BaseGenericModel + + # Powerpack group widget object. + attr_reader :definition + + # Powerpack group widget layout. + attr_accessor :layout + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'definition' => :'definition', + :'layout' => :'layout' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'definition' => :'PowerpackGroupWidgetDefinition', + :'layout' => :'PowerpackGroupWidgetLayout' + } + 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::PowerpackGroupWidget` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::PowerpackGroupWidget`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'definition') + self.definition = attributes[:'definition'] + end + + if attributes.key?(:'layout') + self.layout = attributes[:'layout'] + 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 @definition.nil? + true + end + + # Custom attribute writer method with validation + # @param definition [Object] Object to be assigned + # @!visibility private + def definition=(definition) + if definition.nil? + fail ArgumentError, 'invalid value for "definition", definition cannot be nil.' + end + @definition = definition + 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 && + definition == o.definition && + layout == o.layout + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [definition, layout].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/powerpack_group_widget_definition.rb b/lib/datadog_api_client/v2/models/powerpack_group_widget_definition.rb new file mode 100644 index 000000000000..a05f37864e77 --- /dev/null +++ b/lib/datadog_api_client/v2/models/powerpack_group_widget_definition.rb @@ -0,0 +1,162 @@ +=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 + # Powerpack group widget object. + class PowerpackGroupWidgetDefinition + include BaseGenericModel + + # Layout type of widgets. + attr_reader :layout_type + + # Boolean indicating whether powerpack group title should be visible or not. + attr_accessor :show_title + + # Name for the group widget. + attr_accessor :title + + # Type of widget, must be group. + attr_reader :type + + # Widgets inside the powerpack. + attr_reader :widgets + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'layout_type' => :'layout_type', + :'show_title' => :'show_title', + :'title' => :'title', + :'type' => :'type', + :'widgets' => :'widgets' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'layout_type' => :'String', + :'show_title' => :'Boolean', + :'title' => :'String', + :'type' => :'String', + :'widgets' => :'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::PowerpackGroupWidgetDefinition` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::PowerpackGroupWidgetDefinition`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'layout_type') + self.layout_type = attributes[:'layout_type'] + end + + if attributes.key?(:'show_title') + self.show_title = attributes[:'show_title'] + end + + if attributes.key?(:'title') + self.title = attributes[:'title'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'widgets') + if (value = attributes[:'widgets']).is_a?(Array) + self.widgets = 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 @layout_type.nil? + return false if @type.nil? + return false if @widgets.nil? + true + end + + # Custom attribute writer method with validation + # @param layout_type [Object] Object to be assigned + # @!visibility private + def layout_type=(layout_type) + if layout_type.nil? + fail ArgumentError, 'invalid value for "layout_type", layout_type cannot be nil.' + end + @layout_type = layout_type + 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 widgets [Object] Object to be assigned + # @!visibility private + def widgets=(widgets) + if widgets.nil? + fail ArgumentError, 'invalid value for "widgets", widgets cannot be nil.' + end + @widgets = widgets + 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 && + layout_type == o.layout_type && + show_title == o.show_title && + title == o.title && + type == o.type && + widgets == o.widgets + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [layout_type, show_title, title, type, widgets].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/powerpack_group_widget_layout.rb b/lib/datadog_api_client/v2/models/powerpack_group_widget_layout.rb new file mode 100644 index 000000000000..bcbc053739d3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/powerpack_group_widget_layout.rb @@ -0,0 +1,177 @@ +=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 + # Powerpack group widget layout. + class PowerpackGroupWidgetLayout + include BaseGenericModel + + # The height of the widget. Should be a non-negative integer. + attr_reader :height + + # The width of the widget. Should be a non-negative integer. + attr_reader :width + + # The position of the widget on the x (horizontal) axis. Should be a non-negative integer. + attr_reader :x + + # The position of the widget on the y (vertical) axis. Should be a non-negative integer. + attr_reader :y + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'height' => :'height', + :'width' => :'width', + :'x' => :'x', + :'y' => :'y' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'height' => :'Integer', + :'width' => :'Integer', + :'x' => :'Integer', + :'y' => :'Integer' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::PowerpackGroupWidgetLayout` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::PowerpackGroupWidgetLayout`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'height') + self.height = attributes[:'height'] + end + + if attributes.key?(:'width') + self.width = attributes[:'width'] + end + + if attributes.key?(:'x') + self.x = attributes[:'x'] + end + + if attributes.key?(:'y') + self.y = attributes[:'y'] + 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 @height.nil? + return false if @height < 0 + return false if @width.nil? + return false if @width < 0 + return false if @x.nil? + return false if @x < 0 + return false if @y.nil? + return false if @y < 0 + true + end + + # Custom attribute writer method with validation + # @param height [Object] Object to be assigned + # @!visibility private + def height=(height) + if height.nil? + fail ArgumentError, 'invalid value for "height", height cannot be nil.' + end + if height < 0 + fail ArgumentError, 'invalid value for "height", must be greater than or equal to 0.' + end + @height = height + end + + # Custom attribute writer method with validation + # @param width [Object] Object to be assigned + # @!visibility private + def width=(width) + if width.nil? + fail ArgumentError, 'invalid value for "width", width cannot be nil.' + end + if width < 0 + fail ArgumentError, 'invalid value for "width", must be greater than or equal to 0.' + end + @width = width + end + + # Custom attribute writer method with validation + # @param x [Object] Object to be assigned + # @!visibility private + def x=(x) + if x.nil? + fail ArgumentError, 'invalid value for "x", x cannot be nil.' + end + if x < 0 + fail ArgumentError, 'invalid value for "x", must be greater than or equal to 0.' + end + @x = x + end + + # Custom attribute writer method with validation + # @param y [Object] Object to be assigned + # @!visibility private + def y=(y) + if y.nil? + fail ArgumentError, 'invalid value for "y", y cannot be nil.' + end + if y < 0 + fail ArgumentError, 'invalid value for "y", must be greater than or equal to 0.' + end + @y = y + 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 && + height == o.height && + width == o.width && + x == o.x && + y == o.y + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [height, width, x, y].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/powerpack_inner_widget_layout.rb b/lib/datadog_api_client/v2/models/powerpack_inner_widget_layout.rb new file mode 100644 index 000000000000..b9fa8ec7c014 --- /dev/null +++ b/lib/datadog_api_client/v2/models/powerpack_inner_widget_layout.rb @@ -0,0 +1,177 @@ +=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 + # Powerpack inner widget layout. + class PowerpackInnerWidgetLayout + include BaseGenericModel + + # The height of the widget. Should be a non-negative integer. + attr_reader :height + + # The width of the widget. Should be a non-negative integer. + attr_reader :width + + # The position of the widget on the x (horizontal) axis. Should be a non-negative integer. + attr_reader :x + + # The position of the widget on the y (vertical) axis. Should be a non-negative integer. + attr_reader :y + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'height' => :'height', + :'width' => :'width', + :'x' => :'x', + :'y' => :'y' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'height' => :'Integer', + :'width' => :'Integer', + :'x' => :'Integer', + :'y' => :'Integer' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::PowerpackInnerWidgetLayout` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::PowerpackInnerWidgetLayout`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'height') + self.height = attributes[:'height'] + end + + if attributes.key?(:'width') + self.width = attributes[:'width'] + end + + if attributes.key?(:'x') + self.x = attributes[:'x'] + end + + if attributes.key?(:'y') + self.y = attributes[:'y'] + 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 @height.nil? + return false if @height < 0 + return false if @width.nil? + return false if @width < 0 + return false if @x.nil? + return false if @x < 0 + return false if @y.nil? + return false if @y < 0 + true + end + + # Custom attribute writer method with validation + # @param height [Object] Object to be assigned + # @!visibility private + def height=(height) + if height.nil? + fail ArgumentError, 'invalid value for "height", height cannot be nil.' + end + if height < 0 + fail ArgumentError, 'invalid value for "height", must be greater than or equal to 0.' + end + @height = height + end + + # Custom attribute writer method with validation + # @param width [Object] Object to be assigned + # @!visibility private + def width=(width) + if width.nil? + fail ArgumentError, 'invalid value for "width", width cannot be nil.' + end + if width < 0 + fail ArgumentError, 'invalid value for "width", must be greater than or equal to 0.' + end + @width = width + end + + # Custom attribute writer method with validation + # @param x [Object] Object to be assigned + # @!visibility private + def x=(x) + if x.nil? + fail ArgumentError, 'invalid value for "x", x cannot be nil.' + end + if x < 0 + fail ArgumentError, 'invalid value for "x", must be greater than or equal to 0.' + end + @x = x + end + + # Custom attribute writer method with validation + # @param y [Object] Object to be assigned + # @!visibility private + def y=(y) + if y.nil? + fail ArgumentError, 'invalid value for "y", y cannot be nil.' + end + if y < 0 + fail ArgumentError, 'invalid value for "y", must be greater than or equal to 0.' + end + @y = y + 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 && + height == o.height && + width == o.width && + x == o.x && + y == o.y + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [height, width, x, y].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/powerpack_inner_widgets.rb b/lib/datadog_api_client/v2/models/powerpack_inner_widgets.rb new file mode 100644 index 000000000000..5201757dd135 --- /dev/null +++ b/lib/datadog_api_client/v2/models/powerpack_inner_widgets.rb @@ -0,0 +1,108 @@ +=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 + # Powerpack group widget definition of individual widgets. + class PowerpackInnerWidgets + include BaseGenericModel + + # Information about widget. + attr_reader :definition + + # Powerpack inner widget layout. + attr_accessor :layout + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'definition' => :'definition', + :'layout' => :'layout' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'definition' => :'Hash', + :'layout' => :'PowerpackInnerWidgetLayout' + } + 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::PowerpackInnerWidgets` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::PowerpackInnerWidgets`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'definition') + self.definition = attributes[:'definition'] + end + + if attributes.key?(:'layout') + self.layout = attributes[:'layout'] + 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 @definition.nil? + true + end + + # Custom attribute writer method with validation + # @param definition [Object] Object to be assigned + # @!visibility private + def definition=(definition) + if definition.nil? + fail ArgumentError, 'invalid value for "definition", definition cannot be nil.' + end + @definition = definition + 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 && + definition == o.definition && + layout == o.layout + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [definition, layout].hash + end + end +end