diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index f45d9a1cc953..fa9e4f021584 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: @@ -45795,6 +45830,13 @@ components: description: The unique identifier for this component. Used in other parts of the pipeline to reference this component (for example, as the `input` to downstream components). example: splunk-hec-source type: string + store_hec_token: + default: false + description: |- + If `true`, the HEC token is stored in the event's metadata and made available to the Enrichment Table + processor and the `splunk_hec` destination for routing or enrichment based on the token. Defaults to `false`. + example: true + type: boolean tls: $ref: "#/components/schemas/ObservabilityPipelineTls" type: @@ -71675,6 +71717,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 +71883,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 +110140,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 +111312,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/examples/v2/widgets/CreateWidget.ts b/examples/v2/widgets/CreateWidget.ts new file mode 100644 index 000000000000..fca2cd11e170 --- /dev/null +++ b/examples/v2/widgets/CreateWidget.ts @@ -0,0 +1,33 @@ +/** + * Create a widget returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +const apiInstance = new v2.WidgetsApi(configuration); + +const params: v2.WidgetsApiCreateWidgetRequest = { + body: { + data: { + attributes: { + definition: { + title: "My Widget", + type: "bar_chart", + }, + tags: [], + }, + type: "widgets", + }, + }, + experienceType: "ccm_reports", +}; + +apiInstance + .createWidget(params) + .then((data: v2.WidgetResponse) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/widgets/DeleteWidget.ts b/examples/v2/widgets/DeleteWidget.ts new file mode 100644 index 000000000000..876e8072c8c6 --- /dev/null +++ b/examples/v2/widgets/DeleteWidget.ts @@ -0,0 +1,22 @@ +/** + * Delete a widget returns "No Content" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +const apiInstance = new v2.WidgetsApi(configuration); + +const params: v2.WidgetsApiDeleteWidgetRequest = { + experienceType: "ccm_reports", + uuid: "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d", +}; + +apiInstance + .deleteWidget(params) + .then((data: any) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/widgets/GetWidget.ts b/examples/v2/widgets/GetWidget.ts new file mode 100644 index 000000000000..67ba6df36f7f --- /dev/null +++ b/examples/v2/widgets/GetWidget.ts @@ -0,0 +1,22 @@ +/** + * Get a widget returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +const apiInstance = new v2.WidgetsApi(configuration); + +const params: v2.WidgetsApiGetWidgetRequest = { + experienceType: "ccm_reports", + uuid: "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d", +}; + +apiInstance + .getWidget(params) + .then((data: v2.WidgetResponse) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/widgets/SearchWidgets.ts b/examples/v2/widgets/SearchWidgets.ts new file mode 100644 index 000000000000..3ef86a402a23 --- /dev/null +++ b/examples/v2/widgets/SearchWidgets.ts @@ -0,0 +1,21 @@ +/** + * Search widgets returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +const apiInstance = new v2.WidgetsApi(configuration); + +const params: v2.WidgetsApiSearchWidgetsRequest = { + experienceType: "ccm_reports", +}; + +apiInstance + .searchWidgets(params) + .then((data: v2.WidgetListResponse) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/widgets/UpdateWidget.ts b/examples/v2/widgets/UpdateWidget.ts new file mode 100644 index 000000000000..ce47306b0bee --- /dev/null +++ b/examples/v2/widgets/UpdateWidget.ts @@ -0,0 +1,34 @@ +/** + * Update a widget returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +const apiInstance = new v2.WidgetsApi(configuration); + +const params: v2.WidgetsApiUpdateWidgetRequest = { + body: { + data: { + attributes: { + definition: { + title: "My Widget", + type: "bar_chart", + }, + tags: [], + }, + type: "widgets", + }, + }, + experienceType: "ccm_reports", + uuid: "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d", +}; + +apiInstance + .updateWidget(params) + .then((data: v2.WidgetResponse) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/features/support/scenarios_model_mapping.ts b/features/support/scenarios_model_mapping.ts index 777bb863a27b..712504cb93a5 100644 --- a/features/support/scenarios_model_mapping.ts +++ b/features/support/scenarios_model_mapping.ts @@ -11751,6 +11751,93 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = { }, "operationResponseType": "PermissionsResponse", }, + "v2.SearchWidgets": { + "experienceType": { + "type": "WidgetExperienceType", + "format": "", + }, + "filterWidgetType": { + "type": "WidgetType", + "format": "", + }, + "filterCreatorHandle": { + "type": "string", + "format": "", + }, + "filterIsFavorited": { + "type": "boolean", + "format": "", + }, + "filterTitle": { + "type": "string", + "format": "", + }, + "filterTags": { + "type": "string", + "format": "", + }, + "sort": { + "type": "string", + "format": "", + }, + "pageNumber": { + "type": "number", + "format": "", + }, + "pageSize": { + "type": "number", + "format": "", + }, + "operationResponseType": "WidgetListResponse", + }, + "v2.CreateWidget": { + "experienceType": { + "type": "WidgetExperienceType", + "format": "", + }, + "body": { + "type": "CreateOrUpdateWidgetRequest", + "format": "", + }, + "operationResponseType": "WidgetResponse", + }, + "v2.GetWidget": { + "experienceType": { + "type": "WidgetExperienceType", + "format": "", + }, + "uuid": { + "type": "string", + "format": "uuid", + }, + "operationResponseType": "WidgetResponse", + }, + "v2.UpdateWidget": { + "experienceType": { + "type": "WidgetExperienceType", + "format": "", + }, + "uuid": { + "type": "string", + "format": "uuid", + }, + "body": { + "type": "CreateOrUpdateWidgetRequest", + "format": "", + }, + "operationResponseType": "WidgetResponse", + }, + "v2.DeleteWidget": { + "experienceType": { + "type": "WidgetExperienceType", + "format": "", + }, + "uuid": { + "type": "string", + "format": "uuid", + }, + "operationResponseType": "{}", + }, "v2.CreateWorkflow": { "body": { "type": "CreateWorkflowRequest", diff --git a/features/v2/undo.json b/features/v2/undo.json index 67596e3589cb..c19cdf5452a0 100644 --- a/features/v2/undo.json +++ b/features/v2/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/features/v2/widgets.feature b/features/v2/widgets.feature new file mode 100644 index 000000000000..54b015711565 --- /dev/null +++ b/features/v2/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 diff --git a/packages/datadog-api-client-v2/apis/WidgetsApi.ts b/packages/datadog-api-client-v2/apis/WidgetsApi.ts new file mode 100644 index 000000000000..4693abbd9a60 --- /dev/null +++ b/packages/datadog-api-client-v2/apis/WidgetsApi.ts @@ -0,0 +1,850 @@ +import { + BaseAPIRequestFactory, + RequiredError, +} from "../../datadog-api-client-common/baseapi"; +import { + Configuration, + applySecurityAuthentication, +} from "../../datadog-api-client-common/configuration"; +import { + RequestContext, + HttpMethod, + ResponseContext, +} from "../../datadog-api-client-common/http/http"; + +import { logger } from "../../../logger"; +import { ObjectSerializer } from "../models/ObjectSerializer"; +import { ApiException } from "../../datadog-api-client-common/exception"; + +import { APIErrorResponse } from "../models/APIErrorResponse"; +import { CreateOrUpdateWidgetRequest } from "../models/CreateOrUpdateWidgetRequest"; +import { WidgetExperienceType } from "../models/WidgetExperienceType"; +import { WidgetListResponse } from "../models/WidgetListResponse"; +import { WidgetResponse } from "../models/WidgetResponse"; +import { WidgetType } from "../models/WidgetType"; + +export class WidgetsApiRequestFactory extends BaseAPIRequestFactory { + public async createWidget( + experienceType: WidgetExperienceType, + body: CreateOrUpdateWidgetRequest, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'experienceType' is not null or undefined + if (experienceType === null || experienceType === undefined) { + throw new RequiredError("experienceType", "createWidget"); + } + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "createWidget"); + } + + // Path Params + const localVarPath = "/api/v2/widgets/{experience_type}".replace( + "{experience_type}", + encodeURIComponent(String(experienceType)) + ); + + // Make Request Context + const requestContext = _config + .getServer("v2.WidgetsApi.createWidget") + .makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json", + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(body, "CreateOrUpdateWidgetRequest", ""), + contentType + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async deleteWidget( + experienceType: WidgetExperienceType, + uuid: string, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'experienceType' is not null or undefined + if (experienceType === null || experienceType === undefined) { + throw new RequiredError("experienceType", "deleteWidget"); + } + + // verify required parameter 'uuid' is not null or undefined + if (uuid === null || uuid === undefined) { + throw new RequiredError("uuid", "deleteWidget"); + } + + // Path Params + const localVarPath = "/api/v2/widgets/{experience_type}/{uuid}" + .replace("{experience_type}", encodeURIComponent(String(experienceType))) + .replace("{uuid}", encodeURIComponent(String(uuid))); + + // Make Request Context + const requestContext = _config + .getServer("v2.WidgetsApi.deleteWidget") + .makeRequestContext(localVarPath, HttpMethod.DELETE); + requestContext.setHeaderParam("Accept", "*/*"); + requestContext.setHttpConfig(_config.httpConfig); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async getWidget( + experienceType: WidgetExperienceType, + uuid: string, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'experienceType' is not null or undefined + if (experienceType === null || experienceType === undefined) { + throw new RequiredError("experienceType", "getWidget"); + } + + // verify required parameter 'uuid' is not null or undefined + if (uuid === null || uuid === undefined) { + throw new RequiredError("uuid", "getWidget"); + } + + // Path Params + const localVarPath = "/api/v2/widgets/{experience_type}/{uuid}" + .replace("{experience_type}", encodeURIComponent(String(experienceType))) + .replace("{uuid}", encodeURIComponent(String(uuid))); + + // Make Request Context + const requestContext = _config + .getServer("v2.WidgetsApi.getWidget") + .makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async searchWidgets( + experienceType: WidgetExperienceType, + filterWidgetType?: WidgetType, + filterCreatorHandle?: string, + filterIsFavorited?: boolean, + filterTitle?: string, + filterTags?: string, + sort?: string, + pageNumber?: number, + pageSize?: number, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'experienceType' is not null or undefined + if (experienceType === null || experienceType === undefined) { + throw new RequiredError("experienceType", "searchWidgets"); + } + + // Path Params + const localVarPath = "/api/v2/widgets/{experience_type}".replace( + "{experience_type}", + encodeURIComponent(String(experienceType)) + ); + + // Make Request Context + const requestContext = _config + .getServer("v2.WidgetsApi.searchWidgets") + .makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Query Params + if (filterWidgetType !== undefined) { + requestContext.setQueryParam( + "filter[widgetType]", + ObjectSerializer.serialize(filterWidgetType, "WidgetType", ""), + "" + ); + } + if (filterCreatorHandle !== undefined) { + requestContext.setQueryParam( + "filter[creatorHandle]", + ObjectSerializer.serialize(filterCreatorHandle, "string", ""), + "" + ); + } + if (filterIsFavorited !== undefined) { + requestContext.setQueryParam( + "filter[isFavorited]", + ObjectSerializer.serialize(filterIsFavorited, "boolean", ""), + "" + ); + } + if (filterTitle !== undefined) { + requestContext.setQueryParam( + "filter[title]", + ObjectSerializer.serialize(filterTitle, "string", ""), + "" + ); + } + if (filterTags !== undefined) { + requestContext.setQueryParam( + "filter[tags]", + ObjectSerializer.serialize(filterTags, "string", ""), + "" + ); + } + if (sort !== undefined) { + requestContext.setQueryParam( + "sort", + ObjectSerializer.serialize(sort, "string", ""), + "" + ); + } + if (pageNumber !== undefined) { + requestContext.setQueryParam( + "page[number]", + ObjectSerializer.serialize(pageNumber, "number", ""), + "" + ); + } + if (pageSize !== undefined) { + requestContext.setQueryParam( + "page[size]", + ObjectSerializer.serialize(pageSize, "number", ""), + "" + ); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async updateWidget( + experienceType: WidgetExperienceType, + uuid: string, + body: CreateOrUpdateWidgetRequest, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'experienceType' is not null or undefined + if (experienceType === null || experienceType === undefined) { + throw new RequiredError("experienceType", "updateWidget"); + } + + // verify required parameter 'uuid' is not null or undefined + if (uuid === null || uuid === undefined) { + throw new RequiredError("uuid", "updateWidget"); + } + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "updateWidget"); + } + + // Path Params + const localVarPath = "/api/v2/widgets/{experience_type}/{uuid}" + .replace("{experience_type}", encodeURIComponent(String(experienceType))) + .replace("{uuid}", encodeURIComponent(String(uuid))); + + // Make Request Context + const requestContext = _config + .getServer("v2.WidgetsApi.updateWidget") + .makeRequestContext(localVarPath, HttpMethod.PUT); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json", + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(body, "CreateOrUpdateWidgetRequest", ""), + contentType + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } +} + +export class WidgetsApiResponseProcessor { + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to createWidget + * @throws ApiException if the response code was not in [200, 299] + */ + public async createWidget( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 200) { + const body: WidgetResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "WidgetResponse" + ) as WidgetResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 429 + ) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: WidgetResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "WidgetResponse", + "" + ) as WidgetResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to deleteWidget + * @throws ApiException if the response code was not in [200, 299] + */ + public async deleteWidget(response: ResponseContext): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 204) { + return; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 || + response.httpStatusCode === 429 + ) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getWidget + * @throws ApiException if the response code was not in [200, 299] + */ + public async getWidget(response: ResponseContext): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 200) { + const body: WidgetResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "WidgetResponse" + ) as WidgetResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 || + response.httpStatusCode === 429 + ) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: WidgetResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "WidgetResponse", + "" + ) as WidgetResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to searchWidgets + * @throws ApiException if the response code was not in [200, 299] + */ + public async searchWidgets( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 200) { + const body: WidgetListResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "WidgetListResponse" + ) as WidgetListResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 429 + ) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: WidgetListResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "WidgetListResponse", + "" + ) as WidgetListResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to updateWidget + * @throws ApiException if the response code was not in [200, 299] + */ + public async updateWidget( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 200) { + const body: WidgetResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "WidgetResponse" + ) as WidgetResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 || + response.httpStatusCode === 429 + ) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: WidgetResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "WidgetResponse", + "" + ) as WidgetResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } +} + +export interface WidgetsApiCreateWidgetRequest { + /** + * The experience type for the widget. + * @type WidgetExperienceType + */ + experienceType: WidgetExperienceType; + /** + * Widget request body. + * @type CreateOrUpdateWidgetRequest + */ + body: CreateOrUpdateWidgetRequest; +} + +export interface WidgetsApiDeleteWidgetRequest { + /** + * The experience type for the widget. + * @type WidgetExperienceType + */ + experienceType: WidgetExperienceType; + /** + * The UUID of the widget. + * @type string + */ + uuid: string; +} + +export interface WidgetsApiGetWidgetRequest { + /** + * The experience type for the widget. + * @type WidgetExperienceType + */ + experienceType: WidgetExperienceType; + /** + * The UUID of the widget. + * @type string + */ + uuid: string; +} + +export interface WidgetsApiSearchWidgetsRequest { + /** + * The experience type for the widget. + * @type WidgetExperienceType + */ + experienceType: WidgetExperienceType; + /** + * Filter widgets by widget type. + * @type WidgetType + */ + filterWidgetType?: WidgetType; + /** + * Filter widgets by the email handle of the creator. + * @type string + */ + filterCreatorHandle?: string; + /** + * Filter to only widgets favorited by the current user. + * @type boolean + */ + filterIsFavorited?: boolean; + /** + * Filter widgets by title (substring match). + * @type string + */ + filterTitle?: string; + /** + * Filter widgets by tags. Format as bracket-delimited CSV, e.g. `[tag1,tag2]`. + * @type string + */ + filterTags?: string; + /** + * Sort field for the results. Prefix with `-` for descending order. + * Allowed values: `title`, `created_at`, `modified_at`. + * @type string + */ + sort?: string; + /** + * Page number for pagination (0-indexed). + * @type number + */ + pageNumber?: number; + /** + * Number of widgets per page. + * @type number + */ + pageSize?: number; +} + +export interface WidgetsApiUpdateWidgetRequest { + /** + * The experience type for the widget. + * @type WidgetExperienceType + */ + experienceType: WidgetExperienceType; + /** + * The UUID of the widget. + * @type string + */ + uuid: string; + /** + * Widget request body. + * @type CreateOrUpdateWidgetRequest + */ + body: CreateOrUpdateWidgetRequest; +} + +export class WidgetsApi { + private requestFactory: WidgetsApiRequestFactory; + private responseProcessor: WidgetsApiResponseProcessor; + private configuration: Configuration; + + public constructor( + configuration: Configuration, + requestFactory?: WidgetsApiRequestFactory, + responseProcessor?: WidgetsApiResponseProcessor + ) { + this.configuration = configuration; + this.requestFactory = + requestFactory || new WidgetsApiRequestFactory(configuration); + this.responseProcessor = + responseProcessor || new WidgetsApiResponseProcessor(); + } + + /** + * Create a new widget for a given experience type. + * @param param The request object + */ + public createWidget( + param: WidgetsApiCreateWidgetRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.createWidget( + param.experienceType, + param.body, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.createWidget(responseContext); + }); + }); + } + + /** + * Soft-delete a widget by its UUID for a given experience type. + * @param param The request object + */ + public deleteWidget( + param: WidgetsApiDeleteWidgetRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.deleteWidget( + param.experienceType, + param.uuid, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.deleteWidget(responseContext); + }); + }); + } + + /** + * Retrieve a widget by its UUID for a given experience type. + * @param param The request object + */ + public getWidget( + param: WidgetsApiGetWidgetRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.getWidget( + param.experienceType, + param.uuid, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.getWidget(responseContext); + }); + }); + } + + /** + * 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 param The request object + */ + public searchWidgets( + param: WidgetsApiSearchWidgetsRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.searchWidgets( + param.experienceType, + param.filterWidgetType, + param.filterCreatorHandle, + param.filterIsFavorited, + param.filterTitle, + param.filterTags, + param.sort, + param.pageNumber, + param.pageSize, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.searchWidgets(responseContext); + }); + }); + } + + /** + * Update a widget by its UUID for a given experience type. This performs a full replacement of the widget definition. + * @param param The request object + */ + public updateWidget( + param: WidgetsApiUpdateWidgetRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.updateWidget( + param.experienceType, + param.uuid, + param.body, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.updateWidget(responseContext); + }); + }); + } +} diff --git a/packages/datadog-api-client-v2/index.ts b/packages/datadog-api-client-v2/index.ts index 5f7dc60a3853..30c44313af3d 100644 --- a/packages/datadog-api-client-v2/index.ts +++ b/packages/datadog-api-client-v2/index.ts @@ -1227,6 +1227,15 @@ export { UsersApi, } from "./apis/UsersApi"; +export { + WidgetsApiCreateWidgetRequest, + WidgetsApiDeleteWidgetRequest, + WidgetsApiGetWidgetRequest, + WidgetsApiSearchWidgetsRequest, + WidgetsApiUpdateWidgetRequest, + WidgetsApi, +} from "./apis/WidgetsApi"; + export { WorkflowAutomationApiCancelWorkflowInstanceRequest, WorkflowAutomationApiCreateWorkflowRequest, @@ -2152,6 +2161,9 @@ export { CreateOnCallNotificationRuleRequestData } from "./models/CreateOnCallNo export { CreateOpenAPIResponse } from "./models/CreateOpenAPIResponse"; export { CreateOpenAPIResponseAttributes } from "./models/CreateOpenAPIResponseAttributes"; export { CreateOpenAPIResponseData } from "./models/CreateOpenAPIResponseData"; +export { CreateOrUpdateWidgetRequest } from "./models/CreateOrUpdateWidgetRequest"; +export { CreateOrUpdateWidgetRequestAttributes } from "./models/CreateOrUpdateWidgetRequestAttributes"; +export { CreateOrUpdateWidgetRequestData } from "./models/CreateOrUpdateWidgetRequestData"; export { CreatePageRequest } from "./models/CreatePageRequest"; export { CreatePageRequestData } from "./models/CreatePageRequestData"; export { CreatePageRequestDataAttributes } from "./models/CreatePageRequestDataAttributes"; @@ -5869,7 +5881,20 @@ export { WatcherData } from "./models/WatcherData"; export { WatcherDataAttributes } from "./models/WatcherDataAttributes"; export { WatcherDataType } from "./models/WatcherDataType"; export { Weekday } from "./models/Weekday"; +export { WidgetAttributes } from "./models/WidgetAttributes"; +export { WidgetData } from "./models/WidgetData"; +export { WidgetDefinition } from "./models/WidgetDefinition"; +export { WidgetExperienceType } from "./models/WidgetExperienceType"; +export { WidgetIncludedUser } from "./models/WidgetIncludedUser"; +export { WidgetIncludedUserAttributes } from "./models/WidgetIncludedUserAttributes"; +export { WidgetListResponse } from "./models/WidgetListResponse"; export { WidgetLiveSpan } from "./models/WidgetLiveSpan"; +export { WidgetRelationshipData } from "./models/WidgetRelationshipData"; +export { WidgetRelationshipItem } from "./models/WidgetRelationshipItem"; +export { WidgetRelationships } from "./models/WidgetRelationships"; +export { WidgetResponse } from "./models/WidgetResponse"; +export { WidgetSearchMeta } from "./models/WidgetSearchMeta"; +export { WidgetType } from "./models/WidgetType"; export { WorkflowData } from "./models/WorkflowData"; export { WorkflowDataAttributes } from "./models/WorkflowDataAttributes"; export { WorkflowDataRelationships } from "./models/WorkflowDataRelationships"; diff --git a/packages/datadog-api-client-v2/models/CreateOrUpdateWidgetRequest.ts b/packages/datadog-api-client-v2/models/CreateOrUpdateWidgetRequest.ts new file mode 100644 index 000000000000..10d20619deeb --- /dev/null +++ b/packages/datadog-api-client-v2/models/CreateOrUpdateWidgetRequest.ts @@ -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 2020-Present Datadog, Inc. + */ +import { CreateOrUpdateWidgetRequestData } from "./CreateOrUpdateWidgetRequestData"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Request body for creating or updating a widget. + */ +export class CreateOrUpdateWidgetRequest { + /** + * Data for creating or updating a widget. + */ + "data": CreateOrUpdateWidgetRequestData; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "CreateOrUpdateWidgetRequestData", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return CreateOrUpdateWidgetRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/CreateOrUpdateWidgetRequestAttributes.ts b/packages/datadog-api-client-v2/models/CreateOrUpdateWidgetRequestAttributes.ts new file mode 100644 index 000000000000..706ce73aeb32 --- /dev/null +++ b/packages/datadog-api-client-v2/models/CreateOrUpdateWidgetRequestAttributes.ts @@ -0,0 +1,62 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { WidgetDefinition } from "./WidgetDefinition"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Attributes for creating or updating a widget. + */ +export class CreateOrUpdateWidgetRequestAttributes { + /** + * The definition of a widget, including its type and configuration. + */ + "definition": WidgetDefinition; + /** + * User-defined tags for organizing the widget. + */ + "tags"?: Array; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + definition: { + baseName: "definition", + type: "WidgetDefinition", + required: true, + }, + tags: { + baseName: "tags", + type: "Array", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return CreateOrUpdateWidgetRequestAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/CreateOrUpdateWidgetRequestData.ts b/packages/datadog-api-client-v2/models/CreateOrUpdateWidgetRequestData.ts new file mode 100644 index 000000000000..285f08562178 --- /dev/null +++ b/packages/datadog-api-client-v2/models/CreateOrUpdateWidgetRequestData.ts @@ -0,0 +1,63 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { CreateOrUpdateWidgetRequestAttributes } from "./CreateOrUpdateWidgetRequestAttributes"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Data for creating or updating a widget. + */ +export class CreateOrUpdateWidgetRequestData { + /** + * Attributes for creating or updating a widget. + */ + "attributes": CreateOrUpdateWidgetRequestAttributes; + /** + * Widgets resource type. + */ + "type": string; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "CreateOrUpdateWidgetRequestAttributes", + required: true, + }, + type: { + baseName: "type", + type: "string", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return CreateOrUpdateWidgetRequestData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/ObjectSerializer.ts b/packages/datadog-api-client-v2/models/ObjectSerializer.ts index c092ffd784f2..8a3bc781a918 100644 --- a/packages/datadog-api-client-v2/models/ObjectSerializer.ts +++ b/packages/datadog-api-client-v2/models/ObjectSerializer.ts @@ -700,6 +700,9 @@ import { CreateOnCallNotificationRuleRequestData } from "./CreateOnCallNotificat import { CreateOpenAPIResponse } from "./CreateOpenAPIResponse"; import { CreateOpenAPIResponseAttributes } from "./CreateOpenAPIResponseAttributes"; import { CreateOpenAPIResponseData } from "./CreateOpenAPIResponseData"; +import { CreateOrUpdateWidgetRequest } from "./CreateOrUpdateWidgetRequest"; +import { CreateOrUpdateWidgetRequestAttributes } from "./CreateOrUpdateWidgetRequestAttributes"; +import { CreateOrUpdateWidgetRequestData } from "./CreateOrUpdateWidgetRequestData"; import { CreatePageRequest } from "./CreatePageRequest"; import { CreatePageRequestData } from "./CreatePageRequestData"; import { CreatePageRequestDataAttributes } from "./CreatePageRequestDataAttributes"; @@ -3512,6 +3515,17 @@ import { WatchDataAttributes } from "./WatchDataAttributes"; import { WatcherArray } from "./WatcherArray"; import { WatcherData } from "./WatcherData"; import { WatcherDataAttributes } from "./WatcherDataAttributes"; +import { WidgetAttributes } from "./WidgetAttributes"; +import { WidgetData } from "./WidgetData"; +import { WidgetDefinition } from "./WidgetDefinition"; +import { WidgetIncludedUser } from "./WidgetIncludedUser"; +import { WidgetIncludedUserAttributes } from "./WidgetIncludedUserAttributes"; +import { WidgetListResponse } from "./WidgetListResponse"; +import { WidgetRelationshipData } from "./WidgetRelationshipData"; +import { WidgetRelationshipItem } from "./WidgetRelationshipItem"; +import { WidgetRelationships } from "./WidgetRelationships"; +import { WidgetResponse } from "./WidgetResponse"; +import { WidgetSearchMeta } from "./WidgetSearchMeta"; import { WorkflowData } from "./WorkflowData"; import { WorkflowDataAttributes } from "./WorkflowDataAttributes"; import { WorkflowDataRelationships } from "./WorkflowDataRelationships"; @@ -5587,6 +5601,12 @@ const enumsMap: { [key: string]: any[] } = { "saturday", "sunday", ], + WidgetExperienceType: [ + "ccm_reports", + "logs_reports", + "csv_reports", + "product_analytics", + ], WidgetLiveSpan: [ "1m", "5m", @@ -5604,6 +5624,23 @@ const enumsMap: { [key: string]: any[] } = { "1y", "alert", ], + WidgetType: [ + "bar_chart", + "change", + "cloud_cost_summary", + "cohort", + "funnel", + "geomap", + "list_stream", + "query_table", + "query_value", + "retention_curve", + "sankey", + "sunburst", + "timeseries", + "toplist", + "treemap", + ], WorkflowDataType: ["workflows"], WorkflowUserRelationshipType: ["users"], }; @@ -6442,6 +6479,9 @@ const typeMap: { [index: string]: any } = { CreateOpenAPIResponse: CreateOpenAPIResponse, CreateOpenAPIResponseAttributes: CreateOpenAPIResponseAttributes, CreateOpenAPIResponseData: CreateOpenAPIResponseData, + CreateOrUpdateWidgetRequest: CreateOrUpdateWidgetRequest, + CreateOrUpdateWidgetRequestAttributes: CreateOrUpdateWidgetRequestAttributes, + CreateOrUpdateWidgetRequestData: CreateOrUpdateWidgetRequestData, CreatePageRequest: CreatePageRequest, CreatePageRequestData: CreatePageRequestData, CreatePageRequestDataAttributes: CreatePageRequestDataAttributes, @@ -9830,6 +9870,17 @@ const typeMap: { [index: string]: any } = { WatcherArray: WatcherArray, WatcherData: WatcherData, WatcherDataAttributes: WatcherDataAttributes, + WidgetAttributes: WidgetAttributes, + WidgetData: WidgetData, + WidgetDefinition: WidgetDefinition, + WidgetIncludedUser: WidgetIncludedUser, + WidgetIncludedUserAttributes: WidgetIncludedUserAttributes, + WidgetListResponse: WidgetListResponse, + WidgetRelationshipData: WidgetRelationshipData, + WidgetRelationshipItem: WidgetRelationshipItem, + WidgetRelationships: WidgetRelationships, + WidgetResponse: WidgetResponse, + WidgetSearchMeta: WidgetSearchMeta, WorkflowData: WorkflowData, WorkflowDataAttributes: WorkflowDataAttributes, WorkflowDataRelationships: WorkflowDataRelationships, diff --git a/packages/datadog-api-client-v2/models/ObservabilityPipelineSplunkHecSource.ts b/packages/datadog-api-client-v2/models/ObservabilityPipelineSplunkHecSource.ts index da46f3a7d485..2a98e221c5b5 100644 --- a/packages/datadog-api-client-v2/models/ObservabilityPipelineSplunkHecSource.ts +++ b/packages/datadog-api-client-v2/models/ObservabilityPipelineSplunkHecSource.ts @@ -22,6 +22,11 @@ export class ObservabilityPipelineSplunkHecSource { * The unique identifier for this component. Used in other parts of the pipeline to reference this component (for example, as the `input` to downstream components). */ "id": string; + /** + * If `true`, the HEC token is stored in the event's metadata and made available to the Enrichment Table + * processor and the `splunk_hec` destination for routing or enrichment based on the token. Defaults to `false`. + */ + "storeHecToken"?: boolean; /** * Configuration for enabling TLS encryption between the pipeline component and external services. */ @@ -56,6 +61,10 @@ export class ObservabilityPipelineSplunkHecSource { type: "string", required: true, }, + storeHecToken: { + baseName: "store_hec_token", + type: "boolean", + }, tls: { baseName: "tls", type: "ObservabilityPipelineTls", diff --git a/packages/datadog-api-client-v2/models/WidgetAttributes.ts b/packages/datadog-api-client-v2/models/WidgetAttributes.ts new file mode 100644 index 000000000000..08c7a665c241 --- /dev/null +++ b/packages/datadog-api-client-v2/models/WidgetAttributes.ts @@ -0,0 +1,90 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { WidgetDefinition } from "./WidgetDefinition"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Attributes of a widget resource. + */ +export class WidgetAttributes { + /** + * ISO 8601 timestamp of when the widget was created. + */ + "createdAt": string; + /** + * The definition of a widget, including its type and configuration. + */ + "definition": WidgetDefinition; + /** + * Will be implemented soon. Currently always returns false. + */ + "isFavorited": boolean; + /** + * ISO 8601 timestamp of when the widget was last modified. + */ + "modifiedAt": string; + /** + * User-defined tags for organizing widgets. + */ + "tags": Array | null; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + createdAt: { + baseName: "created_at", + type: "string", + required: true, + }, + definition: { + baseName: "definition", + type: "WidgetDefinition", + required: true, + }, + isFavorited: { + baseName: "is_favorited", + type: "boolean", + required: true, + }, + modifiedAt: { + baseName: "modified_at", + type: "string", + required: true, + }, + tags: { + baseName: "tags", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return WidgetAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/WidgetData.ts b/packages/datadog-api-client-v2/models/WidgetData.ts new file mode 100644 index 000000000000..1383f5d356b1 --- /dev/null +++ b/packages/datadog-api-client-v2/models/WidgetData.ts @@ -0,0 +1,81 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { WidgetAttributes } from "./WidgetAttributes"; +import { WidgetRelationships } from "./WidgetRelationships"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * A widget resource object. + */ +export class WidgetData { + /** + * Attributes of a widget resource. + */ + "attributes": WidgetAttributes; + /** + * The unique identifier of the widget. + */ + "id": string; + /** + * Relationships of the widget resource. + */ + "relationships"?: WidgetRelationships; + /** + * Widgets resource type. + */ + "type": string; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "WidgetAttributes", + required: true, + }, + id: { + baseName: "id", + type: "string", + required: true, + }, + relationships: { + baseName: "relationships", + type: "WidgetRelationships", + }, + type: { + baseName: "type", + type: "string", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return WidgetData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/WidgetDefinition.ts b/packages/datadog-api-client-v2/models/WidgetDefinition.ts new file mode 100644 index 000000000000..f10dd2de3bf4 --- /dev/null +++ b/packages/datadog-api-client-v2/models/WidgetDefinition.ts @@ -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 2020-Present Datadog, Inc. + */ +import { WidgetType } from "./WidgetType"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * The definition of a widget, including its type and configuration. + */ +export class WidgetDefinition { + /** + * The display title of the widget. + */ + "title": string; + /** + * Widget types that are allowed to be stored as individual records. + * This is not a complete list of dashboard and notebook widget types. + */ + "type": WidgetType; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + title: { + baseName: "title", + type: "string", + required: true, + }, + type: { + baseName: "type", + type: "WidgetType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return WidgetDefinition.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/WidgetExperienceType.ts b/packages/datadog-api-client-v2/models/WidgetExperienceType.ts new file mode 100644 index 000000000000..17088146941d --- /dev/null +++ b/packages/datadog-api-client-v2/models/WidgetExperienceType.ts @@ -0,0 +1,22 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * Widget experience types that differentiate between the products using the specific widget. + */ + +export type WidgetExperienceType = + | typeof CCM_REPORTS + | typeof LOGS_REPORTS + | typeof CSV_REPORTS + | typeof PRODUCT_ANALYTICS + | UnparsedObject; +export const CCM_REPORTS = "ccm_reports"; +export const LOGS_REPORTS = "logs_reports"; +export const CSV_REPORTS = "csv_reports"; +export const PRODUCT_ANALYTICS = "product_analytics"; diff --git a/packages/datadog-api-client-v2/models/WidgetIncludedUser.ts b/packages/datadog-api-client-v2/models/WidgetIncludedUser.ts new file mode 100644 index 000000000000..5f656542b387 --- /dev/null +++ b/packages/datadog-api-client-v2/models/WidgetIncludedUser.ts @@ -0,0 +1,71 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { WidgetIncludedUserAttributes } from "./WidgetIncludedUserAttributes"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * A user resource included in the response. + */ +export class WidgetIncludedUser { + /** + * Attributes of an included user resource. + */ + "attributes"?: WidgetIncludedUserAttributes; + /** + * The unique identifier of the user. + */ + "id": string; + /** + * Users resource type. + */ + "type": string; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "WidgetIncludedUserAttributes", + }, + id: { + baseName: "id", + type: "string", + required: true, + }, + type: { + baseName: "type", + type: "string", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return WidgetIncludedUser.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/WidgetIncludedUserAttributes.ts b/packages/datadog-api-client-v2/models/WidgetIncludedUserAttributes.ts new file mode 100644 index 000000000000..49d4a59a5e9a --- /dev/null +++ b/packages/datadog-api-client-v2/models/WidgetIncludedUserAttributes.ts @@ -0,0 +1,60 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Attributes of an included user resource. + */ +export class WidgetIncludedUserAttributes { + /** + * The email handle of the user. + */ + "handle"?: string; + /** + * The display name of the user. + */ + "name"?: string; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + handle: { + baseName: "handle", + type: "string", + }, + name: { + baseName: "name", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return WidgetIncludedUserAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/WidgetListResponse.ts b/packages/datadog-api-client-v2/models/WidgetListResponse.ts new file mode 100644 index 000000000000..c89ae4abc862 --- /dev/null +++ b/packages/datadog-api-client-v2/models/WidgetListResponse.ts @@ -0,0 +1,72 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { WidgetData } from "./WidgetData"; +import { WidgetIncludedUser } from "./WidgetIncludedUser"; +import { WidgetSearchMeta } from "./WidgetSearchMeta"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Response containing a list of widgets. + */ +export class WidgetListResponse { + /** + * List of widget resources. + */ + "data": Array; + /** + * Array of user resources related to the widgets. + */ + "included"?: Array; + /** + * Metadata about the search results. + */ + "meta"?: WidgetSearchMeta; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "Array", + required: true, + }, + included: { + baseName: "included", + type: "Array", + }, + meta: { + baseName: "meta", + type: "WidgetSearchMeta", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return WidgetListResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/WidgetRelationshipData.ts b/packages/datadog-api-client-v2/models/WidgetRelationshipData.ts new file mode 100644 index 000000000000..ad69f3704eb8 --- /dev/null +++ b/packages/datadog-api-client-v2/models/WidgetRelationshipData.ts @@ -0,0 +1,62 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Relationship data referencing a user resource. + */ +export class WidgetRelationshipData { + /** + * The unique identifier of the user. + */ + "id": string; + /** + * Users resource type. + */ + "type": string; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + id: { + baseName: "id", + type: "string", + required: true, + }, + type: { + baseName: "type", + type: "string", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return WidgetRelationshipData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/WidgetRelationshipItem.ts b/packages/datadog-api-client-v2/models/WidgetRelationshipItem.ts new file mode 100644 index 000000000000..7f20e80c3786 --- /dev/null +++ b/packages/datadog-api-client-v2/models/WidgetRelationshipItem.ts @@ -0,0 +1,53 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { WidgetRelationshipData } from "./WidgetRelationshipData"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * A JSON:API relationship to a user. + */ +export class WidgetRelationshipItem { + /** + * Relationship data referencing a user resource. + */ + "data"?: WidgetRelationshipData; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "WidgetRelationshipData", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return WidgetRelationshipItem.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/WidgetRelationships.ts b/packages/datadog-api-client-v2/models/WidgetRelationships.ts new file mode 100644 index 000000000000..a8f4b23072f1 --- /dev/null +++ b/packages/datadog-api-client-v2/models/WidgetRelationships.ts @@ -0,0 +1,61 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { WidgetRelationshipItem } from "./WidgetRelationshipItem"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Relationships of the widget resource. + */ +export class WidgetRelationships { + /** + * A JSON:API relationship to a user. + */ + "createdBy"?: WidgetRelationshipItem; + /** + * A JSON:API relationship to a user. + */ + "modifiedBy"?: WidgetRelationshipItem; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + createdBy: { + baseName: "created_by", + type: "WidgetRelationshipItem", + }, + modifiedBy: { + baseName: "modified_by", + type: "WidgetRelationshipItem", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return WidgetRelationships.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/WidgetResponse.ts b/packages/datadog-api-client-v2/models/WidgetResponse.ts new file mode 100644 index 000000000000..b8feacaad577 --- /dev/null +++ b/packages/datadog-api-client-v2/models/WidgetResponse.ts @@ -0,0 +1,63 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { WidgetData } from "./WidgetData"; +import { WidgetIncludedUser } from "./WidgetIncludedUser"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Response containing a single widget. + */ +export class WidgetResponse { + /** + * A widget resource object. + */ + "data": WidgetData; + /** + * Array of user resources related to the widget. + */ + "included"?: Array; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "WidgetData", + required: true, + }, + included: { + baseName: "included", + type: "Array", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return WidgetResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/WidgetSearchMeta.ts b/packages/datadog-api-client-v2/models/WidgetSearchMeta.ts new file mode 100644 index 000000000000..92b1d4f18cf2 --- /dev/null +++ b/packages/datadog-api-client-v2/models/WidgetSearchMeta.ts @@ -0,0 +1,80 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Metadata about the search results. + */ +export class WidgetSearchMeta { + /** + * Total number of widgets created by anyone. + */ + "createdByAnyoneTotal"?: number; + /** + * Total number of widgets created by the current user. + */ + "createdByYouTotal"?: number; + /** + * Total number of widgets favorited by the current user. + */ + "favoritedByYouTotal"?: number; + /** + * Total number of widgets matching the current filter criteria. + */ + "filteredTotal"?: number; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + createdByAnyoneTotal: { + baseName: "created_by_anyone_total", + type: "number", + format: "int64", + }, + createdByYouTotal: { + baseName: "created_by_you_total", + type: "number", + format: "int64", + }, + favoritedByYouTotal: { + baseName: "favorited_by_you_total", + type: "number", + format: "int64", + }, + filteredTotal: { + baseName: "filtered_total", + type: "number", + format: "int64", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return WidgetSearchMeta.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/WidgetType.ts b/packages/datadog-api-client-v2/models/WidgetType.ts new file mode 100644 index 000000000000..68e9064755c1 --- /dev/null +++ b/packages/datadog-api-client-v2/models/WidgetType.ts @@ -0,0 +1,45 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * Widget types that are allowed to be stored as individual records. + * This is not a complete list of dashboard and notebook widget types. + */ + +export type WidgetType = + | typeof BAR_CHART + | typeof CHANGE + | typeof CLOUD_COST_SUMMARY + | typeof COHORT + | typeof FUNNEL + | typeof GEOMAP + | typeof LIST_STREAM + | typeof QUERY_TABLE + | typeof QUERY_VALUE + | typeof RETENTION_CURVE + | typeof SANKEY + | typeof SUNBURST + | typeof TIMESERIES + | typeof TOPLIST + | typeof TREEMAP + | UnparsedObject; +export const BAR_CHART = "bar_chart"; +export const CHANGE = "change"; +export const CLOUD_COST_SUMMARY = "cloud_cost_summary"; +export const COHORT = "cohort"; +export const FUNNEL = "funnel"; +export const GEOMAP = "geomap"; +export const LIST_STREAM = "list_stream"; +export const QUERY_TABLE = "query_table"; +export const QUERY_VALUE = "query_value"; +export const RETENTION_CURVE = "retention_curve"; +export const SANKEY = "sankey"; +export const SUNBURST = "sunburst"; +export const TIMESERIES = "timeseries"; +export const TOPLIST = "toplist"; +export const TREEMAP = "treemap";