Skip to content

Commit

Permalink
Powerpack Live Span Support (#1738)
Browse files Browse the repository at this point in the history
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
  • Loading branch information
api-clients-generation-pipeline[bot] and ci.datadog-api-spec authored Oct 25, 2023
1 parent 34d2891 commit a726e0a
Show file tree
Hide file tree
Showing 28 changed files with 219 additions and 108 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2023-10-25 09:00:22.540949",
"spec_repo_commit": "9ebdefa4"
"regenerated": "2023-10-25 13:57:25.705674",
"spec_repo_commit": "fb2f4134"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2023-10-25 09:00:22.569393",
"spec_repo_commit": "9ebdefa4"
"regenerated": "2023-10-25 13:57:25.768693",
"spec_repo_commit": "fb2f4134"
}
}
}
38 changes: 38 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11170,6 +11170,8 @@ components:
$ref: '#/components/schemas/PowerpackGroupWidgetDefinition'
layout:
$ref: '#/components/schemas/PowerpackGroupWidgetLayout'
live_span:
$ref: '#/components/schemas/WidgetLiveSpan'
required:
- definition
type: object
Expand Down Expand Up @@ -18581,6 +18583,42 @@ components:
type: string
x-enum-varnames:
- USERS
WidgetLiveSpan:
description: The available timeframes depend on the widget you are using.
enum:
- 1m
- 5m
- 10m
- 15m
- 30m
- 1h
- 4h
- 1d
- 2d
- 1w
- 1mo
- 3mo
- 6mo
- 1y
- alert
example: 5m
type: string
x-enum-varnames:
- PAST_ONE_MINUTE
- PAST_FIVE_MINUTES
- PAST_TEN_MINUTES
- PAST_FIFTEEN_MINUTES
- PAST_THIRTY_MINUTES
- PAST_ONE_HOUR
- PAST_FOUR_HOURS
- PAST_ONE_DAY
- PAST_TWO_DAYS
- PAST_ONE_WEEK
- PAST_ONE_MONTH
- PAST_THREE_MONTHS
- PAST_SIX_MONTHS
- PAST_ONE_YEAR
- ALERT
securitySchemes:
AuthZ:
description: This API uses OAuth 2 with the implicit grant flow.
Expand Down
7 changes: 7 additions & 0 deletions docs/datadog_api_client.v2.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8373,6 +8373,13 @@ users\_type
:members:
:show-inheritance:

widget\_live\_span
------------------

.. automodule:: datadog_api_client.v2.model.widget_live_span
:members:
:show-inheritance:


.. automodule:: datadog_api_client.v2.model
:members:
Expand Down
2 changes: 2 additions & 0 deletions examples/v2/powerpack/CreatePowerpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from datadog_api_client.v2.model.powerpack_group_widget_layout import PowerpackGroupWidgetLayout
from datadog_api_client.v2.model.powerpack_inner_widgets import PowerpackInnerWidgets
from datadog_api_client.v2.model.powerpack_template_variable import PowerpackTemplateVariable
from datadog_api_client.v2.model.widget_live_span import WidgetLiveSpan

