From deb756873b1ea42ba001b60300175581da22e3a1 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 27 Mar 2026 18:17:54 +0000 Subject: [PATCH] Regenerate client from commit 8d71763 of spec repo --- .generator/schemas/v2/openapi.yaml | 594 ++++++++++++++++++ docs/datadog_api_client.v2.api.rst | 7 + docs/datadog_api_client.v2.model.rst | 112 ++++ examples/v2/widgets/CreateWidget.py | 32 + examples/v2/widgets/DeleteWidget.py | 16 + examples/v2/widgets/GetWidget.py | 18 + examples/v2/widgets/SearchWidgets.py | 16 + examples/v2/widgets/UpdateWidget.py | 35 ++ src/datadog_api_client/v2/api/widgets_api.py | 377 +++++++++++ src/datadog_api_client/v2/apis/__init__.py | 2 + .../model/create_or_update_widget_request.py | 40 ++ ...ate_or_update_widget_request_attributes.py | 50 ++ .../create_or_update_widget_request_data.py | 50 ++ .../v2/model/widget_attributes.py | 73 +++ .../v2/model/widget_data.py | 70 +++ .../v2/model/widget_definition.py | 54 ++ .../v2/model/widget_experience_type.py | 44 ++ .../v2/model/widget_included_user.py | 57 ++ .../model/widget_included_user_attributes.py | 46 ++ .../v2/model/widget_list_response.py | 66 ++ .../v2/model/widget_relationship_data.py | 39 ++ .../v2/model/widget_relationship_item.py | 42 ++ .../v2/model/widget_relationships.py | 54 ++ .../v2/model/widget_response.py | 51 ++ .../v2/model/widget_search_meta.py | 64 ++ .../v2/model/widget_type.py | 78 +++ src/datadog_api_client/v2/models/__init__.py | 32 + tests/v1/features/authentication.feature | 4 +- tests/v1/features/key_management.feature | 46 +- tests/v2/features/key_management.feature | 70 +-- tests/v2/features/service_accounts.feature | 30 +- tests/v2/features/undo.json | 41 ++ tests/v2/features/widgets.feature | 115 ++++ 33 files changed, 2350 insertions(+), 75 deletions(-) create mode 100644 examples/v2/widgets/CreateWidget.py create mode 100644 examples/v2/widgets/DeleteWidget.py create mode 100644 examples/v2/widgets/GetWidget.py create mode 100644 examples/v2/widgets/SearchWidgets.py create mode 100644 examples/v2/widgets/UpdateWidget.py create mode 100644 src/datadog_api_client/v2/api/widgets_api.py create mode 100644 src/datadog_api_client/v2/model/create_or_update_widget_request.py create mode 100644 src/datadog_api_client/v2/model/create_or_update_widget_request_attributes.py create mode 100644 src/datadog_api_client/v2/model/create_or_update_widget_request_data.py create mode 100644 src/datadog_api_client/v2/model/widget_attributes.py create mode 100644 src/datadog_api_client/v2/model/widget_data.py create mode 100644 src/datadog_api_client/v2/model/widget_definition.py create mode 100644 src/datadog_api_client/v2/model/widget_experience_type.py create mode 100644 src/datadog_api_client/v2/model/widget_included_user.py create mode 100644 src/datadog_api_client/v2/model/widget_included_user_attributes.py create mode 100644 src/datadog_api_client/v2/model/widget_list_response.py create mode 100644 src/datadog_api_client/v2/model/widget_relationship_data.py create mode 100644 src/datadog_api_client/v2/model/widget_relationship_item.py create mode 100644 src/datadog_api_client/v2/model/widget_relationships.py create mode 100644 src/datadog_api_client/v2/model/widget_response.py create mode 100644 src/datadog_api_client/v2/model/widget_search_meta.py create mode 100644 src/datadog_api_client/v2/model/widget_type.py create mode 100644 tests/v2/features/widgets.feature diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index f45d9a1cc9..d02bb7aa5a 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -15324,6 +15324,41 @@ components: id: $ref: "#/components/schemas/ApiID" type: object + CreateOrUpdateWidgetRequest: + description: Request body for creating or updating a widget. + properties: + data: + $ref: "#/components/schemas/CreateOrUpdateWidgetRequestData" + required: + - data + type: object + CreateOrUpdateWidgetRequestAttributes: + description: Attributes for creating or updating a widget. + properties: + definition: + $ref: "#/components/schemas/WidgetDefinition" + tags: + description: User-defined tags for organizing the widget. + items: + type: string + nullable: true + type: array + required: + - definition + type: object + CreateOrUpdateWidgetRequestData: + description: Data for creating or updating a widget. + properties: + attributes: + $ref: "#/components/schemas/CreateOrUpdateWidgetRequestAttributes" + type: + description: Widgets resource type. + example: widgets + type: string + required: + - type + - attributes + type: object CreatePageRequest: description: Full request to trigger an On-Call Page. example: @@ -71675,6 +71710,136 @@ components: - FRIDAY - SATURDAY - SUNDAY + WidgetAttributes: + description: Attributes of a widget resource. + properties: + created_at: + description: ISO 8601 timestamp of when the widget was created. + example: "2024-01-15T00:00:00.000Z" + type: string + definition: + $ref: "#/components/schemas/WidgetDefinition" + is_favorited: + description: "Will be implemented soon. Currently always returns false." + example: false + type: boolean + modified_at: + description: ISO 8601 timestamp of when the widget was last modified. + example: "2024-01-15T00:00:00.000Z" + type: string + tags: + description: User-defined tags for organizing widgets. + example: + - "team:my-team" + items: + type: string + nullable: true + type: array + required: + - definition + - tags + - is_favorited + - created_at + - modified_at + type: object + WidgetData: + description: A widget resource object. + properties: + attributes: + $ref: "#/components/schemas/WidgetAttributes" + id: + description: The unique identifier of the widget. + example: "a1b2c3d4-e5f6-7890-abcd-ef1234567890" + type: string + relationships: + $ref: "#/components/schemas/WidgetRelationships" + type: + description: Widgets resource type. + example: widgets + type: string + required: + - id + - type + - attributes + type: object + WidgetDefinition: + additionalProperties: {} + description: The definition of a widget, including its type and configuration. + properties: + title: + description: The display title of the widget. + example: My Widget + maxLength: 100 + minLength: 1 + type: string + type: + $ref: "#/components/schemas/WidgetType" + required: + - type + - title + type: object + WidgetExperienceType: + description: Widget experience types that differentiate between the products using the specific widget. + enum: + - ccm_reports + - logs_reports + - csv_reports + - product_analytics + example: ccm_reports + type: string + x-enum-varnames: + - CCM_REPORTS + - LOGS_REPORTS + - CSV_REPORTS + - PRODUCT_ANALYTICS + WidgetIncludedUser: + description: A user resource included in the response. + properties: + attributes: + $ref: "#/components/schemas/WidgetIncludedUserAttributes" + id: + description: The unique identifier of the user. + example: "a1b2c3d4-e5f6-7890-abcd-ef1234567890" + type: string + type: + description: Users resource type. + example: users + type: string + required: + - id + - type + type: object + WidgetIncludedUserAttributes: + description: Attributes of an included user resource. + properties: + handle: + description: The email handle of the user. + example: "john.doe@example.com" + type: string + name: + description: The display name of the user. + example: "John Doe" + nullable: true + type: string + type: object + WidgetListResponse: + description: Response containing a list of widgets. + properties: + data: + description: List of widget resources. + items: + $ref: "#/components/schemas/WidgetData" + type: array + included: + description: Array of user resources related to the widgets. + items: + $ref: "#/components/schemas/WidgetIncludedUser" + type: array + meta: + $ref: "#/components/schemas/WidgetSearchMeta" + required: + - data + type: object WidgetLiveSpan: description: The available timeframes depend on the widget you are using. enum: @@ -71711,6 +71876,108 @@ components: - PAST_SIX_MONTHS - PAST_ONE_YEAR - ALERT + WidgetRelationshipData: + description: Relationship data referencing a user resource. + properties: + id: + description: The unique identifier of the user. + example: "a1b2c3d4-e5f6-7890-abcd-ef1234567890" + type: string + type: + description: Users resource type. + example: users + type: string + required: + - id + - type + type: object + WidgetRelationshipItem: + description: A JSON:API relationship to a user. + properties: + data: + $ref: "#/components/schemas/WidgetRelationshipData" + type: object + WidgetRelationships: + description: Relationships of the widget resource. + properties: + created_by: + $ref: "#/components/schemas/WidgetRelationshipItem" + description: The user who created the widget. + modified_by: + $ref: "#/components/schemas/WidgetRelationshipItem" + description: The user who last modified the widget. + type: object + WidgetResponse: + description: Response containing a single widget. + properties: + data: + $ref: "#/components/schemas/WidgetData" + included: + description: Array of user resources related to the widget. + items: + $ref: "#/components/schemas/WidgetIncludedUser" + type: array + required: + - data + type: object + WidgetSearchMeta: + description: Metadata about the search results. + properties: + created_by_anyone_total: + description: Total number of widgets created by anyone. + format: int64 + type: integer + created_by_you_total: + description: Total number of widgets created by the current user. + format: int64 + type: integer + favorited_by_you_total: + description: Total number of widgets favorited by the current user. + format: int64 + type: integer + filtered_total: + description: Total number of widgets matching the current filter criteria. + format: int64 + type: integer + type: object + WidgetType: + description: |- + Widget types that are allowed to be stored as individual records. + This is not a complete list of dashboard and notebook widget types. + enum: + - bar_chart + - change + - cloud_cost_summary + - cohort + - funnel + - geomap + - list_stream + - query_table + - query_value + - retention_curve + - sankey + - sunburst + - timeseries + - toplist + - treemap + example: bar_chart + type: string + x-enum-varnames: + - BAR_CHART + - CHANGE + - CLOUD_COST_SUMMARY + - COHORT + - FUNNEL + - GEOMAP + - LIST_STREAM + - QUERY_TABLE + - QUERY_VALUE + - RETENTION_CURVE + - SANKEY + - SUNBURST + - TIMESERIES + - TOPLIST + - TREEMAP WorkflowData: description: Data related to the workflow. properties: @@ -109866,6 +110133,328 @@ paths: operator: OR permissions: - teams_read + /api/v2/widgets/{experience_type}: + get: + description: Search and list widgets for a given experience type. Supports filtering by widget type, creator, title, and tags, as well as sorting and pagination. + operationId: SearchWidgets + parameters: + - description: The experience type for the widget. + in: path + name: experience_type + required: true + schema: + $ref: "#/components/schemas/WidgetExperienceType" + - description: Filter widgets by widget type. + in: query + name: filter[widgetType] + schema: + $ref: "#/components/schemas/WidgetType" + - description: Filter widgets by the email handle of the creator. + in: query + name: filter[creatorHandle] + schema: + example: "john.doe@example.com" + type: string + - description: Filter to only widgets favorited by the current user. + in: query + name: filter[isFavorited] + schema: + type: boolean + - description: Filter widgets by title (substring match). + in: query + name: filter[title] + schema: + type: string + - description: Filter widgets by tags. Format as bracket-delimited CSV, e.g. `[tag1,tag2]`. + in: query + name: filter[tags] + schema: + type: string + - description: |- + Sort field for the results. Prefix with `-` for descending order. + Allowed values: `title`, `created_at`, `modified_at`. + in: query + name: sort + schema: + default: "-modified_at" + example: "-modified_at" + type: string + - description: Page number for pagination (0-indexed). + in: query + name: page[number] + schema: + default: 0 + minimum: 0 + type: integer + - description: Number of widgets per page. + in: query + name: page[size] + schema: + default: 50 + maximum: 100 + type: integer + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/WidgetListResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Search widgets + tags: + - Widgets + x-permission: + operator: OR + permissions: + - cloud_cost_management_read + - generate_log_reports + - manage_log_reports + - product_analytics_saved_widgets_read + post: + description: Create a new widget for a given experience type. + operationId: CreateWidget + parameters: + - description: The experience type for the widget. + in: path + name: experience_type + required: true + schema: + $ref: "#/components/schemas/WidgetExperienceType" + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/CreateOrUpdateWidgetRequest" + description: Widget request body. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/WidgetResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Create a widget + tags: + - Widgets + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - cloud_cost_management_write + - generate_log_reports + - manage_log_reports + - product_analytics_saved_widgets_write + /api/v2/widgets/{experience_type}/{uuid}: + delete: + description: Soft-delete a widget by its UUID for a given experience type. + operationId: DeleteWidget + parameters: + - description: The experience type for the widget. + in: path + name: experience_type + required: true + schema: + $ref: "#/components/schemas/WidgetExperienceType" + - description: The UUID of the widget. + in: path + name: uuid + required: true + schema: + format: uuid + type: string + responses: + "204": + description: No Content + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Delete a widget + tags: + - Widgets + x-permission: + operator: OR + permissions: + - cloud_cost_management_write + - generate_log_reports + - manage_log_reports + - product_analytics_saved_widgets_write + get: + description: Retrieve a widget by its UUID for a given experience type. + operationId: GetWidget + parameters: + - description: The experience type for the widget. + in: path + name: experience_type + required: true + schema: + $ref: "#/components/schemas/WidgetExperienceType" + - description: The UUID of the widget. + in: path + name: uuid + required: true + schema: + format: uuid + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/WidgetResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Get a widget + tags: + - Widgets + x-permission: + operator: OR + permissions: + - cloud_cost_management_read + - generate_log_reports + - manage_log_reports + - product_analytics_saved_widgets_read + put: + description: Update a widget by its UUID for a given experience type. This performs a full replacement of the widget definition. + operationId: UpdateWidget + parameters: + - description: The experience type for the widget. + in: path + name: experience_type + required: true + schema: + $ref: "#/components/schemas/WidgetExperienceType" + - description: The UUID of the widget. + in: path + name: uuid + required: true + schema: + format: uuid + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/CreateOrUpdateWidgetRequest" + description: Widget request body. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/WidgetResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Update a widget + tags: + - Widgets + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - cloud_cost_management_write + - generate_log_reports + - manage_log_reports + - product_analytics_saved_widgets_write /api/v2/workflows: post: description: Create a new workflow, returning the workflow ID. This API requires a [registered application key](https://docs.datadoghq.com/api/latest/action-connection/#register-a-new-app-key). Alternatively, you can configure these permissions [in the UI](https://docs.datadoghq.com/account_management/api-app-keys/#actions-api-access). @@ -110716,6 +111305,11 @@ tags: externalDocs: url: https://docs.datadoghq.com/account_management/users name: Users + - description: |- + Create, read, update, and delete saved widgets. Widgets are reusable + visualization components stored independently from any dashboard or notebook, + partitioned by experience type and identified by a UUID. + name: Widgets - description: |- Datadog Workflow Automation allows you to automate your end-to-end processes by connecting Datadog with the rest of your tech stack. Build workflows to auto-remediate your alerts, streamline your incident and security processes, and reduce manual toil. Workflow Automation supports over 1,000+ OOTB actions, including AWS, JIRA, ServiceNow, GitHub, and OpenAI. Learn more in our Workflow Automation docs [here](https://docs.datadoghq.com/service_management/workflows/). externalDocs: diff --git a/docs/datadog_api_client.v2.api.rst b/docs/datadog_api_client.v2.api.rst index 35a19fc43c..c3be7e8838 100644 --- a/docs/datadog_api_client.v2.api.rst +++ b/docs/datadog_api_client.v2.api.rst @@ -725,6 +725,13 @@ datadog\_api\_client.v2.api.users\_api module :members: :show-inheritance: +datadog\_api\_client.v2.api.widgets\_api module +----------------------------------------------- + +.. automodule:: datadog_api_client.v2.api.widgets_api + :members: + :show-inheritance: + datadog\_api\_client.v2.api.workflow\_automation\_api module ------------------------------------------------------------ diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 868e840142..826de99698 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -6444,6 +6444,27 @@ datadog\_api\_client.v2.model.create\_open\_api\_response\_data module :members: :show-inheritance: +datadog\_api\_client.v2.model.create\_or\_update\_widget\_request module +------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.create_or_update_widget_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.create\_or\_update\_widget\_request\_attributes module +------------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.create_or_update_widget_request_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.create\_or\_update\_widget\_request\_data module +------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.create_or_update_widget_request_data + :members: + :show-inheritance: + datadog\_api\_client.v2.model.create\_page\_request module ---------------------------------------------------------- @@ -32617,6 +32638,55 @@ datadog\_api\_client.v2.model.weekday module :members: :show-inheritance: +datadog\_api\_client.v2.model.widget\_attributes module +------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.widget_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.widget\_data module +------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.widget_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.widget\_definition module +------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.widget_definition + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.widget\_experience\_type module +------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.widget_experience_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.widget\_included\_user module +----------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.widget_included_user + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.widget\_included\_user\_attributes module +----------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.widget_included_user_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.widget\_list\_response module +----------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.widget_list_response + :members: + :show-inheritance: + datadog\_api\_client.v2.model.widget\_live\_span module ------------------------------------------------------- @@ -32624,6 +32694,48 @@ datadog\_api\_client.v2.model.widget\_live\_span module :members: :show-inheritance: +datadog\_api\_client.v2.model.widget\_relationship\_data module +--------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.widget_relationship_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.widget\_relationship\_item module +--------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.widget_relationship_item + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.widget\_relationships module +---------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.widget_relationships + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.widget\_response module +----------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.widget_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.widget\_search\_meta module +--------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.widget_search_meta + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.widget\_type module +------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.widget_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.workflow\_data module --------------------------------------------------- diff --git a/examples/v2/widgets/CreateWidget.py b/examples/v2/widgets/CreateWidget.py new file mode 100644 index 0000000000..a240c0ca20 --- /dev/null +++ b/examples/v2/widgets/CreateWidget.py @@ -0,0 +1,32 @@ +""" +Create a widget returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.widgets_api import WidgetsApi +from datadog_api_client.v2.model.create_or_update_widget_request import CreateOrUpdateWidgetRequest +from datadog_api_client.v2.model.create_or_update_widget_request_attributes import CreateOrUpdateWidgetRequestAttributes +from datadog_api_client.v2.model.create_or_update_widget_request_data import CreateOrUpdateWidgetRequestData +from datadog_api_client.v2.model.widget_definition import WidgetDefinition +from datadog_api_client.v2.model.widget_experience_type import WidgetExperienceType +from datadog_api_client.v2.model.widget_type import WidgetType + +body = CreateOrUpdateWidgetRequest( + data=CreateOrUpdateWidgetRequestData( + attributes=CreateOrUpdateWidgetRequestAttributes( + definition=WidgetDefinition( + title="My Widget", + type=WidgetType.BAR_CHART, + ), + tags=[], + ), + type="widgets", + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = WidgetsApi(api_client) + response = api_instance.create_widget(experience_type=WidgetExperienceType.CCM_REPORTS, body=body) + + print(response) diff --git a/examples/v2/widgets/DeleteWidget.py b/examples/v2/widgets/DeleteWidget.py new file mode 100644 index 0000000000..b24fb38df6 --- /dev/null +++ b/examples/v2/widgets/DeleteWidget.py @@ -0,0 +1,16 @@ +""" +Delete a widget returns "No Content" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.widgets_api import WidgetsApi +from datadog_api_client.v2.model.widget_experience_type import WidgetExperienceType +from uuid import UUID + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = WidgetsApi(api_client) + api_instance.delete_widget( + experience_type=WidgetExperienceType.CCM_REPORTS, + uuid=UUID("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"), + ) diff --git a/examples/v2/widgets/GetWidget.py b/examples/v2/widgets/GetWidget.py new file mode 100644 index 0000000000..eefcaadf52 --- /dev/null +++ b/examples/v2/widgets/GetWidget.py @@ -0,0 +1,18 @@ +""" +Get a widget returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.widgets_api import WidgetsApi +from datadog_api_client.v2.model.widget_experience_type import WidgetExperienceType +from uuid import UUID + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = WidgetsApi(api_client) + response = api_instance.get_widget( + experience_type=WidgetExperienceType.CCM_REPORTS, + uuid=UUID("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"), + ) + + print(response) diff --git a/examples/v2/widgets/SearchWidgets.py b/examples/v2/widgets/SearchWidgets.py new file mode 100644 index 0000000000..f71b82a3b5 --- /dev/null +++ b/examples/v2/widgets/SearchWidgets.py @@ -0,0 +1,16 @@ +""" +Search widgets returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.widgets_api import WidgetsApi +from datadog_api_client.v2.model.widget_experience_type import WidgetExperienceType + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = WidgetsApi(api_client) + response = api_instance.search_widgets( + experience_type=WidgetExperienceType.CCM_REPORTS, + ) + + print(response) diff --git a/examples/v2/widgets/UpdateWidget.py b/examples/v2/widgets/UpdateWidget.py new file mode 100644 index 0000000000..26fc139ad2 --- /dev/null +++ b/examples/v2/widgets/UpdateWidget.py @@ -0,0 +1,35 @@ +""" +Update a widget returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.widgets_api import WidgetsApi +from datadog_api_client.v2.model.create_or_update_widget_request import CreateOrUpdateWidgetRequest +from datadog_api_client.v2.model.create_or_update_widget_request_attributes import CreateOrUpdateWidgetRequestAttributes +from datadog_api_client.v2.model.create_or_update_widget_request_data import CreateOrUpdateWidgetRequestData +from datadog_api_client.v2.model.widget_definition import WidgetDefinition +from datadog_api_client.v2.model.widget_experience_type import WidgetExperienceType +from datadog_api_client.v2.model.widget_type import WidgetType +from uuid import UUID + +body = CreateOrUpdateWidgetRequest( + data=CreateOrUpdateWidgetRequestData( + attributes=CreateOrUpdateWidgetRequestAttributes( + definition=WidgetDefinition( + title="My Widget", + type=WidgetType.BAR_CHART, + ), + tags=[], + ), + type="widgets", + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = WidgetsApi(api_client) + response = api_instance.update_widget( + experience_type=WidgetExperienceType.CCM_REPORTS, uuid=UUID("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"), body=body + ) + + print(response) diff --git a/src/datadog_api_client/v2/api/widgets_api.py b/src/datadog_api_client/v2/api/widgets_api.py new file mode 100644 index 0000000000..05e80ee428 --- /dev/null +++ b/src/datadog_api_client/v2/api/widgets_api.py @@ -0,0 +1,377 @@ +# 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 typing import Any, Dict, Union + +from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint +from datadog_api_client.configuration import Configuration +from datadog_api_client.model_utils import ( + UnsetType, + unset, + UUID, +) +from datadog_api_client.v2.model.widget_list_response import WidgetListResponse +from datadog_api_client.v2.model.widget_experience_type import WidgetExperienceType +from datadog_api_client.v2.model.widget_type import WidgetType +from datadog_api_client.v2.model.widget_response import WidgetResponse +from datadog_api_client.v2.model.create_or_update_widget_request import CreateOrUpdateWidgetRequest + + +class WidgetsApi: + """ + Create, read, update, and delete saved widgets. Widgets are reusable + visualization components stored independently from any dashboard or notebook, + partitioned by experience type and identified by a UUID. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient(Configuration()) + self.api_client = api_client + + self._create_widget_endpoint = _Endpoint( + settings={ + "response_type": (WidgetResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/widgets/{experience_type}", + "operation_id": "create_widget", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "experience_type": { + "required": True, + "openapi_types": (WidgetExperienceType,), + "attribute": "experience_type", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (CreateOrUpdateWidgetRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + self._delete_widget_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/widgets/{experience_type}/{uuid}", + "operation_id": "delete_widget", + "http_method": "DELETE", + "version": "v2", + }, + params_map={ + "experience_type": { + "required": True, + "openapi_types": (WidgetExperienceType,), + "attribute": "experience_type", + "location": "path", + }, + "uuid": { + "required": True, + "openapi_types": (UUID,), + "attribute": "uuid", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + + self._get_widget_endpoint = _Endpoint( + settings={ + "response_type": (WidgetResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/widgets/{experience_type}/{uuid}", + "operation_id": "get_widget", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "experience_type": { + "required": True, + "openapi_types": (WidgetExperienceType,), + "attribute": "experience_type", + "location": "path", + }, + "uuid": { + "required": True, + "openapi_types": (UUID,), + "attribute": "uuid", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._search_widgets_endpoint = _Endpoint( + settings={ + "response_type": (WidgetListResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/widgets/{experience_type}", + "operation_id": "search_widgets", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "experience_type": { + "required": True, + "openapi_types": (WidgetExperienceType,), + "attribute": "experience_type", + "location": "path", + }, + "filter_widget_type": { + "openapi_types": (WidgetType,), + "attribute": "filter[widgetType]", + "location": "query", + }, + "filter_creator_handle": { + "openapi_types": (str,), + "attribute": "filter[creatorHandle]", + "location": "query", + }, + "filter_is_favorited": { + "openapi_types": (bool,), + "attribute": "filter[isFavorited]", + "location": "query", + }, + "filter_title": { + "openapi_types": (str,), + "attribute": "filter[title]", + "location": "query", + }, + "filter_tags": { + "openapi_types": (str,), + "attribute": "filter[tags]", + "location": "query", + }, + "sort": { + "openapi_types": (str,), + "attribute": "sort", + "location": "query", + }, + "page_number": { + "validation": { + "inclusive_minimum": 0, + }, + "openapi_types": (int,), + "attribute": "page[number]", + "location": "query", + }, + "page_size": { + "validation": { + "inclusive_maximum": 100, + }, + "openapi_types": (int,), + "attribute": "page[size]", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._update_widget_endpoint = _Endpoint( + settings={ + "response_type": (WidgetResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/widgets/{experience_type}/{uuid}", + "operation_id": "update_widget", + "http_method": "PUT", + "version": "v2", + }, + params_map={ + "experience_type": { + "required": True, + "openapi_types": (WidgetExperienceType,), + "attribute": "experience_type", + "location": "path", + }, + "uuid": { + "required": True, + "openapi_types": (UUID,), + "attribute": "uuid", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (CreateOrUpdateWidgetRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + def create_widget( + self, + experience_type: WidgetExperienceType, + body: CreateOrUpdateWidgetRequest, + ) -> WidgetResponse: + """Create a widget. + + Create a new widget for a given experience type. + + :param experience_type: The experience type for the widget. + :type experience_type: WidgetExperienceType + :param body: Widget request body. + :type body: CreateOrUpdateWidgetRequest + :rtype: WidgetResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["experience_type"] = experience_type + + kwargs["body"] = body + + return self._create_widget_endpoint.call_with_http_info(**kwargs) + + def delete_widget( + self, + experience_type: WidgetExperienceType, + uuid: UUID, + ) -> None: + """Delete a widget. + + Soft-delete a widget by its UUID for a given experience type. + + :param experience_type: The experience type for the widget. + :type experience_type: WidgetExperienceType + :param uuid: The UUID of the widget. + :type uuid: UUID + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["experience_type"] = experience_type + + kwargs["uuid"] = uuid + + return self._delete_widget_endpoint.call_with_http_info(**kwargs) + + def get_widget( + self, + experience_type: WidgetExperienceType, + uuid: UUID, + ) -> WidgetResponse: + """Get a widget. + + Retrieve a widget by its UUID for a given experience type. + + :param experience_type: The experience type for the widget. + :type experience_type: WidgetExperienceType + :param uuid: The UUID of the widget. + :type uuid: UUID + :rtype: WidgetResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["experience_type"] = experience_type + + kwargs["uuid"] = uuid + + return self._get_widget_endpoint.call_with_http_info(**kwargs) + + def search_widgets( + self, + experience_type: WidgetExperienceType, + *, + filter_widget_type: Union[WidgetType, UnsetType] = unset, + filter_creator_handle: Union[str, UnsetType] = unset, + filter_is_favorited: Union[bool, UnsetType] = unset, + filter_title: Union[str, UnsetType] = unset, + filter_tags: Union[str, UnsetType] = unset, + sort: Union[str, UnsetType] = unset, + page_number: Union[int, UnsetType] = unset, + page_size: Union[int, UnsetType] = unset, + ) -> WidgetListResponse: + """Search widgets. + + Search and list widgets for a given experience type. Supports filtering by widget type, creator, title, and tags, as well as sorting and pagination. + + :param experience_type: The experience type for the widget. + :type experience_type: WidgetExperienceType + :param filter_widget_type: Filter widgets by widget type. + :type filter_widget_type: WidgetType, optional + :param filter_creator_handle: Filter widgets by the email handle of the creator. + :type filter_creator_handle: str, optional + :param filter_is_favorited: Filter to only widgets favorited by the current user. + :type filter_is_favorited: bool, optional + :param filter_title: Filter widgets by title (substring match). + :type filter_title: str, optional + :param filter_tags: Filter widgets by tags. Format as bracket-delimited CSV, e.g. ``[tag1,tag2]``. + :type filter_tags: str, optional + :param sort: Sort field for the results. Prefix with ``-`` for descending order. + Allowed values: ``title`` , ``created_at`` , ``modified_at``. + :type sort: str, optional + :param page_number: Page number for pagination (0-indexed). + :type page_number: int, optional + :param page_size: Number of widgets per page. + :type page_size: int, optional + :rtype: WidgetListResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["experience_type"] = experience_type + + if filter_widget_type is not unset: + kwargs["filter_widget_type"] = filter_widget_type + + if filter_creator_handle is not unset: + kwargs["filter_creator_handle"] = filter_creator_handle + + if filter_is_favorited is not unset: + kwargs["filter_is_favorited"] = filter_is_favorited + + if filter_title is not unset: + kwargs["filter_title"] = filter_title + + if filter_tags is not unset: + kwargs["filter_tags"] = filter_tags + + if sort is not unset: + kwargs["sort"] = sort + + if page_number is not unset: + kwargs["page_number"] = page_number + + if page_size is not unset: + kwargs["page_size"] = page_size + + return self._search_widgets_endpoint.call_with_http_info(**kwargs) + + def update_widget( + self, + experience_type: WidgetExperienceType, + uuid: UUID, + body: CreateOrUpdateWidgetRequest, + ) -> WidgetResponse: + """Update a widget. + + Update a widget by its UUID for a given experience type. This performs a full replacement of the widget definition. + + :param experience_type: The experience type for the widget. + :type experience_type: WidgetExperienceType + :param uuid: The UUID of the widget. + :type uuid: UUID + :param body: Widget request body. + :type body: CreateOrUpdateWidgetRequest + :rtype: WidgetResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["experience_type"] = experience_type + + kwargs["uuid"] = uuid + + kwargs["body"] = body + + return self._update_widget_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v2/apis/__init__.py b/src/datadog_api_client/v2/apis/__init__.py index bc1a8f058f..db7cdb8ab0 100644 --- a/src/datadog_api_client/v2/apis/__init__.py +++ b/src/datadog_api_client/v2/apis/__init__.py @@ -101,6 +101,7 @@ from datadog_api_client.v2.api.test_optimization_api import TestOptimizationApi from datadog_api_client.v2.api.usage_metering_api import UsageMeteringApi from datadog_api_client.v2.api.users_api import UsersApi +from datadog_api_client.v2.api.widgets_api import WidgetsApi from datadog_api_client.v2.api.workflow_automation_api import WorkflowAutomationApi @@ -208,5 +209,6 @@ "TestOptimizationApi", "UsageMeteringApi", "UsersApi", + "WidgetsApi", "WorkflowAutomationApi", ] diff --git a/src/datadog_api_client/v2/model/create_or_update_widget_request.py b/src/datadog_api_client/v2/model/create_or_update_widget_request.py new file mode 100644 index 0000000000..eaea211d9f --- /dev/null +++ b/src/datadog_api_client/v2/model/create_or_update_widget_request.py @@ -0,0 +1,40 @@ +# 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 typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.create_or_update_widget_request_data import CreateOrUpdateWidgetRequestData + + +class CreateOrUpdateWidgetRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.create_or_update_widget_request_data import CreateOrUpdateWidgetRequestData + + return { + "data": (CreateOrUpdateWidgetRequestData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: CreateOrUpdateWidgetRequestData, **kwargs): + """ + Request body for creating or updating a widget. + + :param data: Data for creating or updating a widget. + :type data: CreateOrUpdateWidgetRequestData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/create_or_update_widget_request_attributes.py b/src/datadog_api_client/v2/model/create_or_update_widget_request_attributes.py new file mode 100644 index 0000000000..97aa37fa49 --- /dev/null +++ b/src/datadog_api_client/v2/model/create_or_update_widget_request_attributes.py @@ -0,0 +1,50 @@ +# 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 typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + none_type, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.widget_definition import WidgetDefinition + + +class CreateOrUpdateWidgetRequestAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.widget_definition import WidgetDefinition + + return { + "definition": (WidgetDefinition,), + "tags": ([str], none_type), + } + + attribute_map = { + "definition": "definition", + "tags": "tags", + } + + def __init__(self_, definition: WidgetDefinition, tags: Union[List[str], none_type, UnsetType] = unset, **kwargs): + """ + Attributes for creating or updating a widget. + + :param definition: The definition of a widget, including its type and configuration. + :type definition: WidgetDefinition + + :param tags: User-defined tags for organizing the widget. + :type tags: [str], none_type, optional + """ + if tags is not unset: + kwargs["tags"] = tags + super().__init__(kwargs) + + self_.definition = definition diff --git a/src/datadog_api_client/v2/model/create_or_update_widget_request_data.py b/src/datadog_api_client/v2/model/create_or_update_widget_request_data.py new file mode 100644 index 0000000000..38ba6e7166 --- /dev/null +++ b/src/datadog_api_client/v2/model/create_or_update_widget_request_data.py @@ -0,0 +1,50 @@ +# 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 typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.create_or_update_widget_request_attributes import ( + CreateOrUpdateWidgetRequestAttributes, + ) + + +class CreateOrUpdateWidgetRequestData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.create_or_update_widget_request_attributes import ( + CreateOrUpdateWidgetRequestAttributes, + ) + + return { + "attributes": (CreateOrUpdateWidgetRequestAttributes,), + "type": (str,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__(self_, attributes: CreateOrUpdateWidgetRequestAttributes, type: str, **kwargs): + """ + Data for creating or updating a widget. + + :param attributes: Attributes for creating or updating a widget. + :type attributes: CreateOrUpdateWidgetRequestAttributes + + :param type: Widgets resource type. + :type type: str + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/widget_attributes.py b/src/datadog_api_client/v2/model/widget_attributes.py new file mode 100644 index 0000000000..462a6caf78 --- /dev/null +++ b/src/datadog_api_client/v2/model/widget_attributes.py @@ -0,0 +1,73 @@ +# 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 typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + none_type, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.widget_definition import WidgetDefinition + + +class WidgetAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.widget_definition import WidgetDefinition + + return { + "created_at": (str,), + "definition": (WidgetDefinition,), + "is_favorited": (bool,), + "modified_at": (str,), + "tags": ([str], none_type), + } + + attribute_map = { + "created_at": "created_at", + "definition": "definition", + "is_favorited": "is_favorited", + "modified_at": "modified_at", + "tags": "tags", + } + + def __init__( + self_, + created_at: str, + definition: WidgetDefinition, + is_favorited: bool, + modified_at: str, + tags: Union[List[str], none_type], + **kwargs, + ): + """ + Attributes of a widget resource. + + :param created_at: ISO 8601 timestamp of when the widget was created. + :type created_at: str + + :param definition: The definition of a widget, including its type and configuration. + :type definition: WidgetDefinition + + :param is_favorited: Will be implemented soon. Currently always returns false. + :type is_favorited: bool + + :param modified_at: ISO 8601 timestamp of when the widget was last modified. + :type modified_at: str + + :param tags: User-defined tags for organizing widgets. + :type tags: [str], none_type + """ + super().__init__(kwargs) + + self_.created_at = created_at + self_.definition = definition + self_.is_favorited = is_favorited + self_.modified_at = modified_at + self_.tags = tags diff --git a/src/datadog_api_client/v2/model/widget_data.py b/src/datadog_api_client/v2/model/widget_data.py new file mode 100644 index 0000000000..576a96ac81 --- /dev/null +++ b/src/datadog_api_client/v2/model/widget_data.py @@ -0,0 +1,70 @@ +# 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 typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.widget_attributes import WidgetAttributes + from datadog_api_client.v2.model.widget_relationships import WidgetRelationships + + +class WidgetData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.widget_attributes import WidgetAttributes + from datadog_api_client.v2.model.widget_relationships import WidgetRelationships + + return { + "attributes": (WidgetAttributes,), + "id": (str,), + "relationships": (WidgetRelationships,), + "type": (str,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "relationships": "relationships", + "type": "type", + } + + def __init__( + self_, + attributes: WidgetAttributes, + id: str, + type: str, + relationships: Union[WidgetRelationships, UnsetType] = unset, + **kwargs, + ): + """ + A widget resource object. + + :param attributes: Attributes of a widget resource. + :type attributes: WidgetAttributes + + :param id: The unique identifier of the widget. + :type id: str + + :param relationships: Relationships of the widget resource. + :type relationships: WidgetRelationships, optional + + :param type: Widgets resource type. + :type type: str + """ + if relationships is not unset: + kwargs["relationships"] = relationships + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/widget_definition.py b/src/datadog_api_client/v2/model/widget_definition.py new file mode 100644 index 0000000000..2e18d238e6 --- /dev/null +++ b/src/datadog_api_client/v2/model/widget_definition.py @@ -0,0 +1,54 @@ +# 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 typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.widget_type import WidgetType + + +class WidgetDefinition(ModelNormal): + validations = { + "title": { + "max_length": 100, + "min_length": 1, + }, + } + + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.widget_type import WidgetType + + return { + "title": (str,), + "type": (WidgetType,), + } + + attribute_map = { + "title": "title", + "type": "type", + } + + def __init__(self_, title: str, type: WidgetType, **kwargs): + """ + The definition of a widget, including its type and configuration. + + :param title: The display title of the widget. + :type title: str + + :param type: Widget types that are allowed to be stored as individual records. + This is not a complete list of dashboard and notebook widget types. + :type type: WidgetType + """ + super().__init__(kwargs) + + self_.title = title + self_.type = type diff --git a/src/datadog_api_client/v2/model/widget_experience_type.py b/src/datadog_api_client/v2/model/widget_experience_type.py new file mode 100644 index 0000000000..5da187948e --- /dev/null +++ b/src/datadog_api_client/v2/model/widget_experience_type.py @@ -0,0 +1,44 @@ +# 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 WidgetExperienceType(ModelSimple): + """ + Widget experience types that differentiate between the products using the specific widget. + + :param value: Must be one of ["ccm_reports", "logs_reports", "csv_reports", "product_analytics"]. + :type value: str + """ + + allowed_values = { + "ccm_reports", + "logs_reports", + "csv_reports", + "product_analytics", + } + CCM_REPORTS: ClassVar["WidgetExperienceType"] + LOGS_REPORTS: ClassVar["WidgetExperienceType"] + CSV_REPORTS: ClassVar["WidgetExperienceType"] + PRODUCT_ANALYTICS: ClassVar["WidgetExperienceType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +WidgetExperienceType.CCM_REPORTS = WidgetExperienceType("ccm_reports") +WidgetExperienceType.LOGS_REPORTS = WidgetExperienceType("logs_reports") +WidgetExperienceType.CSV_REPORTS = WidgetExperienceType("csv_reports") +WidgetExperienceType.PRODUCT_ANALYTICS = WidgetExperienceType("product_analytics") diff --git a/src/datadog_api_client/v2/model/widget_included_user.py b/src/datadog_api_client/v2/model/widget_included_user.py new file mode 100644 index 0000000000..4ac82636dc --- /dev/null +++ b/src/datadog_api_client/v2/model/widget_included_user.py @@ -0,0 +1,57 @@ +# 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 typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.widget_included_user_attributes import WidgetIncludedUserAttributes + + +class WidgetIncludedUser(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.widget_included_user_attributes import WidgetIncludedUserAttributes + + return { + "attributes": (WidgetIncludedUserAttributes,), + "id": (str,), + "type": (str,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, id: str, type: str, attributes: Union[WidgetIncludedUserAttributes, UnsetType] = unset, **kwargs + ): + """ + A user resource included in the response. + + :param attributes: Attributes of an included user resource. + :type attributes: WidgetIncludedUserAttributes, optional + + :param id: The unique identifier of the user. + :type id: str + + :param type: Users resource type. + :type type: str + """ + if attributes is not unset: + kwargs["attributes"] = attributes + super().__init__(kwargs) + + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/widget_included_user_attributes.py b/src/datadog_api_client/v2/model/widget_included_user_attributes.py new file mode 100644 index 0000000000..2693d865de --- /dev/null +++ b/src/datadog_api_client/v2/model/widget_included_user_attributes.py @@ -0,0 +1,46 @@ +# 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 typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + none_type, + unset, + UnsetType, +) + + +class WidgetIncludedUserAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "handle": (str,), + "name": (str, none_type), + } + + attribute_map = { + "handle": "handle", + "name": "name", + } + + def __init__( + self_, handle: Union[str, UnsetType] = unset, name: Union[str, none_type, UnsetType] = unset, **kwargs + ): + """ + Attributes of an included user resource. + + :param handle: The email handle of the user. + :type handle: str, optional + + :param name: The display name of the user. + :type name: str, none_type, optional + """ + if handle is not unset: + kwargs["handle"] = handle + if name is not unset: + kwargs["name"] = name + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/widget_list_response.py b/src/datadog_api_client/v2/model/widget_list_response.py new file mode 100644 index 0000000000..4eac7af892 --- /dev/null +++ b/src/datadog_api_client/v2/model/widget_list_response.py @@ -0,0 +1,66 @@ +# 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 typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.widget_data import WidgetData + from datadog_api_client.v2.model.widget_included_user import WidgetIncludedUser + from datadog_api_client.v2.model.widget_search_meta import WidgetSearchMeta + + +class WidgetListResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.widget_data import WidgetData + from datadog_api_client.v2.model.widget_included_user import WidgetIncludedUser + from datadog_api_client.v2.model.widget_search_meta import WidgetSearchMeta + + return { + "data": ([WidgetData],), + "included": ([WidgetIncludedUser],), + "meta": (WidgetSearchMeta,), + } + + attribute_map = { + "data": "data", + "included": "included", + "meta": "meta", + } + + def __init__( + self_, + data: List[WidgetData], + included: Union[List[WidgetIncludedUser], UnsetType] = unset, + meta: Union[WidgetSearchMeta, UnsetType] = unset, + **kwargs, + ): + """ + Response containing a list of widgets. + + :param data: List of widget resources. + :type data: [WidgetData] + + :param included: Array of user resources related to the widgets. + :type included: [WidgetIncludedUser], optional + + :param meta: Metadata about the search results. + :type meta: WidgetSearchMeta, optional + """ + if included is not unset: + kwargs["included"] = included + if meta is not unset: + kwargs["meta"] = meta + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/widget_relationship_data.py b/src/datadog_api_client/v2/model/widget_relationship_data.py new file mode 100644 index 0000000000..f59cbaee87 --- /dev/null +++ b/src/datadog_api_client/v2/model/widget_relationship_data.py @@ -0,0 +1,39 @@ +# 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 ( + ModelNormal, + cached_property, +) + + +class WidgetRelationshipData(ModelNormal): + @cached_property + def openapi_types(_): + return { + "id": (str,), + "type": (str,), + } + + attribute_map = { + "id": "id", + "type": "type", + } + + def __init__(self_, id: str, type: str, **kwargs): + """ + Relationship data referencing a user resource. + + :param id: The unique identifier of the user. + :type id: str + + :param type: Users resource type. + :type type: str + """ + super().__init__(kwargs) + + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/widget_relationship_item.py b/src/datadog_api_client/v2/model/widget_relationship_item.py new file mode 100644 index 0000000000..aa7099ee0c --- /dev/null +++ b/src/datadog_api_client/v2/model/widget_relationship_item.py @@ -0,0 +1,42 @@ +# 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 typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.widget_relationship_data import WidgetRelationshipData + + +class WidgetRelationshipItem(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.widget_relationship_data import WidgetRelationshipData + + return { + "data": (WidgetRelationshipData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[WidgetRelationshipData, UnsetType] = unset, **kwargs): + """ + A JSON:API relationship to a user. + + :param data: Relationship data referencing a user resource. + :type data: WidgetRelationshipData, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/widget_relationships.py b/src/datadog_api_client/v2/model/widget_relationships.py new file mode 100644 index 0000000000..67f2fa876a --- /dev/null +++ b/src/datadog_api_client/v2/model/widget_relationships.py @@ -0,0 +1,54 @@ +# 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 typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.widget_relationship_item import WidgetRelationshipItem + + +class WidgetRelationships(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.widget_relationship_item import WidgetRelationshipItem + + return { + "created_by": (WidgetRelationshipItem,), + "modified_by": (WidgetRelationshipItem,), + } + + attribute_map = { + "created_by": "created_by", + "modified_by": "modified_by", + } + + def __init__( + self_, + created_by: Union[WidgetRelationshipItem, UnsetType] = unset, + modified_by: Union[WidgetRelationshipItem, UnsetType] = unset, + **kwargs, + ): + """ + Relationships of the widget resource. + + :param created_by: A JSON:API relationship to a user. + :type created_by: WidgetRelationshipItem, optional + + :param modified_by: A JSON:API relationship to a user. + :type modified_by: WidgetRelationshipItem, optional + """ + if created_by is not unset: + kwargs["created_by"] = created_by + if modified_by is not unset: + kwargs["modified_by"] = modified_by + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/widget_response.py b/src/datadog_api_client/v2/model/widget_response.py new file mode 100644 index 0000000000..5323b26475 --- /dev/null +++ b/src/datadog_api_client/v2/model/widget_response.py @@ -0,0 +1,51 @@ +# 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 typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.widget_data import WidgetData + from datadog_api_client.v2.model.widget_included_user import WidgetIncludedUser + + +class WidgetResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.widget_data import WidgetData + from datadog_api_client.v2.model.widget_included_user import WidgetIncludedUser + + return { + "data": (WidgetData,), + "included": ([WidgetIncludedUser],), + } + + attribute_map = { + "data": "data", + "included": "included", + } + + def __init__(self_, data: WidgetData, included: Union[List[WidgetIncludedUser], UnsetType] = unset, **kwargs): + """ + Response containing a single widget. + + :param data: A widget resource object. + :type data: WidgetData + + :param included: Array of user resources related to the widget. + :type included: [WidgetIncludedUser], optional + """ + if included is not unset: + kwargs["included"] = included + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/widget_search_meta.py b/src/datadog_api_client/v2/model/widget_search_meta.py new file mode 100644 index 0000000000..2691bde31b --- /dev/null +++ b/src/datadog_api_client/v2/model/widget_search_meta.py @@ -0,0 +1,64 @@ +# 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 typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class WidgetSearchMeta(ModelNormal): + @cached_property + def openapi_types(_): + return { + "created_by_anyone_total": (int,), + "created_by_you_total": (int,), + "favorited_by_you_total": (int,), + "filtered_total": (int,), + } + + attribute_map = { + "created_by_anyone_total": "created_by_anyone_total", + "created_by_you_total": "created_by_you_total", + "favorited_by_you_total": "favorited_by_you_total", + "filtered_total": "filtered_total", + } + + def __init__( + self_, + created_by_anyone_total: Union[int, UnsetType] = unset, + created_by_you_total: Union[int, UnsetType] = unset, + favorited_by_you_total: Union[int, UnsetType] = unset, + filtered_total: Union[int, UnsetType] = unset, + **kwargs, + ): + """ + Metadata about the search results. + + :param created_by_anyone_total: Total number of widgets created by anyone. + :type created_by_anyone_total: int, optional + + :param created_by_you_total: Total number of widgets created by the current user. + :type created_by_you_total: int, optional + + :param favorited_by_you_total: Total number of widgets favorited by the current user. + :type favorited_by_you_total: int, optional + + :param filtered_total: Total number of widgets matching the current filter criteria. + :type filtered_total: int, optional + """ + if created_by_anyone_total is not unset: + kwargs["created_by_anyone_total"] = created_by_anyone_total + if created_by_you_total is not unset: + kwargs["created_by_you_total"] = created_by_you_total + if favorited_by_you_total is not unset: + kwargs["favorited_by_you_total"] = favorited_by_you_total + if filtered_total is not unset: + kwargs["filtered_total"] = filtered_total + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/widget_type.py b/src/datadog_api_client/v2/model/widget_type.py new file mode 100644 index 0000000000..cb65df92c7 --- /dev/null +++ b/src/datadog_api_client/v2/model/widget_type.py @@ -0,0 +1,78 @@ +# 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 WidgetType(ModelSimple): + """ + Widget types that are allowed to be stored as individual records. + This is not a complete list of dashboard and notebook widget types. + + :param value: Must be one of ["bar_chart", "change", "cloud_cost_summary", "cohort", "funnel", "geomap", "list_stream", "query_table", "query_value", "retention_curve", "sankey", "sunburst", "timeseries", "toplist", "treemap"]. + :type value: str + """ + + allowed_values = { + "bar_chart", + "change", + "cloud_cost_summary", + "cohort", + "funnel", + "geomap", + "list_stream", + "query_table", + "query_value", + "retention_curve", + "sankey", + "sunburst", + "timeseries", + "toplist", + "treemap", + } + BAR_CHART: ClassVar["WidgetType"] + CHANGE: ClassVar["WidgetType"] + CLOUD_COST_SUMMARY: ClassVar["WidgetType"] + COHORT: ClassVar["WidgetType"] + FUNNEL: ClassVar["WidgetType"] + GEOMAP: ClassVar["WidgetType"] + LIST_STREAM: ClassVar["WidgetType"] + QUERY_TABLE: ClassVar["WidgetType"] + QUERY_VALUE: ClassVar["WidgetType"] + RETENTION_CURVE: ClassVar["WidgetType"] + SANKEY: ClassVar["WidgetType"] + SUNBURST: ClassVar["WidgetType"] + TIMESERIES: ClassVar["WidgetType"] + TOPLIST: ClassVar["WidgetType"] + TREEMAP: ClassVar["WidgetType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +WidgetType.BAR_CHART = WidgetType("bar_chart") +WidgetType.CHANGE = WidgetType("change") +WidgetType.CLOUD_COST_SUMMARY = WidgetType("cloud_cost_summary") +WidgetType.COHORT = WidgetType("cohort") +WidgetType.FUNNEL = WidgetType("funnel") +WidgetType.GEOMAP = WidgetType("geomap") +WidgetType.LIST_STREAM = WidgetType("list_stream") +WidgetType.QUERY_TABLE = WidgetType("query_table") +WidgetType.QUERY_VALUE = WidgetType("query_value") +WidgetType.RETENTION_CURVE = WidgetType("retention_curve") +WidgetType.SANKEY = WidgetType("sankey") +WidgetType.SUNBURST = WidgetType("sunburst") +WidgetType.TIMESERIES = WidgetType("timeseries") +WidgetType.TOPLIST = WidgetType("toplist") +WidgetType.TREEMAP = WidgetType("treemap") diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 5a7ad16d25..62769661be 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -1235,6 +1235,9 @@ from datadog_api_client.v2.model.create_open_api_response import CreateOpenAPIResponse from datadog_api_client.v2.model.create_open_api_response_attributes import CreateOpenAPIResponseAttributes from datadog_api_client.v2.model.create_open_api_response_data import CreateOpenAPIResponseData +from datadog_api_client.v2.model.create_or_update_widget_request import CreateOrUpdateWidgetRequest +from datadog_api_client.v2.model.create_or_update_widget_request_attributes import CreateOrUpdateWidgetRequestAttributes +from datadog_api_client.v2.model.create_or_update_widget_request_data import CreateOrUpdateWidgetRequestData from datadog_api_client.v2.model.create_page_request import CreatePageRequest from datadog_api_client.v2.model.create_page_request_data import CreatePageRequestData from datadog_api_client.v2.model.create_page_request_data_attributes import CreatePageRequestDataAttributes @@ -6604,7 +6607,20 @@ from datadog_api_client.v2.model.watcher_data_attributes import WatcherDataAttributes from datadog_api_client.v2.model.watcher_data_type import WatcherDataType from datadog_api_client.v2.model.weekday import Weekday +from datadog_api_client.v2.model.widget_attributes import WidgetAttributes +from datadog_api_client.v2.model.widget_data import WidgetData +from datadog_api_client.v2.model.widget_definition import WidgetDefinition +from datadog_api_client.v2.model.widget_experience_type import WidgetExperienceType +from datadog_api_client.v2.model.widget_included_user import WidgetIncludedUser +from datadog_api_client.v2.model.widget_included_user_attributes import WidgetIncludedUserAttributes +from datadog_api_client.v2.model.widget_list_response import WidgetListResponse from datadog_api_client.v2.model.widget_live_span import WidgetLiveSpan +from datadog_api_client.v2.model.widget_relationship_data import WidgetRelationshipData +from datadog_api_client.v2.model.widget_relationship_item import WidgetRelationshipItem +from datadog_api_client.v2.model.widget_relationships import WidgetRelationships +from datadog_api_client.v2.model.widget_response import WidgetResponse +from datadog_api_client.v2.model.widget_search_meta import WidgetSearchMeta +from datadog_api_client.v2.model.widget_type import WidgetType from datadog_api_client.v2.model.workflow_data import WorkflowData from datadog_api_client.v2.model.workflow_data_attributes import WorkflowDataAttributes from datadog_api_client.v2.model.workflow_data_relationships import WorkflowDataRelationships @@ -7562,6 +7578,9 @@ "CreateOpenAPIResponse", "CreateOpenAPIResponseAttributes", "CreateOpenAPIResponseData", + "CreateOrUpdateWidgetRequest", + "CreateOrUpdateWidgetRequestAttributes", + "CreateOrUpdateWidgetRequestData", "CreatePageRequest", "CreatePageRequestData", "CreatePageRequestDataAttributes", @@ -11307,7 +11326,20 @@ "WatcherDataAttributes", "WatcherDataType", "Weekday", + "WidgetAttributes", + "WidgetData", + "WidgetDefinition", + "WidgetExperienceType", + "WidgetIncludedUser", + "WidgetIncludedUserAttributes", + "WidgetListResponse", "WidgetLiveSpan", + "WidgetRelationshipData", + "WidgetRelationshipItem", + "WidgetRelationships", + "WidgetResponse", + "WidgetSearchMeta", + "WidgetType", "WorkflowData", "WorkflowDataAttributes", "WorkflowDataRelationships", diff --git a/tests/v1/features/authentication.feature b/tests/v1/features/authentication.feature index b82a231321..29acfedbf0 100644 --- a/tests/v1/features/authentication.feature +++ b/tests/v1/features/authentication.feature @@ -16,12 +16,12 @@ Feature: Authentication Given an instance of "Authentication" API And new "Validate" request - @skip-validation @team:DataDog/credentials-management + @skip-validation @team:DataDog/credential-management Scenario: Validate API key returns "Forbidden" response When the request is sent Then the response status is 403 OK - @team:DataDog/credentials-management + @team:DataDog/credential-management Scenario: Validate API key returns "OK" response Given a valid "apiKeyAuth" key in the system When the request is sent diff --git a/tests/v1/features/key_management.feature b/tests/v1/features/key_management.feature index c3f18c2346..222728688f 100644 --- a/tests/v1/features/key_management.feature +++ b/tests/v1/features/key_management.feature @@ -12,77 +12,77 @@ Feature: Key Management And a valid "appKeyAuth" key in the system And an instance of "KeyManagement" API - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Create an API key returns "Bad Request" response Given new "CreateAPIKey" request And body with value {"name": "example user"} When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Create an API key returns "OK" response Given new "CreateAPIKey" request And body with value {"name": "example user"} When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Create an application key returns "Bad Request" response Given new "CreateApplicationKey" request And body with value {"name": "example user"} When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Create an application key returns "Conflict" response Given new "CreateApplicationKey" request And body with value {"name": "example user"} When the request is sent Then the response status is 409 Conflict - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Create an application key returns "OK" response Given new "CreateApplicationKey" request And body with value {"name": "example user"} When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Delete an API key returns "Bad Request" response Given new "DeleteAPIKey" request And request contains "key" parameter from "REPLACE.ME" When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Delete an API key returns "Not Found" response Given new "DeleteAPIKey" request And request contains "key" parameter from "REPLACE.ME" When the request is sent Then the response status is 404 Not Found - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Delete an API key returns "OK" response Given new "DeleteAPIKey" request And request contains "key" parameter from "REPLACE.ME" When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Delete an application key returns "Not Found" response Given new "DeleteApplicationKey" request And request contains "key" parameter from "REPLACE.ME" When the request is sent Then the response status is 404 Not Found - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Delete an application key returns "OK" response Given new "DeleteApplicationKey" request And request contains "key" parameter from "REPLACE.ME" When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Edit an API key returns "Bad Request" response Given new "UpdateAPIKey" request And request contains "key" parameter from "REPLACE.ME" @@ -90,7 +90,7 @@ Feature: Key Management When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Edit an API key returns "Not Found" response Given new "UpdateAPIKey" request And request contains "key" parameter from "REPLACE.ME" @@ -98,7 +98,7 @@ Feature: Key Management When the request is sent Then the response status is 404 Not Found - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Edit an API key returns "OK" response Given new "UpdateAPIKey" request And request contains "key" parameter from "REPLACE.ME" @@ -106,7 +106,7 @@ Feature: Key Management When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Edit an application key returns "Bad Request" response Given new "UpdateApplicationKey" request And request contains "key" parameter from "REPLACE.ME" @@ -114,7 +114,7 @@ Feature: Key Management When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Edit an application key returns "Conflict" response Given new "UpdateApplicationKey" request And request contains "key" parameter from "REPLACE.ME" @@ -122,7 +122,7 @@ Feature: Key Management When the request is sent Then the response status is 409 Conflict - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Edit an application key returns "Not Found" response Given new "UpdateApplicationKey" request And request contains "key" parameter from "REPLACE.ME" @@ -130,7 +130,7 @@ Feature: Key Management When the request is sent Then the response status is 404 Not Found - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Edit an application key returns "OK" response Given new "UpdateApplicationKey" request And request contains "key" parameter from "REPLACE.ME" @@ -138,40 +138,40 @@ Feature: Key Management When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Get API key returns "Not Found" response Given new "GetAPIKey" request And request contains "key" parameter from "REPLACE.ME" When the request is sent Then the response status is 404 Not Found - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Get API key returns "OK" response Given new "GetAPIKey" request And request contains "key" parameter from "REPLACE.ME" When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Get all API keys returns "OK" response Given new "ListAPIKeys" request When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Get all application keys returns "OK" response Given new "ListApplicationKeys" request When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Get an application key returns "Not Found" response Given new "GetApplicationKey" request And request contains "key" parameter from "REPLACE.ME" When the request is sent Then the response status is 404 Not Found - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Get an application key returns "OK" response Given new "GetApplicationKey" request And request contains "key" parameter from "REPLACE.ME" diff --git a/tests/v2/features/key_management.feature b/tests/v2/features/key_management.feature index 40daf9df54..d7e706efa8 100644 --- a/tests/v2/features/key_management.feature +++ b/tests/v2/features/key_management.feature @@ -12,14 +12,14 @@ Feature: Key Management And a valid "appKeyAuth" key in the system And an instance of "KeyManagement" API - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Create an API key returns "Bad Request" response Given new "CreateAPIKey" request And body with value {"data": {"attributes": {"name": "API Key for submitting metrics"}, "type": "api_keys"}} When the request is sent Then the response status is 400 Bad Request - @team:DataDog/credentials-management + @team:DataDog/credential-management Scenario: Create an API key returns "Created" response Given new "CreateAPIKey" request And body with value {"data": {"type": "api_keys", "attributes": {"name": "{{ unique }}"}}} @@ -28,7 +28,7 @@ Feature: Key Management And the response "data.type" is equal to "api_keys" And the response "data.attributes.name" is equal to "{{ unique }}" - @team:DataDog/credentials-management + @team:DataDog/credential-management Scenario: Create an Application key with scopes for current user returns "Created" response Given new "CreateCurrentUserApplicationKey" request And body with value {"data": {"type": "application_keys", "attributes": {"name": "{{ unique }}", "scopes": ["dashboards_read", "dashboards_write", "dashboards_public_share"]}}} @@ -37,14 +37,14 @@ Feature: Key Management And the response "data.attributes.name" is equal to "{{ unique }}" And the response "data.attributes.scopes" is equal to ["dashboards_read", "dashboards_write", "dashboards_public_share"] - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Create an application key for current user returns "Bad Request" response Given new "CreateCurrentUserApplicationKey" request And body with value {"data": {"attributes": {"name": "Application Key for managing dashboards", "scopes": ["dashboards_read", "dashboards_write", "dashboards_public_share"]}, "type": "application_keys"}} When the request is sent Then the response status is 400 Bad Request - @team:DataDog/credentials-management + @team:DataDog/credential-management Scenario: Create an application key for current user returns "Created" response Given new "CreateCurrentUserApplicationKey" request And body with value {"data": {"type": "application_keys", "attributes": {"name": "{{ unique }}"}}} @@ -53,7 +53,7 @@ Feature: Key Management And the response "data.type" is equal to "application_keys" And the response "data.attributes.name" is equal to "{{ unique }}" - @team:DataDog/credentials-management + @team:DataDog/credential-management Scenario: Delete an API key returns "No Content" response Given there is a valid "api_key" in the system And new "DeleteAPIKey" request @@ -61,14 +61,14 @@ Feature: Key Management When the request is sent Then the response status is 204 No Content - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Delete an API key returns "Not Found" response Given new "DeleteAPIKey" request And request contains "api_key_id" parameter from "REPLACE.ME" When the request is sent Then the response status is 404 Not Found - @team:DataDog/credentials-management + @team:DataDog/credential-management Scenario: Delete an application key owned by current user returns "No Content" response Given there is a valid "application_key" in the system And new "DeleteCurrentUserApplicationKey" request @@ -76,14 +76,14 @@ Feature: Key Management When the request is sent Then the response status is 204 No Content - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Delete an application key owned by current user returns "Not Found" response Given new "DeleteCurrentUserApplicationKey" request And request contains "app_key_id" parameter from "REPLACE.ME" When the request is sent Then the response status is 404 Not Found - @team:DataDog/credentials-management + @team:DataDog/credential-management Scenario: Delete an application key returns "No Content" response Given there is a valid "application_key" in the system And new "DeleteApplicationKey" request @@ -91,14 +91,14 @@ Feature: Key Management When the request is sent Then the response status is 204 No Content - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Delete an application key returns "Not Found" response Given new "DeleteApplicationKey" request And request contains "app_key_id" parameter from "REPLACE.ME" When the request is sent Then the response status is 404 Not Found - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Edit an API key returns "Bad Request" response Given new "UpdateAPIKey" request And request contains "api_key_id" parameter from "REPLACE.ME" @@ -106,7 +106,7 @@ Feature: Key Management When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Edit an API key returns "Not Found" response Given new "UpdateAPIKey" request And request contains "api_key_id" parameter from "REPLACE.ME" @@ -114,7 +114,7 @@ Feature: Key Management When the request is sent Then the response status is 404 Not Found - @team:DataDog/credentials-management + @team:DataDog/credential-management Scenario: Edit an API key returns "OK" response Given there is a valid "api_key" in the system And new "UpdateAPIKey" request @@ -126,7 +126,7 @@ Feature: Key Management And the response "data.id" is equal to "{{ api_key.data.id }}" And the response "data.attributes.name" is equal to "{{ unique }}" - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Edit an application key owned by current user returns "Bad Request" response Given new "UpdateCurrentUserApplicationKey" request And request contains "app_key_id" parameter from "REPLACE.ME" @@ -134,7 +134,7 @@ Feature: Key Management When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Edit an application key owned by current user returns "Not Found" response Given new "UpdateCurrentUserApplicationKey" request And request contains "app_key_id" parameter from "REPLACE.ME" @@ -142,7 +142,7 @@ Feature: Key Management When the request is sent Then the response status is 404 Not Found - @team:DataDog/credentials-management + @team:DataDog/credential-management Scenario: Edit an application key owned by current user returns "OK" response Given there is a valid "application_key" in the system And new "UpdateCurrentUserApplicationKey" request @@ -154,7 +154,7 @@ Feature: Key Management And the response "data.id" is equal to "{{ application_key.data.id }}" And the response "data.attributes.name" is equal to "{{ application_key.data.attributes.name }}-updated" - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Edit an application key returns "Bad Request" response Given new "UpdateApplicationKey" request And request contains "app_key_id" parameter from "REPLACE.ME" @@ -162,7 +162,7 @@ Feature: Key Management When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Edit an application key returns "Not Found" response Given new "UpdateApplicationKey" request And request contains "app_key_id" parameter from "REPLACE.ME" @@ -170,7 +170,7 @@ Feature: Key Management When the request is sent Then the response status is 404 Not Found - @team:DataDog/credentials-management + @team:DataDog/credential-management Scenario: Edit an application key returns "OK" response Given there is a valid "application_key" in the system And new "UpdateApplicationKey" request @@ -182,14 +182,14 @@ Feature: Key Management And the response "data.id" is equal to "{{ application_key.data.id }}" And the response "data.attributes.name" is equal to "{{ application_key.data.attributes.name }}-updated" - @team:DataDog/credentials-management + @team:DataDog/credential-management Scenario: Get API key returns "Not Found" response Given new "GetAPIKey" request And request contains "api_key_id" parameter with value "invalidId" When the request is sent Then the response status is 404 Not Found - @team:DataDog/credentials-management + @team:DataDog/credential-management Scenario: Get API key returns "OK" response Given there is a valid "api_key" in the system And new "GetAPIKey" request @@ -200,13 +200,13 @@ Feature: Key Management And the response "data.id" is equal to "{{ api_key.data.id }}" And the response "data.attributes" has field "date_last_used" - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Get all API keys returns "Bad Request" response Given new "ListAPIKeys" request When the request is sent Then the response status is 400 Bad Request - @team:DataDog/credentials-management + @team:DataDog/credential-management Scenario: Get all API keys returns "OK" response Given there is a valid "api_key" in the system And new "ListAPIKeys" request @@ -216,19 +216,19 @@ Feature: Key Management And the response "data[0].type" is equal to "api_keys" And the response "data[0].attributes" has field "date_last_used" - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Get all application keys owned by current user returns "Bad Request" response Given new "ListCurrentUserApplicationKeys" request When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Get all application keys owned by current user returns "Not Found" response Given new "ListCurrentUserApplicationKeys" request When the request is sent Then the response status is 404 Not Found - @team:DataDog/credentials-management + @team:DataDog/credential-management Scenario: Get all application keys owned by current user returns "OK" response Given new "ListCurrentUserApplicationKeys" request When the request is sent @@ -236,19 +236,19 @@ Feature: Key Management And the response "data[0].type" is equal to "application_keys" And the response "data[0].attributes" has field "last_used_at" - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Get all application keys returns "Bad Request" response Given new "ListApplicationKeys" request When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Get all application keys returns "Not Found" response Given new "ListApplicationKeys" request When the request is sent Then the response status is 404 Not Found - @team:DataDog/credentials-management + @team:DataDog/credential-management Scenario: Get all application keys returns "OK" response Given there is a valid "application_key" in the system And new "ListApplicationKeys" request @@ -257,21 +257,21 @@ Feature: Key Management And the response "data[0].type" is equal to "application_keys" And the response "data[0].attributes" has field "last_used_at" - @generated @skip @team:DataDog/credentials-management + @generated @skip @team:DataDog/credential-management Scenario: Get an application key returns "Bad Request" response Given new "GetApplicationKey" request And request contains "app_key_id" parameter from "REPLACE.ME" When the request is sent Then the response status is 400 Bad Request - @team:DataDog/credentials-management + @team:DataDog/credential-management Scenario: Get an application key returns "Not Found" response Given new "GetApplicationKey" request And request contains "app_key_id" parameter with value "invalidId" When the request is sent Then the response status is 404 Not Found - @team:DataDog/credentials-management + @team:DataDog/credential-management Scenario: Get an application key returns "OK" response Given there is a valid "application_key" in the system And new "GetApplicationKey" request @@ -282,14 +282,14 @@ Feature: Key Management And the response "data.id" has the same value as "application_key.data.id" And the response "data.attributes" has field "last_used_at" - @team:DataDog/credentials-management + @team:DataDog/credential-management Scenario: Get one application key owned by current user returns "Not Found" response Given new "GetCurrentUserApplicationKey" request And request contains "app_key_id" parameter with value "incorrectId" When the request is sent Then the response status is 404 Not Found - @team:DataDog/credentials-management + @team:DataDog/credential-management Scenario: Get one application key owned by current user returns "OK" response Given there is a valid "application_key" in the system And new "GetCurrentUserApplicationKey" request diff --git a/tests/v2/features/service_accounts.feature b/tests/v2/features/service_accounts.feature index 6e25db1e8f..cad1c9e134 100644 --- a/tests/v2/features/service_accounts.feature +++ b/tests/v2/features/service_accounts.feature @@ -9,14 +9,14 @@ Feature: Service Accounts And a valid "appKeyAuth" key in the system And an instance of "ServiceAccounts" API - @generated @skip @team:DataDog/credentials-management @team:DataDog/team-aaa-identity + @generated @skip @team:DataDog/credential-management @team:DataDog/team-aaa-identity Scenario: Create a service account returns "Bad Request" response Given new "CreateServiceAccount" request And body with value {"data": {"attributes": {"email": "jane.doe@example.com", "service_account": true}, "relationships": {"roles": {"data": [{"id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d", "type": "roles"}]}}, "type": "users"}} When the request is sent Then the response status is 400 Bad Request - @team:DataDog/credentials-management @team:DataDog/team-aaa-identity + @team:DataDog/credential-management @team:DataDog/team-aaa-identity Scenario: Create a service account returns "OK" response Given there is a valid "role" in the system And new "CreateServiceAccount" request @@ -29,7 +29,7 @@ Feature: Service Accounts And the response "data.attributes.service_account" is equal to true And the response "data.relationships.roles.data[0].id" is equal to "{{ role.data.id }}" - @generated @skip @team:DataDog/credentials-management @team:DataDog/team-aaa-identity + @generated @skip @team:DataDog/credential-management @team:DataDog/team-aaa-identity Scenario: Create an application key for this service account returns "Bad Request" response Given new "CreateServiceAccountApplicationKey" request And request contains "service_account_id" parameter from "REPLACE.ME" @@ -37,7 +37,7 @@ Feature: Service Accounts When the request is sent Then the response status is 400 Bad Request - @team:DataDog/credentials-management @team:DataDog/team-aaa-identity + @team:DataDog/credential-management @team:DataDog/team-aaa-identity Scenario: Create an application key for this service account returns "Created" response Given there is a valid "service_account_user" in the system And new "CreateServiceAccountApplicationKey" request @@ -48,7 +48,7 @@ Feature: Service Accounts And the response "data.attributes.name" is equal to "{{ unique }}" And the response "data.relationships.owned_by.data.id" has the same value as "service_account_user.data.id" - @team:DataDog/credentials-management @team:DataDog/team-aaa-identity + @team:DataDog/credential-management @team:DataDog/team-aaa-identity Scenario: Create an application key with scopes for this service account returns "Created" response Given there is a valid "service_account_user" in the system And new "CreateServiceAccountApplicationKey" request @@ -60,7 +60,7 @@ Feature: Service Accounts And the response "data.attributes.scopes" is equal to ["dashboards_read", "dashboards_write", "dashboards_public_share"] And the response "data.relationships.owned_by.data.id" has the same value as "service_account_user.data.id" - @team:DataDog/credentials-management @team:DataDog/team-aaa-identity + @team:DataDog/credential-management @team:DataDog/team-aaa-identity Scenario: Delete an application key for this service account returns "No Content" response Given there is a valid "service_account_user" in the system And there is a valid "service_account_application_key" for "service_account_user" @@ -70,7 +70,7 @@ Feature: Service Accounts When the request is sent Then the response status is 204 No Content - @generated @skip @team:DataDog/credentials-management @team:DataDog/team-aaa-identity + @generated @skip @team:DataDog/credential-management @team:DataDog/team-aaa-identity Scenario: Delete an application key for this service account returns "Not Found" response Given new "DeleteServiceAccountApplicationKey" request And request contains "service_account_id" parameter from "REPLACE.ME" @@ -78,7 +78,7 @@ Feature: Service Accounts When the request is sent Then the response status is 404 Not Found - @generated @skip @team:DataDog/credentials-management @team:DataDog/team-aaa-identity + @generated @skip @team:DataDog/credential-management @team:DataDog/team-aaa-identity Scenario: Edit an application key for this service account returns "Bad Request" response Given new "UpdateServiceAccountApplicationKey" request And request contains "service_account_id" parameter from "REPLACE.ME" @@ -87,7 +87,7 @@ Feature: Service Accounts When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/credentials-management @team:DataDog/team-aaa-identity + @generated @skip @team:DataDog/credential-management @team:DataDog/team-aaa-identity Scenario: Edit an application key for this service account returns "Not Found" response Given new "UpdateServiceAccountApplicationKey" request And request contains "service_account_id" parameter from "REPLACE.ME" @@ -96,7 +96,7 @@ Feature: Service Accounts When the request is sent Then the response status is 404 Not Found - @team:DataDog/credentials-management @team:DataDog/team-aaa-identity + @team:DataDog/credential-management @team:DataDog/team-aaa-identity Scenario: Edit an application key for this service account returns "OK" response Given there is a valid "service_account_user" in the system And there is a valid "service_account_application_key" for "service_account_user" @@ -110,7 +110,7 @@ Feature: Service Accounts And the response "data.type" is equal to "application_keys" And the response "data.id" is equal to "{{ service_account_application_key.data.id }}" - @generated @skip @team:DataDog/credentials-management @team:DataDog/team-aaa-identity + @generated @skip @team:DataDog/credential-management @team:DataDog/team-aaa-identity Scenario: Get one application key for this service account returns "Not Found" response Given new "GetServiceAccountApplicationKey" request And request contains "service_account_id" parameter from "REPLACE.ME" @@ -118,7 +118,7 @@ Feature: Service Accounts When the request is sent Then the response status is 404 Not Found - @team:DataDog/credentials-management @team:DataDog/team-aaa-identity + @team:DataDog/credential-management @team:DataDog/team-aaa-identity Scenario: Get one application key for this service account returns "OK" response Given there is a valid "service_account_user" in the system And there is a valid "service_account_application_key" for "service_account_user" @@ -131,21 +131,21 @@ Feature: Service Accounts And the response "data.type" is equal to "application_keys" And the response "data.id" is equal to "{{ service_account_application_key.data.id }}" - @generated @skip @team:DataDog/credentials-management @team:DataDog/team-aaa-identity + @generated @skip @team:DataDog/credential-management @team:DataDog/team-aaa-identity Scenario: List application keys for this service account returns "Bad Request" response Given new "ListServiceAccountApplicationKeys" request And request contains "service_account_id" parameter from "REPLACE.ME" When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/credentials-management @team:DataDog/team-aaa-identity + @generated @skip @team:DataDog/credential-management @team:DataDog/team-aaa-identity Scenario: List application keys for this service account returns "Not Found" response Given new "ListServiceAccountApplicationKeys" request And request contains "service_account_id" parameter from "REPLACE.ME" When the request is sent Then the response status is 404 Not Found - @team:DataDog/credentials-management @team:DataDog/team-aaa-identity + @team:DataDog/credential-management @team:DataDog/team-aaa-identity Scenario: List application keys for this service account returns "OK" response Given there is a valid "service_account_user" in the system And new "ListServiceAccountApplicationKeys" request diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 67596e3589..c19cdf5452 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -6356,6 +6356,47 @@ "type": "safe" } }, + "SearchWidgets": { + "tag": "Widgets", + "undo": { + "type": "safe" + } + }, + "CreateWidget": { + "tag": "Widgets", + "undo": { + "operationId": "DeleteWidget", + "parameters": [ + { + "name": "experience_type", + "source": "experience_type" + }, + { + "name": "uuid", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteWidget": { + "tag": "Widgets", + "undo": { + "type": "idempotent" + } + }, + "GetWidget": { + "tag": "Widgets", + "undo": { + "type": "safe" + } + }, + "UpdateWidget": { + "tag": "Widgets", + "undo": { + "type": "safe" + } + }, "CreateWorkflow": { "tag": "Workflow Automation", "undo": { diff --git a/tests/v2/features/widgets.feature b/tests/v2/features/widgets.feature new file mode 100644 index 0000000000..54b0157115 --- /dev/null +++ b/tests/v2/features/widgets.feature @@ -0,0 +1,115 @@ +@endpoint(widgets) @endpoint(widgets-v2) +Feature: Widgets + Create, read, update, and delete saved widgets. Widgets are reusable + visualization components stored independently from any dashboard or + notebook, partitioned by experience type and identified by a UUID. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "Widgets" API + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Create a widget returns "Bad Request" response + Given new "CreateWidget" request + And request contains "experience_type" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"definition": {"title": "My Widget", "type": "bar_chart"}, "tags": []}, "type": "widgets"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Create a widget returns "OK" response + Given new "CreateWidget" request + And request contains "experience_type" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"definition": {"title": "My Widget", "type": "bar_chart"}, "tags": []}, "type": "widgets"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Delete a widget returns "Bad Request" response + Given new "DeleteWidget" request + And request contains "experience_type" parameter from "REPLACE.ME" + And request contains "uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Delete a widget returns "No Content" response + Given new "DeleteWidget" request + And request contains "experience_type" parameter from "REPLACE.ME" + And request contains "uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Delete a widget returns "Not Found" response + Given new "DeleteWidget" request + And request contains "experience_type" parameter from "REPLACE.ME" + And request contains "uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Get a widget returns "Bad Request" response + Given new "GetWidget" request + And request contains "experience_type" parameter from "REPLACE.ME" + And request contains "uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Get a widget returns "Not Found" response + Given new "GetWidget" request + And request contains "experience_type" parameter from "REPLACE.ME" + And request contains "uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Get a widget returns "OK" response + Given new "GetWidget" request + And request contains "experience_type" parameter from "REPLACE.ME" + And request contains "uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Search widgets returns "Bad Request" response + Given new "SearchWidgets" request + And request contains "experience_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Search widgets returns "OK" response + Given new "SearchWidgets" request + And request contains "experience_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Update a widget returns "Bad Request" response + Given new "UpdateWidget" request + And request contains "experience_type" parameter from "REPLACE.ME" + And request contains "uuid" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"definition": {"title": "My Widget", "type": "bar_chart"}, "tags": []}, "type": "widgets"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Update a widget returns "Not Found" response + Given new "UpdateWidget" request + And request contains "experience_type" parameter from "REPLACE.ME" + And request contains "uuid" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"definition": {"title": "My Widget", "type": "bar_chart"}, "tags": []}, "type": "widgets"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Update a widget returns "OK" response + Given new "UpdateWidget" request + And request contains "experience_type" parameter from "REPLACE.ME" + And request contains "uuid" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"definition": {"title": "My Widget", "type": "bar_chart"}, "tags": []}, "type": "widgets"}} + When the request is sent + Then the response status is 200 OK