From 0a87d4857be23350041065fd98c2467795ba3a6d Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 9 Jun 2026 23:52:55 +0000 Subject: [PATCH] Regenerate client from commit 41b94d9 of spec repo --- .generator/schemas/v2/openapi.yaml | 755 ++++++++++++++++++ docs/datadog_api_client.v2.api.rst | 7 + docs/datadog_api_client.v2.model.rst | 133 +++ examples/v2/forms/CreateAndPublishForm.py | 35 + examples/v2/forms/CreateForm.py | 35 + examples/v2/forms/DeleteForm.py | 20 + examples/v2/forms/GetForm.py | 20 + examples/v2/forms/ListForms.py | 14 + src/datadog_api_client/configuration.py | 5 + src/datadog_api_client/v2/api/forms_api.py | 221 +++++ src/datadog_api_client/v2/apis/__init__.py | 2 + .../v2/model/create_form_data.py | 48 ++ .../v2/model/create_form_data_attributes.py | 94 +++ .../v2/model/create_form_request.py | 40 + .../v2/model/delete_form_data.py | 47 ++ .../v2/model/delete_form_response.py | 42 + src/datadog_api_client/v2/model/form_data.py | 55 ++ .../v2/model/form_data_attributes.py | 169 ++++ .../v2/model/form_data_definition.py | 97 +++ .../v2/model/form_data_definition_type.py | 35 + .../model/form_datastore_config_attributes.py | 46 ++ .../v2/model/form_publication_attributes.py | 99 +++ .../v2/model/form_response.py | 40 + src/datadog_api_client/v2/model/form_type.py | 35 + .../v2/model/form_ui_definition.py | 54 ++ .../v2/model/form_ui_definition_ui_theme.py | 46 ++ ...rm_ui_definition_ui_theme_primary_color.py | 59 ++ .../v2/model/form_version_attributes.py | 124 +++ .../v2/model/form_version_state.py | 38 + .../v2/model/forms_response.py | 40 + src/datadog_api_client/v2/models/__init__.py | 38 + ...t_create_a_form_returns_ok_response.frozen | 1 + ...est_create_a_form_returns_ok_response.yaml | 39 + ..._publish_a_form_returns_ok_response.frozen | 1 + ...nd_publish_a_form_returns_ok_response.yaml | 39 + ...t_delete_a_form_returns_ok_response.frozen | 1 + ...est_delete_a_form_returns_ok_response.yaml | 54 ++ ...t_a_form_returns_not_found_response.frozen | 1 + ...get_a_form_returns_not_found_response.yaml | 19 + ...test_get_a_form_returns_ok_response.frozen | 1 + .../test_get_a_form_returns_ok_response.yaml | 55 ++ ...test_list_forms_returns_ok_response.frozen | 1 + .../test_list_forms_returns_ok_response.yaml | 59 ++ tests/v2/features/forms.feature | 107 +++ tests/v2/features/given.json | 24 + tests/v2/features/undo.json | 44 + 46 files changed, 2939 insertions(+) create mode 100644 examples/v2/forms/CreateAndPublishForm.py create mode 100644 examples/v2/forms/CreateForm.py create mode 100644 examples/v2/forms/DeleteForm.py create mode 100644 examples/v2/forms/GetForm.py create mode 100644 examples/v2/forms/ListForms.py create mode 100644 src/datadog_api_client/v2/api/forms_api.py create mode 100644 src/datadog_api_client/v2/model/create_form_data.py create mode 100644 src/datadog_api_client/v2/model/create_form_data_attributes.py create mode 100644 src/datadog_api_client/v2/model/create_form_request.py create mode 100644 src/datadog_api_client/v2/model/delete_form_data.py create mode 100644 src/datadog_api_client/v2/model/delete_form_response.py create mode 100644 src/datadog_api_client/v2/model/form_data.py create mode 100644 src/datadog_api_client/v2/model/form_data_attributes.py create mode 100644 src/datadog_api_client/v2/model/form_data_definition.py create mode 100644 src/datadog_api_client/v2/model/form_data_definition_type.py create mode 100644 src/datadog_api_client/v2/model/form_datastore_config_attributes.py create mode 100644 src/datadog_api_client/v2/model/form_publication_attributes.py create mode 100644 src/datadog_api_client/v2/model/form_response.py create mode 100644 src/datadog_api_client/v2/model/form_type.py create mode 100644 src/datadog_api_client/v2/model/form_ui_definition.py create mode 100644 src/datadog_api_client/v2/model/form_ui_definition_ui_theme.py create mode 100644 src/datadog_api_client/v2/model/form_ui_definition_ui_theme_primary_color.py create mode 100644 src/datadog_api_client/v2/model/form_version_attributes.py create mode 100644 src/datadog_api_client/v2/model/form_version_state.py create mode 100644 src/datadog_api_client/v2/model/forms_response.py create mode 100644 tests/v2/cassettes/test_scenarios/test_create_a_form_returns_ok_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_create_a_form_returns_ok_response.yaml create mode 100644 tests/v2/cassettes/test_scenarios/test_create_and_publish_a_form_returns_ok_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_create_and_publish_a_form_returns_ok_response.yaml create mode 100644 tests/v2/cassettes/test_scenarios/test_delete_a_form_returns_ok_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_delete_a_form_returns_ok_response.yaml create mode 100644 tests/v2/cassettes/test_scenarios/test_get_a_form_returns_not_found_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_get_a_form_returns_not_found_response.yaml create mode 100644 tests/v2/cassettes/test_scenarios/test_get_a_form_returns_ok_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_get_a_form_returns_ok_response.yaml create mode 100644 tests/v2/cassettes/test_scenarios/test_list_forms_returns_ok_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_list_forms_returns_ok_response.yaml create mode 100644 tests/v2/features/forms.feature diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 2d470c8f2f..a50a7d5077 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -23241,6 +23241,60 @@ components: required: - data type: object + CreateFormData: + description: The data for creating a form. + properties: + attributes: + $ref: "#/components/schemas/CreateFormDataAttributes" + type: + $ref: "#/components/schemas/FormType" + required: + - attributes + - type + type: object + CreateFormDataAttributes: + description: The attributes for creating a form. + properties: + anonymous: + default: false + description: Whether the form accepts anonymous submissions. + example: false + type: boolean + data_definition: + $ref: "#/components/schemas/FormDataDefinition" + description: + description: The description of the form. + example: A form to collect user feedback. + type: string + idp_survey: + default: false + description: Whether the form is an IDP survey. + example: false + type: boolean + name: + description: The name of the form. + example: User Feedback Form + type: string + single_response: + default: false + description: Whether each user can only submit one response. + example: false + type: boolean + ui_definition: + $ref: "#/components/schemas/FormUiDefinition" + required: + - data_definition + - name + - ui_definition + type: object + CreateFormRequest: + description: A request to create a form. + properties: + data: + $ref: "#/components/schemas/CreateFormData" + required: + - data + type: object CreateIncidentNotificationRuleRequest: description: Create request for a notification rule. properties: @@ -29056,6 +29110,26 @@ components: required: - data type: object + DeleteFormData: + description: The data returned when a form is deleted. + properties: + id: + description: The ID of the deleted form. + example: 844dfd88-aa84-4db4-8979-e7bdbb9c1dc3 + format: uuid + type: string + type: + $ref: "#/components/schemas/FormType" + required: + - id + - type + type: object + DeleteFormResponse: + description: A response returned after deleting a form. + properties: + data: + $ref: "#/components/schemas/DeleteFormData" + type: object DeletedSuiteResponseData: description: Data object for a deleted Synthetic test suite. properties: @@ -36762,6 +36836,233 @@ components: - type - attributes type: object + FormData: + description: A form resource object. + properties: + attributes: + $ref: "#/components/schemas/FormDataAttributes" + id: + description: The ID of the form. + example: 22f6006a-2302-4926-9396-d2dfcf7b0b34 + format: uuid + type: string + type: + $ref: "#/components/schemas/FormType" + required: + - id + - type + - attributes + type: object + FormDataAttributes: + description: The attributes of a form. + properties: + active: + description: Whether the form is currently active. + example: true + type: boolean + anonymous: + description: Whether the form accepts anonymous submissions. + example: false + type: boolean + created_at: + description: The time at which the form was created. + example: "2026-05-29T20:06:13.677353Z" + format: date-time + type: string + datastore_config: + $ref: "#/components/schemas/FormDatastoreConfigAttributes" + description: + description: The description of the form. + example: A form to collect user feedback. + type: string + end_date: + description: The date and time at which the form stops accepting responses. + example: + format: date-time + nullable: true + type: string + has_submitted: + description: Whether the current user has already submitted this form. Only present for forms with `single_response` set to `true`. + nullable: true + type: boolean + idp_survey: + description: Whether the form is an IDP survey. + example: false + type: boolean + modified_at: + description: The time at which the form was last modified. + example: "2026-05-29T20:06:13.677353Z" + format: date-time + type: string + name: + description: The name of the form. + example: User Feedback Form + type: string + org_id: + description: The ID of the organization that owns this form. + example: 2 + format: int64 + type: integer + publication: + $ref: "#/components/schemas/FormPublicationAttributes" + self_service: + description: Whether the form is available in the self-service catalog. + example: false + type: boolean + single_response: + description: Whether each user can only submit one response. + example: false + type: boolean + user_id: + description: The ID of the user who created this form. + example: 10001 + format: int64 + type: integer + user_uuid: + description: The UUID of the user who created this form. + example: 1fc709aa-be19-4539-a47d-52a30d78a978 + format: uuid + type: string + version: + $ref: "#/components/schemas/FormVersionAttributes" + required: + - active + - anonymous + - created_at + - datastore_config + - description + - idp_survey + - modified_at + - name + - org_id + - self_service + - single_response + - user_id + - user_uuid + type: object + FormDataDefinition: + additionalProperties: {} + description: A JSON Schema definition that describes the form's data fields. + properties: + description: + description: A description shown to form respondents. + example: Welcome to the Engineering Experience Survey. + type: string + properties: + additionalProperties: {} + description: A map of field names to their JSON Schema definitions. + type: object + required: + description: List of field names that must be answered. + items: + type: string + type: array + title: + description: The title of the form schema. + example: Developer Experience Survey + type: string + type: + $ref: "#/components/schemas/FormDataDefinitionType" + type: object + FormDataDefinitionType: + default: object + description: The root schema type. + enum: + - object + type: string + x-enum-varnames: + - OBJECT + FormDataList: + description: A list of form resource objects. + items: + $ref: "#/components/schemas/FormData" + type: array + FormDatastoreConfigAttributes: + description: The datastore configuration for a form. + properties: + datastore_id: + description: The ID of the datastore. + example: 5108ea24-dd83-4696-9caa-f069f73d0fad + format: uuid + type: string + primary_column_name: + description: The name of the primary column in the datastore. + example: id + type: string + primary_key_generation_strategy: + description: The strategy used to generate primary keys in the datastore. + example: none + type: string + required: + - datastore_id + - primary_column_name + - primary_key_generation_strategy + type: object + FormPublicationAttributes: + description: The attributes of a form publication. + properties: + created_at: + description: The time at which the publication was created. + example: "2026-05-29T20:06:13.677353Z" + format: date-time + type: string + form_id: + description: The ID of the form. + example: afc67600-0511-43b1-9b18-578fb4979bd3 + format: uuid + type: string + form_version: + description: The version number that was published. + example: 1 + format: int64 + type: integer + id: + description: The ID of the form publication. + example: "42" + type: string + modified_at: + description: The time at which the publication was last modified. + example: "2026-05-29T20:06:13.677353Z" + format: date-time + type: string + org_id: + description: The ID of the organization that owns this publication. + example: 2 + format: int64 + type: integer + publish_seq: + description: The sequential publication number for this form. + example: 1 + format: int64 + type: integer + user_id: + description: The ID of the user who created this publication. + example: 10001 + format: int64 + type: integer + user_uuid: + description: The UUID of the user who created this publication. + example: 1fc709aa-be19-4539-a47d-52a30d78a978 + format: uuid + type: string + required: + - created_at + - form_id + - form_version + - modified_at + - org_id + - publish_seq + - user_id + - user_uuid + type: object + FormResponse: + description: A response containing a single form. + properties: + data: + $ref: "#/components/schemas/FormData" + required: + - data + type: object FormTrigger: description: "Trigger a workflow from a Form." properties: @@ -36780,6 +37081,133 @@ components: required: - formTrigger type: object + FormType: + default: forms + description: The resource type for a form. + enum: + - forms + example: forms + type: string + x-enum-varnames: + - FORMS + FormUiDefinition: + additionalProperties: {} + description: UI configuration for rendering form fields, including widget overrides, field ordering, and themes. + properties: + "ui:order": + description: The order in which form fields are displayed. + items: + type: string + type: array + "ui:theme": + $ref: "#/components/schemas/FormUiDefinitionUiTheme" + type: object + FormUiDefinitionUiTheme: + description: The visual theme applied to the form. + properties: + primaryColor: + $ref: "#/components/schemas/FormUiDefinitionUiThemePrimaryColor" + type: object + FormUiDefinitionUiThemePrimaryColor: + description: The primary color of the form theme. + enum: + - gray + - red + - orange + - yellow + - green + - light-blue + - dark-blue + - magenta + - indigo + type: string + x-enum-varnames: + - GRAY + - RED + - ORANGE + - YELLOW + - GREEN + - LIGHT_BLUE + - DARK_BLUE + - MAGENTA + - INDIGO + FormVersionAttributes: + description: The attributes of a form version. + properties: + created_at: + description: The time at which the version was created. + example: "2026-05-29T20:06:14.895921Z" + format: date-time + type: string + data_definition: + $ref: "#/components/schemas/FormDataDefinition" + definition_signature: + description: The signature of the version definition. + example: '{"signature":"b7f312957a80cea2c8c9950532b205a90a3f8a7ebb7e52fc25437a25d903d545","version":1}' + type: string + etag: + description: The ETag for optimistic concurrency control. + example: b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d + nullable: true + type: string + id: + description: The ID of the form version. + example: "126" + type: string + modified_at: + description: The time at which the version was last modified. + example: "2026-05-29T20:06:14.949163Z" + format: date-time + type: string + state: + $ref: "#/components/schemas/FormVersionState" + ui_definition: + $ref: "#/components/schemas/FormUiDefinition" + user_id: + description: The ID of the user who created this version. + example: 10001 + format: int64 + type: integer + user_uuid: + description: The UUID of the user who created this version. + example: 1fc709aa-be19-4539-a47d-52a30d78a978 + format: uuid + type: string + version: + description: The sequential version number. + example: 1 + format: int64 + type: integer + required: + - created_at + - data_definition + - definition_signature + - etag + - modified_at + - state + - ui_definition + - user_id + - user_uuid + - version + type: object + FormVersionState: + description: The state of a form version. + enum: + - draft + - frozen + example: frozen + type: string + x-enum-varnames: + - DRAFT + - FROZEN + FormsResponse: + description: A response containing a list of forms. + properties: + data: + $ref: "#/components/schemas/FormDataList" + required: + - data + type: object FormulaLimit: description: |- Message for specifying limits to the number of values returned by a query. @@ -125241,6 +125669,330 @@ paths: permissions: - feature_flag_config_write - feature_flag_environment_config_read + /api/v2/forms: + get: + description: Get all forms for the authenticated user's organization. + operationId: ListForms + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + active: true + anonymous: false + created_at: "2026-05-29T20:06:14.895284Z" + datastore_config: + datastore_id: 00000000-0000-0000-0000-000000000000 + primary_column_name: "" + primary_key_generation_strategy: "" + description: A form to collect user feedback. + end_date: + idp_survey: false + modified_at: "2026-05-29T20:06:14.895285Z" + name: User Feedback Form + org_id: 2 + self_service: false + single_response: false + user_id: 10001 + user_uuid: 1fc709aa-be19-4539-a47d-52a30d78a978 + id: 22f6006a-2302-4926-9396-d2dfcf7b0b34 + type: forms + schema: + $ref: "#/components/schemas/FormsResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: List forms + tags: + - Forms + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + post: + description: Create a new form. The form is created in draft mode and must be published before it can be used. This also creates a new datastore for form responses and links it to the form. + operationId: CreateForm + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + anonymous: false + data_definition: {} + description: A form to collect user feedback. + idp_survey: false + name: User Feedback Form + single_response: false + ui_definition: {} + type: forms + schema: + $ref: "#/components/schemas/CreateFormRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + active: true + anonymous: false + created_at: "2026-05-29T20:06:14.895284Z" + datastore_config: + datastore_id: 5108ea24-dd83-4696-9caa-f069f73d0fad + primary_column_name: id + primary_key_generation_strategy: none + description: A form to collect user feedback. + end_date: + idp_survey: false + modified_at: "2026-05-29T20:06:14.895285Z" + name: User Feedback Form + org_id: 2 + self_service: false + single_response: false + user_id: 10001 + user_uuid: 1fc709aa-be19-4539-a47d-52a30d78a978 + id: 22f6006a-2302-4926-9396-d2dfcf7b0b34 + type: forms + schema: + $ref: "#/components/schemas/FormResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Create a form + tags: + - Forms + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/forms/create_and_publish: + post: + description: Creates a new form and immediately publishes its initial version. This also creates a new datastore for form responses and links it to the form. + operationId: CreateAndPublishForm + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + anonymous: false + data_definition: {} + description: A form to collect user feedback. + idp_survey: false + name: User Feedback Form + single_response: false + ui_definition: {} + type: forms + schema: + $ref: "#/components/schemas/CreateFormRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + active: true + anonymous: false + created_at: "2026-05-29T20:06:14.895284Z" + datastore_config: + datastore_id: 5108ea24-dd83-4696-9caa-f069f73d0fad + primary_column_name: id + primary_key_generation_strategy: none + description: A form to collect user feedback. + end_date: + idp_survey: false + modified_at: "2026-05-29T20:06:14.895285Z" + name: User Feedback Form + org_id: 2 + self_service: false + single_response: false + user_id: 10001 + user_uuid: 1fc709aa-be19-4539-a47d-52a30d78a978 + id: 22f6006a-2302-4926-9396-d2dfcf7b0b34 + type: forms + schema: + $ref: "#/components/schemas/FormResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Create and publish a form + tags: + - Forms + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/forms/{form_id}: + delete: + description: Delete a form by its ID. This will also try to delete the associated datastore. + operationId: DeleteForm + parameters: + - description: The ID of the form. + example: 844dfd88-aa84-4db4-8979-e7bdbb9c1dc3 + in: path + name: form_id + required: true + schema: + format: uuid + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + id: 844dfd88-aa84-4db4-8979-e7bdbb9c1dc3 + type: forms + schema: + $ref: "#/components/schemas/DeleteFormResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Delete a form + tags: + - Forms + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + get: + description: Get a form definition by its ID. + operationId: GetForm + parameters: + - description: The ID of the form. + example: 22f6006a-2302-4926-9396-d2dfcf7b0b34 + in: path + name: form_id + required: true + schema: + format: uuid + type: string + - description: The version of the form to retrieve. Use 'latest' for the most recent draft, 'published' for the last published version, or a specific version number. + in: query + name: version + required: false + schema: + default: latest + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + active: true + anonymous: false + created_at: "2026-05-29T20:06:14.895284Z" + datastore_config: + datastore_id: 5108ea24-dd83-4696-9caa-f069f73d0fad + primary_column_name: id + primary_key_generation_strategy: none + description: A form to collect user feedback. + end_date: + idp_survey: false + modified_at: "2026-05-29T20:06:14.895285Z" + name: User Feedback Form + org_id: 2 + self_service: false + single_response: false + user_id: 10001 + user_uuid: 1fc709aa-be19-4539-a47d-52a30d78a978 + id: 22f6006a-2302-4926-9396-d2dfcf7b0b34 + type: forms + schema: + $ref: "#/components/schemas/FormResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Get a form + tags: + - Forms + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/hamr: get: description: |- @@ -181249,6 +182001,9 @@ tags: Package Upgrade Deployments (`/upgrade`): - Upgrade the Datadog Agent to specific versions name: Fleet Automation + - description: |- + The Datadog Forms API lets you create and manage forms within the App Builder platform. You can configure form settings, manage versions, publish forms, and handle sharing configurations. + name: Forms - description: |- Configure your Datadog-Google Cloud Platform (GCP) integration directly through the Datadog API. Read more about the [Datadog-Google Cloud Platform integration](https://docs.datadoghq.com/integrations/google_cloud_platform). diff --git a/docs/datadog_api_client.v2.api.rst b/docs/datadog_api_client.v2.api.rst index fdced5d696..b59b0e3518 100644 --- a/docs/datadog_api_client.v2.api.rst +++ b/docs/datadog_api_client.v2.api.rst @@ -354,6 +354,13 @@ datadog\_api\_client.v2.api.fleet\_automation\_api module :members: :show-inheritance: +datadog\_api\_client.v2.api.forms\_api module +--------------------------------------------- + +.. automodule:: datadog_api_client.v2.api.forms_api + :members: + :show-inheritance: + datadog\_api\_client.v2.api.gcp\_integration\_api module -------------------------------------------------------- diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index f1ceac9025..512da4a2a6 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -9013,6 +9013,27 @@ datadog\_api\_client.v2.model.create\_feature\_flag\_request module :members: :show-inheritance: +datadog\_api\_client.v2.model.create\_form\_data module +------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.create_form_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.create\_form\_data\_attributes module +------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.create_form_data_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.create\_form\_request module +---------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.create_form_request + :members: + :show-inheritance: + datadog\_api\_client.v2.model.create\_incident\_notification\_rule\_request module ---------------------------------------------------------------------------------- @@ -11246,6 +11267,20 @@ datadog\_api\_client.v2.model.delete\_custom\_framework\_response module :members: :show-inheritance: +datadog\_api\_client.v2.model.delete\_form\_data module +------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.delete_form_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.delete\_form\_response module +----------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.delete_form_response + :members: + :show-inheritance: + datadog\_api\_client.v2.model.deleted\_suite\_response\_data module ------------------------------------------------------------------- @@ -14767,6 +14802,55 @@ datadog\_api\_client.v2.model.flutter\_sourcemap\_data module :members: :show-inheritance: +datadog\_api\_client.v2.model.form\_data module +----------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.form_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.form\_data\_attributes module +----------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.form_data_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.form\_data\_definition module +----------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.form_data_definition + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.form\_data\_definition\_type module +----------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.form_data_definition_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.form\_datastore\_config\_attributes module +------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.form_datastore_config_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.form\_publication\_attributes module +------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.form_publication_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.form\_response module +--------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.form_response + :members: + :show-inheritance: + datadog\_api\_client.v2.model.form\_trigger module -------------------------------------------------- @@ -14781,6 +14865,55 @@ datadog\_api\_client.v2.model.form\_trigger\_wrapper module :members: :show-inheritance: +datadog\_api\_client.v2.model.form\_type module +----------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.form_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.form\_ui\_definition module +--------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.form_ui_definition + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.form\_ui\_definition\_ui\_theme module +-------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.form_ui_definition_ui_theme + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.form\_ui\_definition\_ui\_theme\_primary\_color module +------------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.form_ui_definition_ui_theme_primary_color + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.form\_version\_attributes module +-------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.form_version_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.form\_version\_state module +--------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.form_version_state + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.forms\_response module +---------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.forms_response + :members: + :show-inheritance: + datadog\_api\_client.v2.model.formula\_limit module --------------------------------------------------- diff --git a/examples/v2/forms/CreateAndPublishForm.py b/examples/v2/forms/CreateAndPublishForm.py new file mode 100644 index 0000000000..6efd46b5b9 --- /dev/null +++ b/examples/v2/forms/CreateAndPublishForm.py @@ -0,0 +1,35 @@ +""" +Create and publish a form returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.forms_api import FormsApi +from datadog_api_client.v2.model.create_form_data import CreateFormData +from datadog_api_client.v2.model.create_form_data_attributes import CreateFormDataAttributes +from datadog_api_client.v2.model.create_form_request import CreateFormRequest +from datadog_api_client.v2.model.form_data_definition import FormDataDefinition +from datadog_api_client.v2.model.form_type import FormType +from datadog_api_client.v2.model.form_ui_definition import FormUiDefinition + +body = CreateFormRequest( + data=CreateFormData( + attributes=CreateFormDataAttributes( + anonymous=False, + data_definition=FormDataDefinition(), + description="A form to collect user feedback.", + idp_survey=False, + name="User Feedback Form", + single_response=False, + ui_definition=FormUiDefinition(), + ), + type=FormType.FORMS, + ), +) + +configuration = Configuration() +configuration.unstable_operations["create_and_publish_form"] = True +with ApiClient(configuration) as api_client: + api_instance = FormsApi(api_client) + response = api_instance.create_and_publish_form(body=body) + + print(response) diff --git a/examples/v2/forms/CreateForm.py b/examples/v2/forms/CreateForm.py new file mode 100644 index 0000000000..a0708eaad1 --- /dev/null +++ b/examples/v2/forms/CreateForm.py @@ -0,0 +1,35 @@ +""" +Create a form returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.forms_api import FormsApi +from datadog_api_client.v2.model.create_form_data import CreateFormData +from datadog_api_client.v2.model.create_form_data_attributes import CreateFormDataAttributes +from datadog_api_client.v2.model.create_form_request import CreateFormRequest +from datadog_api_client.v2.model.form_data_definition import FormDataDefinition +from datadog_api_client.v2.model.form_type import FormType +from datadog_api_client.v2.model.form_ui_definition import FormUiDefinition + +body = CreateFormRequest( + data=CreateFormData( + attributes=CreateFormDataAttributes( + anonymous=False, + data_definition=FormDataDefinition(), + description="A form to collect user feedback.", + idp_survey=False, + name="User Feedback Form", + single_response=False, + ui_definition=FormUiDefinition(), + ), + type=FormType.FORMS, + ), +) + +configuration = Configuration() +configuration.unstable_operations["create_form"] = True +with ApiClient(configuration) as api_client: + api_instance = FormsApi(api_client) + response = api_instance.create_form(body=body) + + print(response) diff --git a/examples/v2/forms/DeleteForm.py b/examples/v2/forms/DeleteForm.py new file mode 100644 index 0000000000..afa7c14c5c --- /dev/null +++ b/examples/v2/forms/DeleteForm.py @@ -0,0 +1,20 @@ +""" +Delete a form returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.forms_api import FormsApi + +# there is a valid "form" in the system +FORM_DATA_ID = environ["FORM_DATA_ID"] + +configuration = Configuration() +configuration.unstable_operations["delete_form"] = True +with ApiClient(configuration) as api_client: + api_instance = FormsApi(api_client) + response = api_instance.delete_form( + form_id=FORM_DATA_ID, + ) + + print(response) diff --git a/examples/v2/forms/GetForm.py b/examples/v2/forms/GetForm.py new file mode 100644 index 0000000000..5b5718eef5 --- /dev/null +++ b/examples/v2/forms/GetForm.py @@ -0,0 +1,20 @@ +""" +Get a form returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.forms_api import FormsApi + +# there is a valid "form" in the system +FORM_DATA_ID = environ["FORM_DATA_ID"] + +configuration = Configuration() +configuration.unstable_operations["get_form"] = True +with ApiClient(configuration) as api_client: + api_instance = FormsApi(api_client) + response = api_instance.get_form( + form_id=FORM_DATA_ID, + ) + + print(response) diff --git a/examples/v2/forms/ListForms.py b/examples/v2/forms/ListForms.py new file mode 100644 index 0000000000..a863705233 --- /dev/null +++ b/examples/v2/forms/ListForms.py @@ -0,0 +1,14 @@ +""" +List forms returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.forms_api import FormsApi + +configuration = Configuration() +configuration.unstable_operations["list_forms"] = True +with ApiClient(configuration) as api_client: + api_instance = FormsApi(api_client) + response = api_instance.list_forms() + + print(response) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index 62cd8f6abf..d38f1ecbb4 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -490,6 +490,11 @@ def __init__( "v2.trigger_deployment_gates_evaluation": False, "v2.update_deployment_gate": False, "v2.update_deployment_rule": False, + "v2.create_and_publish_form": False, + "v2.create_form": False, + "v2.delete_form": False, + "v2.get_form": False, + "v2.list_forms": False, "v2.create_hamr_org_connection": False, "v2.get_hamr_org_connection": False, "v2.delete_entity_integration_config": False, diff --git a/src/datadog_api_client/v2/api/forms_api.py b/src/datadog_api_client/v2/api/forms_api.py new file mode 100644 index 0000000000..e8e8a03c5d --- /dev/null +++ b/src/datadog_api_client/v2/api/forms_api.py @@ -0,0 +1,221 @@ +# 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.forms_response import FormsResponse +from datadog_api_client.v2.model.form_response import FormResponse +from datadog_api_client.v2.model.create_form_request import CreateFormRequest +from datadog_api_client.v2.model.delete_form_response import DeleteFormResponse + + +class FormsApi: + """ + The Datadog Forms API lets you create and manage forms within the App Builder platform. You can configure form settings, manage versions, publish forms, and handle sharing configurations. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient(Configuration()) + self.api_client = api_client + + self._create_and_publish_form_endpoint = _Endpoint( + settings={ + "response_type": (FormResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/forms/create_and_publish", + "operation_id": "create_and_publish_form", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "body": { + "required": True, + "openapi_types": (CreateFormRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + self._create_form_endpoint = _Endpoint( + settings={ + "response_type": (FormResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/forms", + "operation_id": "create_form", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "body": { + "required": True, + "openapi_types": (CreateFormRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + self._delete_form_endpoint = _Endpoint( + settings={ + "response_type": (DeleteFormResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/forms/{form_id}", + "operation_id": "delete_form", + "http_method": "DELETE", + "version": "v2", + }, + params_map={ + "form_id": { + "required": True, + "openapi_types": (UUID,), + "attribute": "form_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._get_form_endpoint = _Endpoint( + settings={ + "response_type": (FormResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/forms/{form_id}", + "operation_id": "get_form", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "form_id": { + "required": True, + "openapi_types": (UUID,), + "attribute": "form_id", + "location": "path", + }, + "version": { + "openapi_types": (str,), + "attribute": "version", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._list_forms_endpoint = _Endpoint( + settings={ + "response_type": (FormsResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/forms", + "operation_id": "list_forms", + "http_method": "GET", + "version": "v2", + }, + params_map={}, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + def create_and_publish_form( + self, + body: CreateFormRequest, + ) -> FormResponse: + """Create and publish a form. + + Creates a new form and immediately publishes its initial version. This also creates a new datastore for form responses and links it to the form. + + :type body: CreateFormRequest + :rtype: FormResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._create_and_publish_form_endpoint.call_with_http_info(**kwargs) + + def create_form( + self, + body: CreateFormRequest, + ) -> FormResponse: + """Create a form. + + Create a new form. The form is created in draft mode and must be published before it can be used. This also creates a new datastore for form responses and links it to the form. + + :type body: CreateFormRequest + :rtype: FormResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._create_form_endpoint.call_with_http_info(**kwargs) + + def delete_form( + self, + form_id: UUID, + ) -> DeleteFormResponse: + """Delete a form. + + Delete a form by its ID. This will also try to delete the associated datastore. + + :param form_id: The ID of the form. + :type form_id: UUID + :rtype: DeleteFormResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["form_id"] = form_id + + return self._delete_form_endpoint.call_with_http_info(**kwargs) + + def get_form( + self, + form_id: UUID, + *, + version: Union[str, UnsetType] = unset, + ) -> FormResponse: + """Get a form. + + Get a form definition by its ID. + + :param form_id: The ID of the form. + :type form_id: UUID + :param version: The version of the form to retrieve. Use 'latest' for the most recent draft, 'published' for the last published version, or a specific version number. + :type version: str, optional + :rtype: FormResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["form_id"] = form_id + + if version is not unset: + kwargs["version"] = version + + return self._get_form_endpoint.call_with_http_info(**kwargs) + + def list_forms( + self, + ) -> FormsResponse: + """List forms. + + Get all forms for the authenticated user's organization. + + :rtype: FormsResponse + """ + kwargs: Dict[str, Any] = {} + return self._list_forms_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 299d30f49a..243b5ea99e 100644 --- a/src/datadog_api_client/v2/apis/__init__.py +++ b/src/datadog_api_client/v2/apis/__init__.py @@ -48,6 +48,7 @@ from datadog_api_client.v2.api.fastly_integration_api import FastlyIntegrationApi from datadog_api_client.v2.api.feature_flags_api import FeatureFlagsApi from datadog_api_client.v2.api.fleet_automation_api import FleetAutomationApi +from datadog_api_client.v2.api.forms_api import FormsApi from datadog_api_client.v2.api.gcp_integration_api import GCPIntegrationApi from datadog_api_client.v2.api.google_chat_integration_api import GoogleChatIntegrationApi from datadog_api_client.v2.api.high_availability_multi_region_api import HighAvailabilityMultiRegionApi @@ -175,6 +176,7 @@ "FastlyIntegrationApi", "FeatureFlagsApi", "FleetAutomationApi", + "FormsApi", "GCPIntegrationApi", "GoogleChatIntegrationApi", "HighAvailabilityMultiRegionApi", diff --git a/src/datadog_api_client/v2/model/create_form_data.py b/src/datadog_api_client/v2/model/create_form_data.py new file mode 100644 index 0000000000..554bfd1fbe --- /dev/null +++ b/src/datadog_api_client/v2/model/create_form_data.py @@ -0,0 +1,48 @@ +# 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_form_data_attributes import CreateFormDataAttributes + from datadog_api_client.v2.model.form_type import FormType + + +class CreateFormData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.create_form_data_attributes import CreateFormDataAttributes + from datadog_api_client.v2.model.form_type import FormType + + return { + "attributes": (CreateFormDataAttributes,), + "type": (FormType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__(self_, attributes: CreateFormDataAttributes, type: FormType, **kwargs): + """ + The data for creating a form. + + :param attributes: The attributes for creating a form. + :type attributes: CreateFormDataAttributes + + :param type: The resource type for a form. + :type type: FormType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/create_form_data_attributes.py b/src/datadog_api_client/v2/model/create_form_data_attributes.py new file mode 100644 index 0000000000..f4bf060db2 --- /dev/null +++ b/src/datadog_api_client/v2/model/create_form_data_attributes.py @@ -0,0 +1,94 @@ +# 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.form_data_definition import FormDataDefinition + from datadog_api_client.v2.model.form_ui_definition import FormUiDefinition + + +class CreateFormDataAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.form_data_definition import FormDataDefinition + from datadog_api_client.v2.model.form_ui_definition import FormUiDefinition + + return { + "anonymous": (bool,), + "data_definition": (FormDataDefinition,), + "description": (str,), + "idp_survey": (bool,), + "name": (str,), + "single_response": (bool,), + "ui_definition": (FormUiDefinition,), + } + + attribute_map = { + "anonymous": "anonymous", + "data_definition": "data_definition", + "description": "description", + "idp_survey": "idp_survey", + "name": "name", + "single_response": "single_response", + "ui_definition": "ui_definition", + } + + def __init__( + self_, + data_definition: FormDataDefinition, + name: str, + ui_definition: FormUiDefinition, + anonymous: Union[bool, UnsetType] = unset, + description: Union[str, UnsetType] = unset, + idp_survey: Union[bool, UnsetType] = unset, + single_response: Union[bool, UnsetType] = unset, + **kwargs, + ): + """ + The attributes for creating a form. + + :param anonymous: Whether the form accepts anonymous submissions. + :type anonymous: bool, optional + + :param data_definition: A JSON Schema definition that describes the form's data fields. + :type data_definition: FormDataDefinition + + :param description: The description of the form. + :type description: str, optional + + :param idp_survey: Whether the form is an IDP survey. + :type idp_survey: bool, optional + + :param name: The name of the form. + :type name: str + + :param single_response: Whether each user can only submit one response. + :type single_response: bool, optional + + :param ui_definition: UI configuration for rendering form fields, including widget overrides, field ordering, and themes. + :type ui_definition: FormUiDefinition + """ + if anonymous is not unset: + kwargs["anonymous"] = anonymous + if description is not unset: + kwargs["description"] = description + if idp_survey is not unset: + kwargs["idp_survey"] = idp_survey + if single_response is not unset: + kwargs["single_response"] = single_response + super().__init__(kwargs) + + self_.data_definition = data_definition + self_.name = name + self_.ui_definition = ui_definition diff --git a/src/datadog_api_client/v2/model/create_form_request.py b/src/datadog_api_client/v2/model/create_form_request.py new file mode 100644 index 0000000000..2c4b71f157 --- /dev/null +++ b/src/datadog_api_client/v2/model/create_form_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_form_data import CreateFormData + + +class CreateFormRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.create_form_data import CreateFormData + + return { + "data": (CreateFormData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: CreateFormData, **kwargs): + """ + A request to create a form. + + :param data: The data for creating a form. + :type data: CreateFormData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/delete_form_data.py b/src/datadog_api_client/v2/model/delete_form_data.py new file mode 100644 index 0000000000..d1fc3d0229 --- /dev/null +++ b/src/datadog_api_client/v2/model/delete_form_data.py @@ -0,0 +1,47 @@ +# 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, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.form_type import FormType + + +class DeleteFormData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.form_type import FormType + + return { + "id": (UUID,), + "type": (FormType,), + } + + attribute_map = { + "id": "id", + "type": "type", + } + + def __init__(self_, id: UUID, type: FormType, **kwargs): + """ + The data returned when a form is deleted. + + :param id: The ID of the deleted form. + :type id: UUID + + :param type: The resource type for a form. + :type type: FormType + """ + super().__init__(kwargs) + + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/delete_form_response.py b/src/datadog_api_client/v2/model/delete_form_response.py new file mode 100644 index 0000000000..2278766e19 --- /dev/null +++ b/src/datadog_api_client/v2/model/delete_form_response.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.delete_form_data import DeleteFormData + + +class DeleteFormResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.delete_form_data import DeleteFormData + + return { + "data": (DeleteFormData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[DeleteFormData, UnsetType] = unset, **kwargs): + """ + A response returned after deleting a form. + + :param data: The data returned when a form is deleted. + :type data: DeleteFormData, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/form_data.py b/src/datadog_api_client/v2/model/form_data.py new file mode 100644 index 0000000000..686cbbbeb8 --- /dev/null +++ b/src/datadog_api_client/v2/model/form_data.py @@ -0,0 +1,55 @@ +# 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, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.form_data_attributes import FormDataAttributes + from datadog_api_client.v2.model.form_type import FormType + + +class FormData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.form_data_attributes import FormDataAttributes + from datadog_api_client.v2.model.form_type import FormType + + return { + "attributes": (FormDataAttributes,), + "id": (UUID,), + "type": (FormType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__(self_, attributes: FormDataAttributes, id: UUID, type: FormType, **kwargs): + """ + A form resource object. + + :param attributes: The attributes of a form. + :type attributes: FormDataAttributes + + :param id: The ID of the form. + :type id: UUID + + :param type: The resource type for a form. + :type type: FormType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/form_data_attributes.py b/src/datadog_api_client/v2/model/form_data_attributes.py new file mode 100644 index 0000000000..285e74bd4b --- /dev/null +++ b/src/datadog_api_client/v2/model/form_data_attributes.py @@ -0,0 +1,169 @@ +# 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, + datetime, + none_type, + unset, + UnsetType, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.form_datastore_config_attributes import FormDatastoreConfigAttributes + from datadog_api_client.v2.model.form_publication_attributes import FormPublicationAttributes + from datadog_api_client.v2.model.form_version_attributes import FormVersionAttributes + + +class FormDataAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.form_datastore_config_attributes import FormDatastoreConfigAttributes + from datadog_api_client.v2.model.form_publication_attributes import FormPublicationAttributes + from datadog_api_client.v2.model.form_version_attributes import FormVersionAttributes + + return { + "active": (bool,), + "anonymous": (bool,), + "created_at": (datetime,), + "datastore_config": (FormDatastoreConfigAttributes,), + "description": (str,), + "end_date": (datetime, none_type), + "has_submitted": (bool, none_type), + "idp_survey": (bool,), + "modified_at": (datetime,), + "name": (str,), + "org_id": (int,), + "publication": (FormPublicationAttributes,), + "self_service": (bool,), + "single_response": (bool,), + "user_id": (int,), + "user_uuid": (UUID,), + "version": (FormVersionAttributes,), + } + + attribute_map = { + "active": "active", + "anonymous": "anonymous", + "created_at": "created_at", + "datastore_config": "datastore_config", + "description": "description", + "end_date": "end_date", + "has_submitted": "has_submitted", + "idp_survey": "idp_survey", + "modified_at": "modified_at", + "name": "name", + "org_id": "org_id", + "publication": "publication", + "self_service": "self_service", + "single_response": "single_response", + "user_id": "user_id", + "user_uuid": "user_uuid", + "version": "version", + } + + def __init__( + self_, + active: bool, + anonymous: bool, + created_at: datetime, + datastore_config: FormDatastoreConfigAttributes, + description: str, + idp_survey: bool, + modified_at: datetime, + name: str, + org_id: int, + self_service: bool, + single_response: bool, + user_id: int, + user_uuid: UUID, + end_date: Union[datetime, none_type, UnsetType] = unset, + has_submitted: Union[bool, none_type, UnsetType] = unset, + publication: Union[FormPublicationAttributes, UnsetType] = unset, + version: Union[FormVersionAttributes, UnsetType] = unset, + **kwargs, + ): + """ + The attributes of a form. + + :param active: Whether the form is currently active. + :type active: bool + + :param anonymous: Whether the form accepts anonymous submissions. + :type anonymous: bool + + :param created_at: The time at which the form was created. + :type created_at: datetime + + :param datastore_config: The datastore configuration for a form. + :type datastore_config: FormDatastoreConfigAttributes + + :param description: The description of the form. + :type description: str + + :param end_date: The date and time at which the form stops accepting responses. + :type end_date: datetime, none_type, optional + + :param has_submitted: Whether the current user has already submitted this form. Only present for forms with ``single_response`` set to ``true``. + :type has_submitted: bool, none_type, optional + + :param idp_survey: Whether the form is an IDP survey. + :type idp_survey: bool + + :param modified_at: The time at which the form was last modified. + :type modified_at: datetime + + :param name: The name of the form. + :type name: str + + :param org_id: The ID of the organization that owns this form. + :type org_id: int + + :param publication: The attributes of a form publication. + :type publication: FormPublicationAttributes, optional + + :param self_service: Whether the form is available in the self-service catalog. + :type self_service: bool + + :param single_response: Whether each user can only submit one response. + :type single_response: bool + + :param user_id: The ID of the user who created this form. + :type user_id: int + + :param user_uuid: The UUID of the user who created this form. + :type user_uuid: UUID + + :param version: The attributes of a form version. + :type version: FormVersionAttributes, optional + """ + if end_date is not unset: + kwargs["end_date"] = end_date + if has_submitted is not unset: + kwargs["has_submitted"] = has_submitted + if publication is not unset: + kwargs["publication"] = publication + if version is not unset: + kwargs["version"] = version + super().__init__(kwargs) + + self_.active = active + self_.anonymous = anonymous + self_.created_at = created_at + self_.datastore_config = datastore_config + self_.description = description + self_.idp_survey = idp_survey + self_.modified_at = modified_at + self_.name = name + self_.org_id = org_id + self_.self_service = self_service + self_.single_response = single_response + self_.user_id = user_id + self_.user_uuid = user_uuid diff --git a/src/datadog_api_client/v2/model/form_data_definition.py b/src/datadog_api_client/v2/model/form_data_definition.py new file mode 100644 index 0000000000..d10a54dc6f --- /dev/null +++ b/src/datadog_api_client/v2/model/form_data_definition.py @@ -0,0 +1,97 @@ +# 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, List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + date, + datetime, + none_type, + unset, + UnsetType, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.form_data_definition_type import FormDataDefinitionType + + +class FormDataDefinition(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.form_data_definition_type import FormDataDefinitionType + + return { + "description": (str,), + "properties": ( + { + str: ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + UUID, + none_type, + ) + }, + ), + "required": ([str],), + "title": (str,), + "type": (FormDataDefinitionType,), + } + + attribute_map = { + "description": "description", + "properties": "properties", + "required": "required", + "title": "title", + "type": "type", + } + + def __init__( + self_, + description: Union[str, UnsetType] = unset, + properties: Union[Dict[str, Any], UnsetType] = unset, + required: Union[List[str], UnsetType] = unset, + title: Union[str, UnsetType] = unset, + type: Union[FormDataDefinitionType, UnsetType] = unset, + **kwargs, + ): + """ + A JSON Schema definition that describes the form's data fields. + + :param description: A description shown to form respondents. + :type description: str, optional + + :param properties: A map of field names to their JSON Schema definitions. + :type properties: {str: (bool, date, datetime, dict, float, int, list, str, UUID, none_type,)}, optional + + :param required: List of field names that must be answered. + :type required: [str], optional + + :param title: The title of the form schema. + :type title: str, optional + + :param type: The root schema type. + :type type: FormDataDefinitionType, optional + """ + if description is not unset: + kwargs["description"] = description + if properties is not unset: + kwargs["properties"] = properties + if required is not unset: + kwargs["required"] = required + if title is not unset: + kwargs["title"] = title + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/form_data_definition_type.py b/src/datadog_api_client/v2/model/form_data_definition_type.py new file mode 100644 index 0000000000..0128cc13c9 --- /dev/null +++ b/src/datadog_api_client/v2/model/form_data_definition_type.py @@ -0,0 +1,35 @@ +# 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 FormDataDefinitionType(ModelSimple): + """ + The root schema type. + + :param value: If omitted defaults to "object". Must be one of ["object"]. + :type value: str + """ + + allowed_values = { + "object", + } + OBJECT: ClassVar["FormDataDefinitionType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +FormDataDefinitionType.OBJECT = FormDataDefinitionType("object") diff --git a/src/datadog_api_client/v2/model/form_datastore_config_attributes.py b/src/datadog_api_client/v2/model/form_datastore_config_attributes.py new file mode 100644 index 0000000000..57b202b35e --- /dev/null +++ b/src/datadog_api_client/v2/model/form_datastore_config_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 datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + UUID, +) + + +class FormDatastoreConfigAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "datastore_id": (UUID,), + "primary_column_name": (str,), + "primary_key_generation_strategy": (str,), + } + + attribute_map = { + "datastore_id": "datastore_id", + "primary_column_name": "primary_column_name", + "primary_key_generation_strategy": "primary_key_generation_strategy", + } + + def __init__(self_, datastore_id: UUID, primary_column_name: str, primary_key_generation_strategy: str, **kwargs): + """ + The datastore configuration for a form. + + :param datastore_id: The ID of the datastore. + :type datastore_id: UUID + + :param primary_column_name: The name of the primary column in the datastore. + :type primary_column_name: str + + :param primary_key_generation_strategy: The strategy used to generate primary keys in the datastore. + :type primary_key_generation_strategy: str + """ + super().__init__(kwargs) + + self_.datastore_id = datastore_id + self_.primary_column_name = primary_column_name + self_.primary_key_generation_strategy = primary_key_generation_strategy diff --git a/src/datadog_api_client/v2/model/form_publication_attributes.py b/src/datadog_api_client/v2/model/form_publication_attributes.py new file mode 100644 index 0000000000..7f9960f47c --- /dev/null +++ b/src/datadog_api_client/v2/model/form_publication_attributes.py @@ -0,0 +1,99 @@ +# 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, + datetime, + unset, + UnsetType, + UUID, +) + + +class FormPublicationAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "created_at": (datetime,), + "form_id": (UUID,), + "form_version": (int,), + "id": (str,), + "modified_at": (datetime,), + "org_id": (int,), + "publish_seq": (int,), + "user_id": (int,), + "user_uuid": (UUID,), + } + + attribute_map = { + "created_at": "created_at", + "form_id": "form_id", + "form_version": "form_version", + "id": "id", + "modified_at": "modified_at", + "org_id": "org_id", + "publish_seq": "publish_seq", + "user_id": "user_id", + "user_uuid": "user_uuid", + } + + def __init__( + self_, + created_at: datetime, + form_id: UUID, + form_version: int, + modified_at: datetime, + org_id: int, + publish_seq: int, + user_id: int, + user_uuid: UUID, + id: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + The attributes of a form publication. + + :param created_at: The time at which the publication was created. + :type created_at: datetime + + :param form_id: The ID of the form. + :type form_id: UUID + + :param form_version: The version number that was published. + :type form_version: int + + :param id: The ID of the form publication. + :type id: str, optional + + :param modified_at: The time at which the publication was last modified. + :type modified_at: datetime + + :param org_id: The ID of the organization that owns this publication. + :type org_id: int + + :param publish_seq: The sequential publication number for this form. + :type publish_seq: int + + :param user_id: The ID of the user who created this publication. + :type user_id: int + + :param user_uuid: The UUID of the user who created this publication. + :type user_uuid: UUID + """ + if id is not unset: + kwargs["id"] = id + super().__init__(kwargs) + + self_.created_at = created_at + self_.form_id = form_id + self_.form_version = form_version + self_.modified_at = modified_at + self_.org_id = org_id + self_.publish_seq = publish_seq + self_.user_id = user_id + self_.user_uuid = user_uuid diff --git a/src/datadog_api_client/v2/model/form_response.py b/src/datadog_api_client/v2/model/form_response.py new file mode 100644 index 0000000000..a60ebd48fa --- /dev/null +++ b/src/datadog_api_client/v2/model/form_response.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.form_data import FormData + + +class FormResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.form_data import FormData + + return { + "data": (FormData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: FormData, **kwargs): + """ + A response containing a single form. + + :param data: A form resource object. + :type data: FormData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/form_type.py b/src/datadog_api_client/v2/model/form_type.py new file mode 100644 index 0000000000..179c2600c3 --- /dev/null +++ b/src/datadog_api_client/v2/model/form_type.py @@ -0,0 +1,35 @@ +# 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 FormType(ModelSimple): + """ + The resource type for a form. + + :param value: If omitted defaults to "forms". Must be one of ["forms"]. + :type value: str + """ + + allowed_values = { + "forms", + } + FORMS: ClassVar["FormType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +FormType.FORMS = FormType("forms") diff --git a/src/datadog_api_client/v2/model/form_ui_definition.py b/src/datadog_api_client/v2/model/form_ui_definition.py new file mode 100644 index 0000000000..d8e84f25f0 --- /dev/null +++ b/src/datadog_api_client/v2/model/form_ui_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 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.form_ui_definition_ui_theme import FormUiDefinitionUiTheme + + +class FormUiDefinition(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.form_ui_definition_ui_theme import FormUiDefinitionUiTheme + + return { + "ui_order": ([str],), + "ui_theme": (FormUiDefinitionUiTheme,), + } + + attribute_map = { + "ui_order": "ui:order", + "ui_theme": "ui:theme", + } + + def __init__( + self_, + ui_order: Union[List[str], UnsetType] = unset, + ui_theme: Union[FormUiDefinitionUiTheme, UnsetType] = unset, + **kwargs, + ): + """ + UI configuration for rendering form fields, including widget overrides, field ordering, and themes. + + :param ui_order: The order in which form fields are displayed. + :type ui_order: [str], optional + + :param ui_theme: The visual theme applied to the form. + :type ui_theme: FormUiDefinitionUiTheme, optional + """ + if ui_order is not unset: + kwargs["ui_order"] = ui_order + if ui_theme is not unset: + kwargs["ui_theme"] = ui_theme + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/form_ui_definition_ui_theme.py b/src/datadog_api_client/v2/model/form_ui_definition_ui_theme.py new file mode 100644 index 0000000000..0cec2eed2c --- /dev/null +++ b/src/datadog_api_client/v2/model/form_ui_definition_ui_theme.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, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.form_ui_definition_ui_theme_primary_color import ( + FormUiDefinitionUiThemePrimaryColor, + ) + + +class FormUiDefinitionUiTheme(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.form_ui_definition_ui_theme_primary_color import ( + FormUiDefinitionUiThemePrimaryColor, + ) + + return { + "primary_color": (FormUiDefinitionUiThemePrimaryColor,), + } + + attribute_map = { + "primary_color": "primaryColor", + } + + def __init__(self_, primary_color: Union[FormUiDefinitionUiThemePrimaryColor, UnsetType] = unset, **kwargs): + """ + The visual theme applied to the form. + + :param primary_color: The primary color of the form theme. + :type primary_color: FormUiDefinitionUiThemePrimaryColor, optional + """ + if primary_color is not unset: + kwargs["primary_color"] = primary_color + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/form_ui_definition_ui_theme_primary_color.py b/src/datadog_api_client/v2/model/form_ui_definition_ui_theme_primary_color.py new file mode 100644 index 0000000000..77380a5aaf --- /dev/null +++ b/src/datadog_api_client/v2/model/form_ui_definition_ui_theme_primary_color.py @@ -0,0 +1,59 @@ +# 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 FormUiDefinitionUiThemePrimaryColor(ModelSimple): + """ + The primary color of the form theme. + + :param value: Must be one of ["gray", "red", "orange", "yellow", "green", "light-blue", "dark-blue", "magenta", "indigo"]. + :type value: str + """ + + allowed_values = { + "gray", + "red", + "orange", + "yellow", + "green", + "light-blue", + "dark-blue", + "magenta", + "indigo", + } + GRAY: ClassVar["FormUiDefinitionUiThemePrimaryColor"] + RED: ClassVar["FormUiDefinitionUiThemePrimaryColor"] + ORANGE: ClassVar["FormUiDefinitionUiThemePrimaryColor"] + YELLOW: ClassVar["FormUiDefinitionUiThemePrimaryColor"] + GREEN: ClassVar["FormUiDefinitionUiThemePrimaryColor"] + LIGHT_BLUE: ClassVar["FormUiDefinitionUiThemePrimaryColor"] + DARK_BLUE: ClassVar["FormUiDefinitionUiThemePrimaryColor"] + MAGENTA: ClassVar["FormUiDefinitionUiThemePrimaryColor"] + INDIGO: ClassVar["FormUiDefinitionUiThemePrimaryColor"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +FormUiDefinitionUiThemePrimaryColor.GRAY = FormUiDefinitionUiThemePrimaryColor("gray") +FormUiDefinitionUiThemePrimaryColor.RED = FormUiDefinitionUiThemePrimaryColor("red") +FormUiDefinitionUiThemePrimaryColor.ORANGE = FormUiDefinitionUiThemePrimaryColor("orange") +FormUiDefinitionUiThemePrimaryColor.YELLOW = FormUiDefinitionUiThemePrimaryColor("yellow") +FormUiDefinitionUiThemePrimaryColor.GREEN = FormUiDefinitionUiThemePrimaryColor("green") +FormUiDefinitionUiThemePrimaryColor.LIGHT_BLUE = FormUiDefinitionUiThemePrimaryColor("light-blue") +FormUiDefinitionUiThemePrimaryColor.DARK_BLUE = FormUiDefinitionUiThemePrimaryColor("dark-blue") +FormUiDefinitionUiThemePrimaryColor.MAGENTA = FormUiDefinitionUiThemePrimaryColor("magenta") +FormUiDefinitionUiThemePrimaryColor.INDIGO = FormUiDefinitionUiThemePrimaryColor("indigo") diff --git a/src/datadog_api_client/v2/model/form_version_attributes.py b/src/datadog_api_client/v2/model/form_version_attributes.py new file mode 100644 index 0000000000..c5a92d9c7a --- /dev/null +++ b/src/datadog_api_client/v2/model/form_version_attributes.py @@ -0,0 +1,124 @@ +# 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, + datetime, + none_type, + unset, + UnsetType, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.form_data_definition import FormDataDefinition + from datadog_api_client.v2.model.form_version_state import FormVersionState + from datadog_api_client.v2.model.form_ui_definition import FormUiDefinition + + +class FormVersionAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.form_data_definition import FormDataDefinition + from datadog_api_client.v2.model.form_version_state import FormVersionState + from datadog_api_client.v2.model.form_ui_definition import FormUiDefinition + + return { + "created_at": (datetime,), + "data_definition": (FormDataDefinition,), + "definition_signature": (str,), + "etag": (str, none_type), + "id": (str,), + "modified_at": (datetime,), + "state": (FormVersionState,), + "ui_definition": (FormUiDefinition,), + "user_id": (int,), + "user_uuid": (UUID,), + "version": (int,), + } + + attribute_map = { + "created_at": "created_at", + "data_definition": "data_definition", + "definition_signature": "definition_signature", + "etag": "etag", + "id": "id", + "modified_at": "modified_at", + "state": "state", + "ui_definition": "ui_definition", + "user_id": "user_id", + "user_uuid": "user_uuid", + "version": "version", + } + + def __init__( + self_, + created_at: datetime, + data_definition: FormDataDefinition, + definition_signature: str, + etag: Union[str, none_type], + modified_at: datetime, + state: FormVersionState, + ui_definition: FormUiDefinition, + user_id: int, + user_uuid: UUID, + version: int, + id: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + The attributes of a form version. + + :param created_at: The time at which the version was created. + :type created_at: datetime + + :param data_definition: A JSON Schema definition that describes the form's data fields. + :type data_definition: FormDataDefinition + + :param definition_signature: The signature of the version definition. + :type definition_signature: str + + :param etag: The ETag for optimistic concurrency control. + :type etag: str, none_type + + :param id: The ID of the form version. + :type id: str, optional + + :param modified_at: The time at which the version was last modified. + :type modified_at: datetime + + :param state: The state of a form version. + :type state: FormVersionState + + :param ui_definition: UI configuration for rendering form fields, including widget overrides, field ordering, and themes. + :type ui_definition: FormUiDefinition + + :param user_id: The ID of the user who created this version. + :type user_id: int + + :param user_uuid: The UUID of the user who created this version. + :type user_uuid: UUID + + :param version: The sequential version number. + :type version: int + """ + if id is not unset: + kwargs["id"] = id + super().__init__(kwargs) + + self_.created_at = created_at + self_.data_definition = data_definition + self_.definition_signature = definition_signature + self_.etag = etag + self_.modified_at = modified_at + self_.state = state + self_.ui_definition = ui_definition + self_.user_id = user_id + self_.user_uuid = user_uuid + self_.version = version diff --git a/src/datadog_api_client/v2/model/form_version_state.py b/src/datadog_api_client/v2/model/form_version_state.py new file mode 100644 index 0000000000..521faf36a3 --- /dev/null +++ b/src/datadog_api_client/v2/model/form_version_state.py @@ -0,0 +1,38 @@ +# 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 FormVersionState(ModelSimple): + """ + The state of a form version. + + :param value: Must be one of ["draft", "frozen"]. + :type value: str + """ + + allowed_values = { + "draft", + "frozen", + } + DRAFT: ClassVar["FormVersionState"] + FROZEN: ClassVar["FormVersionState"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +FormVersionState.DRAFT = FormVersionState("draft") +FormVersionState.FROZEN = FormVersionState("frozen") diff --git a/src/datadog_api_client/v2/model/forms_response.py b/src/datadog_api_client/v2/model/forms_response.py new file mode 100644 index 0000000000..e3ba1e4b70 --- /dev/null +++ b/src/datadog_api_client/v2/model/forms_response.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 List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.form_data import FormData + + +class FormsResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.form_data import FormData + + return { + "data": ([FormData],), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: List[FormData], **kwargs): + """ + A response containing a list of forms. + + :param data: A list of form resource objects. + :type data: [FormData] + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 817d63c3f9..28371f0a3f 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -1657,6 +1657,9 @@ from datadog_api_client.v2.model.create_feature_flag_data import CreateFeatureFlagData from datadog_api_client.v2.model.create_feature_flag_data_type import CreateFeatureFlagDataType from datadog_api_client.v2.model.create_feature_flag_request import CreateFeatureFlagRequest +from datadog_api_client.v2.model.create_form_data import CreateFormData +from datadog_api_client.v2.model.create_form_data_attributes import CreateFormDataAttributes +from datadog_api_client.v2.model.create_form_request import CreateFormRequest from datadog_api_client.v2.model.create_incident_notification_rule_request import CreateIncidentNotificationRuleRequest from datadog_api_client.v2.model.create_incident_notification_template_request import ( CreateIncidentNotificationTemplateRequest, @@ -2178,6 +2181,8 @@ from datadog_api_client.v2.model.delete_apps_response import DeleteAppsResponse from datadog_api_client.v2.model.delete_apps_response_data_items import DeleteAppsResponseDataItems from datadog_api_client.v2.model.delete_custom_framework_response import DeleteCustomFrameworkResponse +from datadog_api_client.v2.model.delete_form_data import DeleteFormData +from datadog_api_client.v2.model.delete_form_response import DeleteFormResponse from datadog_api_client.v2.model.deleted_suite_response_data import DeletedSuiteResponseData from datadog_api_client.v2.model.deleted_suite_response_data_attributes import DeletedSuiteResponseDataAttributes from datadog_api_client.v2.model.deleted_suites_request_delete import DeletedSuitesRequestDelete @@ -2775,8 +2780,22 @@ from datadog_api_client.v2.model.fleet_tracers_response_meta import FleetTracersResponseMeta from datadog_api_client.v2.model.flutter_sourcemap_attributes import FlutterSourcemapAttributes from datadog_api_client.v2.model.flutter_sourcemap_data import FlutterSourcemapData +from datadog_api_client.v2.model.form_data import FormData +from datadog_api_client.v2.model.form_data_attributes import FormDataAttributes +from datadog_api_client.v2.model.form_data_definition import FormDataDefinition +from datadog_api_client.v2.model.form_data_definition_type import FormDataDefinitionType +from datadog_api_client.v2.model.form_datastore_config_attributes import FormDatastoreConfigAttributes +from datadog_api_client.v2.model.form_publication_attributes import FormPublicationAttributes +from datadog_api_client.v2.model.form_response import FormResponse from datadog_api_client.v2.model.form_trigger import FormTrigger from datadog_api_client.v2.model.form_trigger_wrapper import FormTriggerWrapper +from datadog_api_client.v2.model.form_type import FormType +from datadog_api_client.v2.model.form_ui_definition import FormUiDefinition +from datadog_api_client.v2.model.form_ui_definition_ui_theme import FormUiDefinitionUiTheme +from datadog_api_client.v2.model.form_ui_definition_ui_theme_primary_color import FormUiDefinitionUiThemePrimaryColor +from datadog_api_client.v2.model.form_version_attributes import FormVersionAttributes +from datadog_api_client.v2.model.form_version_state import FormVersionState +from datadog_api_client.v2.model.forms_response import FormsResponse from datadog_api_client.v2.model.formula_limit import FormulaLimit from datadog_api_client.v2.model.framework_handle_and_version_response_data import FrameworkHandleAndVersionResponseData from datadog_api_client.v2.model.freshservice_api_key import FreshserviceAPIKey @@ -10237,6 +10256,9 @@ "CreateFeatureFlagData", "CreateFeatureFlagDataType", "CreateFeatureFlagRequest", + "CreateFormData", + "CreateFormDataAttributes", + "CreateFormRequest", "CreateIncidentNotificationRuleRequest", "CreateIncidentNotificationTemplateRequest", "CreateJiraIssueRequestArray", @@ -10590,6 +10612,8 @@ "DeleteAppsResponse", "DeleteAppsResponseDataItems", "DeleteCustomFrameworkResponse", + "DeleteFormData", + "DeleteFormResponse", "DeletedSuiteResponseData", "DeletedSuiteResponseDataAttributes", "DeletedSuitesRequestDelete", @@ -11059,8 +11083,22 @@ "FleetTracersResponseMeta", "FlutterSourcemapAttributes", "FlutterSourcemapData", + "FormData", + "FormDataAttributes", + "FormDataDefinition", + "FormDataDefinitionType", + "FormDatastoreConfigAttributes", + "FormPublicationAttributes", + "FormResponse", "FormTrigger", "FormTriggerWrapper", + "FormType", + "FormUiDefinition", + "FormUiDefinitionUiTheme", + "FormUiDefinitionUiThemePrimaryColor", + "FormVersionAttributes", + "FormVersionState", + "FormsResponse", "FormulaLimit", "FrameworkHandleAndVersionResponseData", "FreshserviceAPIKey", diff --git a/tests/v2/cassettes/test_scenarios/test_create_a_form_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_a_form_returns_ok_response.frozen new file mode 100644 index 0000000000..094857b451 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_a_form_returns_ok_response.frozen @@ -0,0 +1 @@ +2026-06-04T18:34:02.931Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_create_a_form_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_a_form_returns_ok_response.yaml new file mode 100644 index 0000000000..ea5776e21f --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_a_form_returns_ok_response.yaml @@ -0,0 +1,39 @@ +interactions: +- request: + body: '{"data":{"attributes":{"anonymous":false,"data_definition":{},"description":"A + form to collect user feedback.","idp_survey":false,"name":"User Feedback Form","single_response":false,"ui_definition":{}},"type":"forms"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/forms + response: + body: + string: '{"data":{"id":"edb7d6d5-e21c-4fd0-845d-679317b5c2c9","type":"forms","attributes":{"active":true,"anonymous":false,"created_at":"2026-06-04T18:34:04.103183Z","datastore_config":{"datastore_id":"7cc8dadd-3529-4d0f-b8cb-f8c11c165867","primary_column_name":"id","primary_key_generation_strategy":"none"},"description":"A + form to collect user feedback.","idp_survey":false,"modified_at":"2026-06-04T18:34:04.103183Z","name":"User + Feedback Form","org_id":321813,"self_service":false,"single_response":false,"user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","version":{"id":"354653","state":"draft","version":1,"etag":"b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d","definition_signature":"{\"signature\":\"{\\\"version\\\":2,\\\"algorithm\\\":\\\"ecdsa-p384\\\",\\\"pubkey\\\":\\\"XOOWpRG1rFvaLHaG9qLf+GG78llET0BKnZtokyAtLfg=\\\",\\\"timestamp\\\":1780598044,\\\"proof\\\":\\\"MGQCMHsaS9oy6ZDzhUZuJQAYiivxgo9XKx5NjTW/0wafPecXBQ3lr27bKejXr4ihAuwxsgIwPfgedZacZ4t3Qg8p0+jrXH5MBdZx9hrat8mijVibYuLUd2n+bxaY0xcghHKwbtu4\\\"}\",\"version\":1}","data_definition":{},"ui_definition":{},"created_at":"2026-06-04T18:34:04.103183Z","modified_at":"2026-06-04T18:34:04.103183Z","user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v2/forms/edb7d6d5-e21c-4fd0-845d-679317b5c2c9 + response: + body: + string: '{"data":{"id":"edb7d6d5-e21c-4fd0-845d-679317b5c2c9","type":"forms"}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_create_and_publish_a_form_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_and_publish_a_form_returns_ok_response.frozen new file mode 100644 index 0000000000..0add2d175d --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_and_publish_a_form_returns_ok_response.frozen @@ -0,0 +1 @@ +2026-06-04T18:34:04.703Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_create_and_publish_a_form_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_and_publish_a_form_returns_ok_response.yaml new file mode 100644 index 0000000000..aa56ce9f6b --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_and_publish_a_form_returns_ok_response.yaml @@ -0,0 +1,39 @@ +interactions: +- request: + body: '{"data":{"attributes":{"anonymous":false,"data_definition":{},"description":"A + form to collect user feedback.","idp_survey":false,"name":"User Feedback Form","single_response":false,"ui_definition":{}},"type":"forms"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/forms/create_and_publish + response: + body: + string: '{"data":{"id":"65318f43-ac0f-4990-add8-9847eee98fd8","type":"forms","attributes":{"active":true,"anonymous":false,"created_at":"2026-06-04T18:34:05.178222Z","datastore_config":{"datastore_id":"c89fc16a-53fb-4439-a007-1ebec095b1b7","primary_column_name":"id","primary_key_generation_strategy":"none"},"description":"A + form to collect user feedback.","idp_survey":false,"modified_at":"2026-06-04T18:34:05.178222Z","name":"User + Feedback Form","org_id":321813,"publication":{"id":"357922","org_id":321813,"form_id":"65318f43-ac0f-4990-add8-9847eee98fd8","publish_seq":1,"form_version":1,"created_at":"2026-06-04T18:34:05.178222Z","modified_at":"2026-06-04T18:34:05.178222Z","user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"},"self_service":false,"single_response":false,"user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","version":{"id":"354654","state":"frozen","version":1,"etag":"b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d","definition_signature":"{\"signature\":\"{\\\"version\\\":2,\\\"algorithm\\\":\\\"ecdsa-p384\\\",\\\"pubkey\\\":\\\"XOOWpRG1rFvaLHaG9qLf+GG78llET0BKnZtokyAtLfg=\\\",\\\"timestamp\\\":1780598045,\\\"proof\\\":\\\"MGYCMQCPPczYtNvj1RLjrQkIrQNHHVgB3nxFIjn5jgwUE0tweuTV1kZnaYYUg+gl1Eh5+tMCMQCajq1cy1MaWEbzHA0EcDC6LjyQ5ajqqngb3RMQwzP8ewvsh+uzkPD2v6AHjnW115o=\\\"}\",\"version\":1}","data_definition":{},"ui_definition":{},"created_at":"2026-06-04T18:34:05.178222Z","modified_at":"2026-06-04T18:34:05.178222Z","user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v2/forms/65318f43-ac0f-4990-add8-9847eee98fd8 + response: + body: + string: '{"data":{"id":"65318f43-ac0f-4990-add8-9847eee98fd8","type":"forms"}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_delete_a_form_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_delete_a_form_returns_ok_response.frozen new file mode 100644 index 0000000000..602659c5aa --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_delete_a_form_returns_ok_response.frozen @@ -0,0 +1 @@ +2026-06-04T18:34:05.786Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_delete_a_form_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_delete_a_form_returns_ok_response.yaml new file mode 100644 index 0000000000..9da9f04a34 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_delete_a_form_returns_ok_response.yaml @@ -0,0 +1,54 @@ +interactions: +- request: + body: '{"data":{"attributes":{"anonymous":false,"data_definition":{},"description":"A + simple test form.","idp_survey":false,"name":"Test-Delete_a_form_returns_OK_response-1780598045","single_response":false,"ui_definition":{}},"type":"forms"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/forms + response: + body: + string: '{"data":{"id":"257a9d32-6ed0-429b-9745-75366363caf3","type":"forms","attributes":{"active":true,"anonymous":false,"created_at":"2026-06-04T18:34:06.128238Z","datastore_config":{"datastore_id":"1e33b83f-0733-454e-9404-c032a479548e","primary_column_name":"id","primary_key_generation_strategy":"none"},"description":"A + simple test form.","idp_survey":false,"modified_at":"2026-06-04T18:34:06.128238Z","name":"Test-Delete_a_form_returns_OK_response-1780598045","org_id":321813,"self_service":false,"single_response":false,"user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","version":{"id":"354655","state":"draft","version":1,"etag":"b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d","definition_signature":"{\"signature\":\"{\\\"version\\\":2,\\\"algorithm\\\":\\\"ecdsa-p384\\\",\\\"pubkey\\\":\\\"XOOWpRG1rFvaLHaG9qLf+GG78llET0BKnZtokyAtLfg=\\\",\\\"timestamp\\\":1780598046,\\\"proof\\\":\\\"MGQCMDR3p4Wc6qLinT0JK9tT2I3NBvYMx43pPcUuCOyMapne99sS2RJe0woOU68I0GbQvwIwQMw7OQruNsIuTNJxK0zthVCFnXaxLASIvl2NsyomT9s/p2cgEzOY4T+XyRl6i27c\\\"}\",\"version\":1}","data_definition":{},"ui_definition":{},"created_at":"2026-06-04T18:34:06.128238Z","modified_at":"2026-06-04T18:34:06.128238Z","user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v2/forms/257a9d32-6ed0-429b-9745-75366363caf3 + response: + body: + string: '{"data":{"id":"257a9d32-6ed0-429b-9745-75366363caf3","type":"forms"}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v2/forms/257a9d32-6ed0-429b-9745-75366363caf3 + response: + body: + string: '{}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_form_returns_not_found_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_a_form_returns_not_found_response.frozen new file mode 100644 index 0000000000..9e0e0d9867 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_form_returns_not_found_response.frozen @@ -0,0 +1 @@ +2026-06-04T18:34:06.925Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_form_returns_not_found_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_a_form_returns_not_found_response.yaml new file mode 100644 index 0000000000..c6a18c6860 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_form_returns_not_found_response.yaml @@ -0,0 +1,19 @@ +interactions: +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/forms/00000000-0000-0000-0000-000000000001 + response: + body: + string: '{"errors":[{"status":"404","id":"bccf11bd-13c7-4911-9c00-58c00b6f8f52","title":"form + not found"}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_form_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_a_form_returns_ok_response.frozen new file mode 100644 index 0000000000..aea0ca127d --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_form_returns_ok_response.frozen @@ -0,0 +1 @@ +2026-06-04T18:34:07.294Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_form_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_a_form_returns_ok_response.yaml new file mode 100644 index 0000000000..160e466229 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_form_returns_ok_response.yaml @@ -0,0 +1,55 @@ +interactions: +- request: + body: '{"data":{"attributes":{"anonymous":false,"data_definition":{},"description":"A + simple test form.","idp_survey":false,"name":"Test-Get_a_form_returns_OK_response-1780598047","single_response":false,"ui_definition":{}},"type":"forms"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/forms + response: + body: + string: '{"data":{"id":"b42493d4-fbd0-4139-b4b9-4815f414621d","type":"forms","attributes":{"active":true,"anonymous":false,"created_at":"2026-06-04T18:34:07.632566Z","datastore_config":{"datastore_id":"9aace6ce-ee9d-4c81-b176-22bed53ff080","primary_column_name":"id","primary_key_generation_strategy":"none"},"description":"A + simple test form.","idp_survey":false,"modified_at":"2026-06-04T18:34:07.632566Z","name":"Test-Get_a_form_returns_OK_response-1780598047","org_id":321813,"self_service":false,"single_response":false,"user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","version":{"id":"354656","state":"draft","version":1,"etag":"b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d","definition_signature":"{\"signature\":\"{\\\"version\\\":2,\\\"algorithm\\\":\\\"ecdsa-p384\\\",\\\"pubkey\\\":\\\"XOOWpRG1rFvaLHaG9qLf+GG78llET0BKnZtokyAtLfg=\\\",\\\"timestamp\\\":1780598047,\\\"proof\\\":\\\"MGUCMQCkP+Usa2zK0v4SsSDBHsE4p88u025oyaRrAnNTiTXLwGr3K0W4/MAFeeosBwZonE0CMGYsqH/GAJUKeY0ZZGl8GZp2QeY1l3byimzWXRLf36CHhuB1Pshv/7bi0WoYYCOQIg==\\\"}\",\"version\":1}","data_definition":{},"ui_definition":{},"created_at":"2026-06-04T18:34:07.632566Z","modified_at":"2026-06-04T18:34:07.632566Z","user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/forms/b42493d4-fbd0-4139-b4b9-4815f414621d + response: + body: + string: '{"data":{"id":"b42493d4-fbd0-4139-b4b9-4815f414621d","type":"forms","attributes":{"active":true,"anonymous":false,"created_at":"2026-06-04T18:34:07.632566Z","datastore_config":{"datastore_id":"9aace6ce-ee9d-4c81-b176-22bed53ff080","primary_column_name":"id","primary_key_generation_strategy":"none"},"description":"A + simple test form.","idp_survey":false,"modified_at":"2026-06-04T18:34:07.632566Z","name":"Test-Get_a_form_returns_OK_response-1780598047","org_id":321813,"self_service":false,"single_response":false,"user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","version":{"id":"354656","state":"draft","version":1,"etag":"b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d","definition_signature":"{\"signature\":\"{\\\"version\\\":2,\\\"algorithm\\\":\\\"ecdsa-p384\\\",\\\"pubkey\\\":\\\"XOOWpRG1rFvaLHaG9qLf+GG78llET0BKnZtokyAtLfg=\\\",\\\"timestamp\\\":1780598047,\\\"proof\\\":\\\"MGUCMQCkP+Usa2zK0v4SsSDBHsE4p88u025oyaRrAnNTiTXLwGr3K0W4/MAFeeosBwZonE0CMGYsqH/GAJUKeY0ZZGl8GZp2QeY1l3byimzWXRLf36CHhuB1Pshv/7bi0WoYYCOQIg==\\\"}\",\"version\":1}","data_definition":{},"ui_definition":{},"created_at":"2026-06-04T18:34:07.632566Z","modified_at":"2026-06-04T18:34:07.632566Z","user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v2/forms/b42493d4-fbd0-4139-b4b9-4815f414621d + response: + body: + string: '{"data":{"id":"b42493d4-fbd0-4139-b4b9-4815f414621d","type":"forms"}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_list_forms_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_list_forms_returns_ok_response.frozen new file mode 100644 index 0000000000..e1050a989d --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_list_forms_returns_ok_response.frozen @@ -0,0 +1 @@ +2026-06-04T18:34:08.479Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_list_forms_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_list_forms_returns_ok_response.yaml new file mode 100644 index 0000000000..f27c73922a --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_list_forms_returns_ok_response.yaml @@ -0,0 +1,59 @@ +interactions: +- request: + body: '{"data":{"attributes":{"anonymous":false,"data_definition":{},"description":"A + simple test form.","idp_survey":false,"name":"Test-List_forms_returns_OK_response-1780598048","single_response":false,"ui_definition":{}},"type":"forms"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/forms + response: + body: + string: '{"data":{"id":"d71d1aef-539d-4951-b98e-ff4c0c4f97bb","type":"forms","attributes":{"active":true,"anonymous":false,"created_at":"2026-06-04T18:34:08.937305Z","datastore_config":{"datastore_id":"76b9f7b4-99d8-4a55-b95c-260cac22820d","primary_column_name":"id","primary_key_generation_strategy":"none"},"description":"A + simple test form.","idp_survey":false,"modified_at":"2026-06-04T18:34:08.937305Z","name":"Test-List_forms_returns_OK_response-1780598048","org_id":321813,"self_service":false,"single_response":false,"user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","version":{"id":"354657","state":"draft","version":1,"etag":"b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d","definition_signature":"{\"signature\":\"{\\\"version\\\":2,\\\"algorithm\\\":\\\"ecdsa-p384\\\",\\\"pubkey\\\":\\\"XOOWpRG1rFvaLHaG9qLf+GG78llET0BKnZtokyAtLfg=\\\",\\\"timestamp\\\":1780598048,\\\"proof\\\":\\\"MGUCMBSAXvYX++PAyywDBLlJsqgHq1ug3WLtMqKQRwx50qdAdj1UP1W58NnN9/DP70HavAIxANwA4guivHrOqlL36ETzde//0mI55MJ8Yv0ynU2p+QhqCSuJEHHgUUWjk0wYKJuZog==\\\"}\",\"version\":1}","data_definition":{},"ui_definition":{},"created_at":"2026-06-04T18:34:08.937305Z","modified_at":"2026-06-04T18:34:08.937305Z","user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/forms + response: + body: + string: '{"data":[{"id":"7af864d6-8c2f-41e5-b80d-1be56ea33d23","type":"forms","attributes":{"active":true,"anonymous":false,"created_at":"2026-06-04T18:05:41.512876Z","datastore_config":{"datastore_id":"543a7e0e-0f0f-4b14-8911-2f20df5f1b07","primary_column_name":"id","primary_key_generation_strategy":"none"},"description":"A + form to collect user feedback.","idp_survey":false,"modified_at":"2026-06-04T18:05:41.512876Z","name":"User + Feedback Form","org_id":321813,"self_service":false,"single_response":false,"user_id":1445416,"user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},{"id":"b2953c07-9385-4de2-9cd3-af3f5d6c7d09","type":"forms","attributes":{"active":true,"anonymous":false,"created_at":"2026-06-04T18:15:44.116619Z","datastore_config":{"datastore_id":"77b4b384-27d6-4619-bb55-1b2158d0080b","primary_column_name":"id","primary_key_generation_strategy":"none"},"description":"A + form to collect user feedback.","idp_survey":false,"modified_at":"2026-06-04T18:15:44.116619Z","name":"User + Feedback Form","org_id":321813,"self_service":false,"single_response":false,"user_id":1445416,"user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},{"id":"d71d1aef-539d-4951-b98e-ff4c0c4f97bb","type":"forms","attributes":{"active":true,"anonymous":false,"created_at":"2026-06-04T18:34:08.937305Z","datastore_config":{"datastore_id":"76b9f7b4-99d8-4a55-b95c-260cac22820d","primary_column_name":"id","primary_key_generation_strategy":"none"},"description":"A + simple test form.","idp_survey":false,"modified_at":"2026-06-04T18:34:08.937305Z","name":"Test-List_forms_returns_OK_response-1780598048","org_id":321813,"self_service":false,"single_response":false,"user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v2/forms/d71d1aef-539d-4951-b98e-ff4c0c4f97bb + response: + body: + string: '{"data":{"id":"d71d1aef-539d-4951-b98e-ff4c0c4f97bb","type":"forms"}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v2/features/forms.feature b/tests/v2/features/forms.feature new file mode 100644 index 0000000000..40823edbc0 --- /dev/null +++ b/tests/v2/features/forms.feature @@ -0,0 +1,107 @@ +@endpoint(forms) @endpoint(forms-v2) +Feature: Forms + The Datadog Forms API lets you create and manage forms within the App + Builder platform. You can configure form settings, manage versions, + publish forms, and handle sharing configurations. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "Forms" API + + @generated @skip @team:DataDog/app-builder-backend + Scenario: Create a form returns "Bad Request" response + Given operation "CreateForm" enabled + And new "CreateForm" request + And body with value {"data": {"attributes": {"anonymous": false, "data_definition": {"description": "Welcome to the Engineering Experience Survey.", "required": [], "title": "Developer Experience Survey", "type": "object"}, "description": "A form to collect user feedback.", "idp_survey": false, "name": "User Feedback Form", "single_response": false, "ui_definition": {"ui:order": [], "ui:theme": {"primaryColor": "gray"}}}, "type": "forms"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/app-builder-backend + Scenario: Create a form returns "OK" response + Given operation "CreateForm" enabled + And new "CreateForm" request + And body with value {"data": {"attributes": {"anonymous": false, "data_definition": {}, "description": "A form to collect user feedback.", "idp_survey": false, "name": "User Feedback Form", "single_response": false, "ui_definition": {}}, "type": "forms"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/app-builder-backend + Scenario: Create and publish a form returns "Bad Request" response + Given operation "CreateAndPublishForm" enabled + And new "CreateAndPublishForm" request + And body with value {"data": {"attributes": {"anonymous": false, "data_definition": {"description": "Welcome to the Engineering Experience Survey.", "required": [], "title": "Developer Experience Survey", "type": "object"}, "description": "A form to collect user feedback.", "idp_survey": false, "name": "User Feedback Form", "single_response": false, "ui_definition": {"ui:order": [], "ui:theme": {"primaryColor": "gray"}}}, "type": "forms"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/app-builder-backend + Scenario: Create and publish a form returns "OK" response + Given operation "CreateAndPublishForm" enabled + And new "CreateAndPublishForm" request + And body with value {"data": {"attributes": {"anonymous": false, "data_definition": {}, "description": "A form to collect user feedback.", "idp_survey": false, "name": "User Feedback Form", "single_response": false, "ui_definition": {}}, "type": "forms"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/app-builder-backend + Scenario: Delete a form returns "Bad Request" response + Given operation "DeleteForm" enabled + And new "DeleteForm" request + And request contains "form_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/app-builder-backend + Scenario: Delete a form returns "OK" response + Given operation "DeleteForm" enabled + And there is a valid "form" in the system + And new "DeleteForm" request + And request contains "form_id" parameter from "form.data.id" + When the request is sent + Then the response status is 200 OK + And the response "data.id" has the same value as "form.data.id" + And the response "data.type" is equal to "forms" + + @generated @skip @team:DataDog/app-builder-backend + Scenario: Get a form returns "Bad Request" response + Given operation "GetForm" enabled + And new "GetForm" request + And request contains "form_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/app-builder-backend + Scenario: Get a form returns "Not Found" response + Given operation "GetForm" enabled + And new "GetForm" request + And request contains "form_id" parameter with value "00000000-0000-0000-0000-000000000001" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/app-builder-backend + Scenario: Get a form returns "OK" response + Given operation "GetForm" enabled + And there is a valid "form" in the system + And new "GetForm" request + And request contains "form_id" parameter from "form.data.id" + When the request is sent + Then the response status is 200 OK + And the response "data.id" has the same value as "form.data.id" + And the response "data.type" is equal to "forms" + And the response "data.attributes.name" is equal to "{{ unique }}" + + @generated @skip @team:DataDog/app-builder-backend + Scenario: List forms returns "Bad Request" response + Given operation "ListForms" enabled + And new "ListForms" request + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/app-builder-backend + Scenario: List forms returns "OK" response + Given operation "ListForms" enabled + And there is a valid "form" in the system + And new "ListForms" request + When the request is sent + Then the response status is 200 OK + And the response "data" has item with field "id" with value "{{ form.data.id }}" + And the response "data" has item with field "type" with value "forms" + And the response "data" has item with field "attributes.name" with value "{{ unique }}" diff --git a/tests/v2/features/given.json b/tests/v2/features/given.json index 0e1e956697..0a6db71d71 100644 --- a/tests/v2/features/given.json +++ b/tests/v2/features/given.json @@ -498,6 +498,30 @@ "tag": "Feature Flags", "operationId": "UpdateAllocationsForFeatureFlagInEnvironment" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"forms\",\n \"attributes\": {\n \"name\": \"{{ unique }}\",\n \"description\": \"A simple test form.\",\n \"anonymous\": false,\n \"single_response\": false,\n \"idp_survey\": false,\n \"data_definition\": {},\n \"ui_definition\": {}\n }\n }\n}" + } + ], + "step": "there is a valid \"form\" in the system", + "key": "form", + "tag": "Forms", + "operationId": "CreateForm" + }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"forms\",\n \"attributes\": {\n \"name\": \"{{ unique }}\",\n \"description\": \"A simple test form.\",\n \"anonymous\": false,\n \"single_response\": false,\n \"idp_survey\": false,\n \"data_definition\": {},\n \"ui_definition\": {}\n }\n }\n}" + } + ], + "step": "there is a valid \"form_published\" in the system", + "key": "form_published", + "tag": "Forms", + "operationId": "CreateAndPublishForm" + }, { "parameters": [ { diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 9101d0155c..61278fe120 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -2609,6 +2609,50 @@ "type": "unsafe" } }, + "ListForms": { + "tag": "Forms", + "undo": { + "type": "safe" + } + }, + "CreateForm": { + "tag": "Forms", + "undo": { + "operationId": "DeleteForm", + "parameters": [ + { + "name": "form_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "CreateAndPublishForm": { + "tag": "Forms", + "undo": { + "operationId": "DeleteForm", + "parameters": [ + { + "name": "form_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteForm": { + "tag": "Forms", + "undo": { + "type": "idempotent" + } + }, + "GetForm": { + "tag": "Forms", + "undo": { + "type": "safe" + } + }, "GetHamrOrgConnection": { "tag": "High Availability MultiRegion", "undo": {