body = Powerpack(
data=PowerpackData(
Expand All @@ -35,6 +36,7 @@
x=0,
y=0,
),
live_span=WidgetLiveSpan.PAST_ONE_HOUR,
),
name="Example-Powerpack",
tags=[
Expand Down
2 changes: 2 additions & 0 deletions examples/v2/powerpack/UpdatePowerpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from datadog_api_client.v2.model.powerpack_group_widget_layout import PowerpackGroupWidgetLayout
from datadog_api_client.v2.model.powerpack_inner_widgets import PowerpackInnerWidgets
from datadog_api_client.v2.model.powerpack_template_variable import PowerpackTemplateVariable
from datadog_api_client.v2.model.widget_live_span import WidgetLiveSpan

# there is a valid "powerpack" in the system
POWERPACK_DATA_ID = environ["POWERPACK_DATA_ID"]
Expand All @@ -39,6 +40,7 @@
x=0,
y=0,
),
live_span=WidgetLiveSpan.PAST_ONE_HOUR,
),
name="Example-Powerpack",
tags=[
Expand Down
10 changes: 10 additions & 0 deletions src/datadog_api_client/v2/model/powerpack_group_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,33 @@
if TYPE_CHECKING:
from datadog_api_client.v2.model.powerpack_group_widget_definition import PowerpackGroupWidgetDefinition
from datadog_api_client.v2.model.powerpack_group_widget_layout import PowerpackGroupWidgetLayout
from datadog_api_client.v2.model.widget_live_span import WidgetLiveSpan


class PowerpackGroupWidget(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.powerpack_group_widget_definition import PowerpackGroupWidgetDefinition
from datadog_api_client.v2.model.powerpack_group_widget_layout import PowerpackGroupWidgetLayout
from datadog_api_client.v2.model.widget_live_span import WidgetLiveSpan

return {
"definition": (PowerpackGroupWidgetDefinition,),
"layout": (PowerpackGroupWidgetLayout,),
"live_span": (WidgetLiveSpan,),
}

attribute_map = {
"definition": "definition",
"layout": "layout",
"live_span": "live_span",
}

def __init__(
self_,
definition: PowerpackGroupWidgetDefinition,
layout: Union[PowerpackGroupWidgetLayout, UnsetType] = unset,
live_span: Union[WidgetLiveSpan, UnsetType] = unset,
**kwargs,
):
"""
Expand All @@ -48,9 +53,14 @@ def __init__(
:param layout: Powerpack group widget layout.
:type layout: PowerpackGroupWidgetLayout, optional
:param live_span: The available timeframes depend on the widget you are using.
:type live_span: WidgetLiveSpan, optional
"""
if layout is not unset:
kwargs["layout"] = layout
if live_span is not unset:
kwargs["live_span"] = live_span
super().__init__(kwargs)

self_.definition = definition
77 changes: 77 additions & 0 deletions src/datadog_api_client/v2/model/widget_live_span.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# 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 2019-Present Datadog, Inc.
from __future__ import annotations


from datadog_api_client.model_utils import (
ModelSimple,
cached_property,
)

from typing import ClassVar


class WidgetLiveSpan(ModelSimple):
"""
The available timeframes depend on the widget you are using.
:param value: Must be one of ["1m", "5m", "10m", "15m", "30m", "1h", "4h", "1d", "2d", "1w", "1mo", "3mo", "6mo", "1y", "alert"].
:type value: str
"""

allowed_values = {
"1m",
"5m",
"10m",
"15m",
"30m",
"1h",
"4h",
"1d",
"2d",
"1w",
"1mo",
"3mo",
"6mo",
"1y",
"alert",
}
PAST_ONE_MINUTE: ClassVar["WidgetLiveSpan"]
PAST_FIVE_MINUTES: ClassVar["WidgetLiveSpan"]
PAST_TEN_MINUTES: ClassVar["WidgetLiveSpan"]
PAST_FIFTEEN_MINUTES: ClassVar["WidgetLiveSpan"]
PAST_THIRTY_MINUTES: ClassVar["WidgetLiveSpan"]
PAST_ONE_HOUR: ClassVar["WidgetLiveSpan"]
PAST_FOUR_HOURS: ClassVar["WidgetLiveSpan"]
PAST_ONE_DAY: ClassVar["WidgetLiveSpan"]
PAST_TWO_DAYS: ClassVar["WidgetLiveSpan"]
PAST_ONE_WEEK: ClassVar["WidgetLiveSpan"]
PAST_ONE_MONTH: ClassVar["WidgetLiveSpan"]
PAST_THREE_MONTHS: ClassVar["WidgetLiveSpan"]
PAST_SIX_MONTHS: ClassVar["WidgetLiveSpan"]
PAST_ONE_YEAR: ClassVar["WidgetLiveSpan"]
ALERT: ClassVar["WidgetLiveSpan"]

@cached_property
def openapi_types(_):
return {
"value": (str,),
}


WidgetLiveSpan.PAST_ONE_MINUTE = WidgetLiveSpan("1m")
WidgetLiveSpan.PAST_FIVE_MINUTES = WidgetLiveSpan("5m")
WidgetLiveSpan.PAST_TEN_MINUTES = WidgetLiveSpan("10m")
WidgetLiveSpan.PAST_FIFTEEN_MINUTES = WidgetLiveSpan("15m")
WidgetLiveSpan.PAST_THIRTY_MINUTES = WidgetLiveSpan("30m")
WidgetLiveSpan.PAST_ONE_HOUR = WidgetLiveSpan("1h")
WidgetLiveSpan.PAST_FOUR_HOURS = WidgetLiveSpan("4h")
WidgetLiveSpan.PAST_ONE_DAY = WidgetLiveSpan("1d")
WidgetLiveSpan.PAST_TWO_DAYS = WidgetLiveSpan("2d")
WidgetLiveSpan.PAST_ONE_WEEK = WidgetLiveSpan("1w")
WidgetLiveSpan.PAST_ONE_MONTH = WidgetLiveSpan("1mo")
WidgetLiveSpan.PAST_THREE_MONTHS = WidgetLiveSpan("3mo")
WidgetLiveSpan.PAST_SIX_MONTHS = WidgetLiveSpan("6mo")
WidgetLiveSpan.PAST_ONE_YEAR = WidgetLiveSpan("1y")
WidgetLiveSpan.ALERT = WidgetLiveSpan("alert")
2 changes: 2 additions & 0 deletions src/datadog_api_client/v2/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1426,6 +1426,7 @@
from datadog_api_client.v2.model.user_update_request import UserUpdateRequest
from datadog_api_client.v2.model.users_response import UsersResponse
from datadog_api_client.v2.model.users_type import UsersType
from datadog_api_client.v2.model.widget_live_span import WidgetLiveSpan

__all__ = [
"APIErrorResponse",
Expand Down Expand Up @@ -2628,4 +2629,5 @@
"UserUpdateRequest",
"UsersResponse",
"UsersType",
"WidgetLiveSpan",
]
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023-10-11T18:44:47.026Z
2023-10-24T18:32:08.933Z
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
interactions:
- request:
body: '{"data":{"attributes":{"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}},"name":"Test-Create_a_new_dashboard_with_powerpack_widget-1697049887","tags":["tag:sample"],"template_variables":[{"defaults":["*"],"name":"sample"}]},"type":"powerpack"}}'
Powerpack","type":"group","widgets":[{"definition":{"content":"test","type":"note"}}]},"layout":{"height":3,"width":12,"x":0,"y":0},"live_span":"1h"},"name":"Test-Create_a_new_dashboard_with_powerpack_widget-1698172328","tags":["tag:sample"],"template_variables":[{"defaults":["*"],"name":"sample"}]},"type":"powerpack"}}'
headers:
accept:
- application/json
Expand All @@ -11,9 +11,10 @@ interactions:
uri: https://api.datadoghq.com/api/v2/powerpacks
response:
body:
string: '{"data":{"type":"powerpack","id":"40778356-6866-11ee-812e-da7ad0900002","attributes":{"name":"Test-Create_a_new_dashboard_with_powerpack_widget-1697049887","description":"Sample
string: '{"data":{"type":"powerpack","id":"a3e591c8-729b-11ee-bde6-da7ad0900002","attributes":{"name":"Test-Create_a_new_dashboard_with_powerpack_widget-1698172328","description":"Sample
powerpack","group_widget":{"definition":{"layout_type":"ordered","show_title":true,"title":"Sample
Powerpack","type":"group","widgets":[{"definition":{"content":"test","type":"note"},"id":6750168893668334}]},"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":1041433464205113}]},"layout":{"height":3,"width":12,"x":0,"y":0},"live_span":"1h"},"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:
Expand All @@ -23,8 +24,8 @@ interactions:
code: 200
message: OK
- request:
body: '{"description":"description","is_read_only":false,"layout_type":"ordered","title":"Test-Create_a_new_dashboard_with_powerpack_widget-1697049887
with powerpack widget","widgets":[{"definition":{"powerpack_id":"40778356-6866-11ee-812e-da7ad0900002","template_variables":{"controlled_by_powerpack":[{"name":"foo","prefix":"bar","values":["baz","qux","quuz"]}],"controlled_externally":[]},"type":"powerpack"},"layout":{"height":2,"is_column_break":false,"width":2,"x":1,"y":1}}]}'
body: '{"description":"description","is_read_only":false,"layout_type":"ordered","title":"Test-Create_a_new_dashboard_with_powerpack_widget-1698172328
with powerpack widget","widgets":[{"definition":{"powerpack_id":"a3e591c8-729b-11ee-bde6-da7ad0900002","template_variables":{"controlled_by_powerpack":[{"name":"foo","prefix":"bar","values":["baz","qux","quuz"]}],"controlled_externally":[]},"type":"powerpack"},"layout":{"height":2,"is_column_break":false,"width":2,"x":1,"y":1}}]}'
headers:
accept:
- application/json
Expand All @@ -34,8 +35,9 @@ interactions:
uri: https://api.datadoghq.com/api/v1/dashboard
response:
body:
string: '{"id":"wap-jgr-c99","title":"Test-Create_a_new_dashboard_with_powerpack_widget-1697049887
with powerpack widget","description":"description","author_handle":"frog@datadoghq.com","author_name":null,"layout_type":"ordered","url":"/dashboard/wap-jgr-c99/test-createanewdashboardwithpowerpackwidget-1697049887-with-powerpack-widget","is_read_only":false,"template_variables":null,"widgets":[{"definition":{"powerpack_id":"40778356-6866-11ee-812e-da7ad0900002","template_variables":{"controlled_by_powerpack":[{"name":"foo","prefix":"bar","values":["baz","qux","quuz"]}],"controlled_externally":[]},"type":"powerpack"},"layout":{"height":2,"is_column_break":false,"width":2,"x":1,"y":1},"id":2124665012947075}],"notify_list":null,"created_at":"2023-10-11T18:44:47.485150+00:00","modified_at":"2023-10-11T18:44:47.485150+00:00","restricted_roles":[]}
string: '{"id":"u4a-itq-xia","title":"Test-Create_a_new_dashboard_with_powerpack_widget-1698172328
with powerpack widget","description":"description","author_handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","author_name":"CI
Account","layout_type":"ordered","url":"/dashboard/u4a-itq-xia/test-createanewdashboardwithpowerpackwidget-1698172328-with-powerpack-widget","is_read_only":false,"template_variables":null,"widgets":[{"definition":{"powerpack_id":"a3e591c8-729b-11ee-bde6-da7ad0900002","template_variables":{"controlled_by_powerpack":[{"name":"foo","prefix":"bar","values":["baz","qux","quuz"]}],"controlled_externally":[]},"type":"powerpack"},"layout":{"height":2,"is_column_break":false,"width":2,"x":1,"y":1},"id":1423357855337541}],"notify_list":null,"created_at":"2023-10-24T18:32:09.719784+00:00","modified_at":"2023-10-24T18:32:09.719784+00:00","restricted_roles":[]}
'
headers:
Expand All @@ -50,10 +52,10 @@ interactions:
accept:
- application/json
method: DELETE
uri: https://api.datadoghq.com/api/v1/dashboard/wap-jgr-c99
uri: https://api.datadoghq.com/api/v1/dashboard/u4a-itq-xia
response:
body:
string: '{"deleted_dashboard_id":"wap-jgr-c99"}
string: '{"deleted_dashboard_id":"u4a-itq-xia"}
'
headers:
Expand All @@ -68,7 +70,7 @@ interactions:
accept:
- '*/*'
method: DELETE
uri: https://api.datadoghq.com/api/v2/powerpacks/40778356-6866-11ee-812e-da7ad0900002
uri: https://api.datadoghq.com/api/v2/powerpacks/a3e591c8-729b-11ee-bde6-da7ad0900002
response:
body:
string: ''
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023-10-11T15:48:55.126Z
2023-10-24T18:32:10.926Z
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
interactions:
- request:
body: '{"data":{"attributes":{"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}},"name":"Test-Create_a_new_powerpack_returns_OK_response-1697039335","tags":["tag:sample"],"template_variables":[{"defaults":["*"],"name":"sample"}]},"type":"powerpack"}}'
Powerpack","type":"group","widgets":[{"definition":{"content":"test","type":"note"}}]},"layout":{"height":3,"width":12,"x":0,"y":0},"live_span":"1h"},"name":"Test-Create_a_new_powerpack_returns_OK_response-1698172330","tags":["tag:sample"],"template_variables":[{"defaults":["*"],"name":"sample"}]},"type":"powerpack"}}'
headers:
accept:
- application/json
Expand All @@ -11,9 +11,10 @@ interactions:
uri: https://api.datadoghq.com/api/v2/powerpacks
response:
body:
string: '{"data":{"type":"powerpack","id":"aef5d85a-684d-11ee-ae79-da7ad0900002","attributes":{"name":"Test-Create_a_new_powerpack_returns_OK_response-1697039335","description":"Sample
string: '{"data":{"type":"powerpack","id":"a5892a4e-729b-11ee-8449-da7ad0900002","attributes":{"name":"Test-Create_a_new_powerpack_returns_OK_response-1698172330","description":"Sample
powerpack","group_widget":{"definition":{"layout_type":"ordered","show_title":true,"title":"Sample
Powerpack","type":"group","widgets":[{"definition":{"content":"test","type":"note"},"id":5789473441337322}]},"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":2803120731030485}]},"layout":{"height":3,"width":12,"x":0,"y":0},"live_span":"1h"},"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:
Expand All @@ -28,7 +29,7 @@ interactions:
accept:
- '*/*'
method: DELETE
uri: https://api.datadoghq.com/api/v2/powerpacks/aef5d85a-684d-11ee-ae79-da7ad0900002
uri: https://api.datadoghq.com/api/v2/powerpacks/a5892a4e-729b-11ee-8449-da7ad0900002
response:
body:
string: ''
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023-10-11T15:48:55.488Z
2023-10-24T18:32:12.418Z
Loading

0 comments on commit a726e0a

Please sign in to comment.