diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index e694506b53cd..d08b316118dd 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -17307,6 +17307,32 @@ components: required: - type type: object + CloneFormData: + description: The data for cloning a form. + properties: + attributes: + $ref: "#/components/schemas/CloneFormDataAttributes" + type: + $ref: "#/components/schemas/FormType" + required: + - type + type: object + CloneFormDataAttributes: + description: The attributes for cloning a form. + properties: + name: + description: The name for the cloned form. Defaults to "Copy of (source form name)" if not provided. + example: Copy of My Form + type: string + type: object + CloneFormRequest: + description: A request to clone a form. + properties: + data: + $ref: "#/components/schemas/CloneFormData" + required: + - data + type: object CloudAssetType: description: The cloud asset type enum: @@ -37339,6 +37365,39 @@ components: - user_id - user_uuid type: object + FormPublicationData: + description: A form publication resource object. + properties: + attributes: + $ref: "#/components/schemas/FormPublicationAttributes" + id: + description: The ID of the form publication. + example: "42" + type: string + type: + $ref: "#/components/schemas/FormPublicationType" + required: + - id + - type + - attributes + type: object + FormPublicationResponse: + description: A response containing a single form publication. + properties: + data: + $ref: "#/components/schemas/FormPublicationData" + required: + - data + type: object + FormPublicationType: + default: form_publications + description: The resource type for a form publication. + enum: + - form_publications + example: form_publications + type: string + x-enum-varnames: + - FORM_PUBLICATIONS FormResponse: description: A response containing a single form. properties: @@ -37415,6 +37474,20 @@ components: - DARK_BLUE - MAGENTA - INDIGO + FormUpdateAttributes: + description: The fields to update on a form. At least one field must be provided. + properties: + datastore_config: + $ref: "#/components/schemas/FormDatastoreConfigAttributes" + description: + description: The updated description of the form. + example: An updated description. + type: string + name: + description: The updated name of the form. + example: Updated Form Name + type: string + type: object FormVersionAttributes: description: The attributes of a form version. properties: @@ -37474,6 +37547,30 @@ components: - user_uuid - version type: object + FormVersionData: + description: A form version resource object. + properties: + attributes: + $ref: "#/components/schemas/FormVersionAttributes" + id: + description: The ID of the form version. + example: "126" + type: string + type: + $ref: "#/components/schemas/FormVersionType" + required: + - id + - type + - attributes + type: object + FormVersionResponse: + description: A response containing a single form version. + properties: + data: + $ref: "#/components/schemas/FormVersionData" + required: + - data + type: object FormVersionState: description: The state of a form version. enum: @@ -37484,6 +37581,15 @@ components: x-enum-varnames: - DRAFT - FROZEN + FormVersionType: + default: form_versions + description: The resource type for a form version. + enum: + - form_versions + example: form_versions + type: string + x-enum-varnames: + - FORM_VERSIONS FormsResponse: description: A response containing a list of forms. properties: @@ -51951,6 +52057,16 @@ components: - PHP - KOTLIN - SWIFT + LatestVersionMatchPolicy: + description: The policy for matching the latest form version during an upsert operation. + enum: + - none + - if_etag_match + example: none + type: string + x-enum-varnames: + - NONE + - IF_ETAG_MATCH LaunchDarklyAPIKey: description: The definition of the `LaunchDarklyAPIKey` object. properties: @@ -71266,6 +71382,36 @@ components: data: $ref: "#/components/schemas/Deployment" type: object + PublishFormData: + description: The data for publishing a form version. + properties: + attributes: + $ref: "#/components/schemas/PublishFormDataAttributes" + type: + $ref: "#/components/schemas/FormPublicationType" + required: + - type + - attributes + type: object + PublishFormDataAttributes: + description: The attributes for publishing a form version. + properties: + version: + description: The version number to publish. + example: 1 + format: int64 + type: integer + required: + - version + type: object + PublishFormRequest: + description: A request to publish a form version. + properties: + data: + $ref: "#/components/schemas/PublishFormData" + required: + - data + type: object PublishRequestType: default: publishRequest description: The publish-request resource type. @@ -99721,6 +99867,38 @@ components: - id - success type: object + UpdateFormData: + description: The data for updating a form. + properties: + attributes: + $ref: "#/components/schemas/UpdateFormDataAttributes" + id: + description: The ID of the form. + example: 22f6006a-2302-4926-9396-d2dfcf7b0b34 + format: uuid + type: string + type: + $ref: "#/components/schemas/FormType" + required: + - type + - attributes + type: object + UpdateFormDataAttributes: + description: The attributes for updating a form. + properties: + form_update: + $ref: "#/components/schemas/FormUpdateAttributes" + required: + - form_update + type: object + UpdateFormRequest: + description: A request to update a form. + properties: + data: + $ref: "#/components/schemas/UpdateFormData" + required: + - data + type: object UpdateOnCallNotificationRuleRequest: description: A top-level wrapper for updating a notification rule for a user example: @@ -100503,6 +100681,59 @@ components: - id - attributes type: object + UpsertFormVersionData: + description: The data for creating or updating a form version. + properties: + attributes: + $ref: "#/components/schemas/UpsertFormVersionDataAttributes" + type: + $ref: "#/components/schemas/FormVersionType" + required: + - type + - attributes + type: object + UpsertFormVersionDataAttributes: + description: The attributes for creating or updating a form version. + properties: + data_definition: + $ref: "#/components/schemas/FormDataDefinition" + state: + $ref: "#/components/schemas/FormVersionState" + ui_definition: + $ref: "#/components/schemas/FormUiDefinition" + upsert_params: + $ref: "#/components/schemas/UpsertFormVersionUpsertParams" + required: + - state + - data_definition + - ui_definition + - upsert_params + type: object + UpsertFormVersionRequest: + description: A request to create or update a form version. + properties: + data: + $ref: "#/components/schemas/UpsertFormVersionData" + required: + - data + type: object + UpsertFormVersionUpsertParams: + description: Concurrency control parameters for the form version upsert operation. + properties: + etag: + description: The ETag of the latest version. Required when `match_policy` is `if_etag_match`. + example: b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d + nullable: true + type: string + insert_only: + description: If true, only a new version may be inserted; updating the current draft is not allowed. + example: false + type: boolean + match_policy: + $ref: "#/components/schemas/LatestVersionMatchPolicy" + required: + - match_policy + type: object UpsertOAuthScopesRestrictionData: description: Data object of an upsert OAuth2 scopes restriction request. properties: @@ -127558,6 +127789,331 @@ paths: 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/). + patch: + description: Update a form's properties such as its name, description, or datastore configuration. + operationId: UpdateForm + 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 + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + form_update: + description: An updated description. + name: Updated Form Name + type: forms + schema: + $ref: "#/components/schemas/UpdateFormRequest" + 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: An updated description. + end_date: + idp_survey: false + modified_at: "2026-05-29T20:06:15.000000Z" + name: Updated Form Name + 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: Update 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}/clone: + post: + description: Clone an existing form. The clone is created in draft mode using the source form's latest version. + operationId: CloneForm + parameters: + - description: The ID of the form to clone. + example: 22f6006a-2302-4926-9396-d2dfcf7b0b34 + in: path + name: form_id + required: true + schema: + format: uuid + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + name: Copy of My Form + type: forms + schema: + $ref: "#/components/schemas/CloneFormRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + active: true + anonymous: false + created_at: "2026-05-30T10:00:00.000000Z" + datastore_config: + datastore_id: a2b3c4d5-e6f7-8901-2345-6789abcdef01 + 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-30T10:00:00.000000Z" + name: Copy of My Form + org_id: 2 + self_service: false + single_response: false + user_id: 10001 + user_uuid: 1fc709aa-be19-4539-a47d-52a30d78a978 + id: 7a1e9054-5f6a-4b08-9e3d-c2f189a3bce0 + 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: Clone 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}/publish: + post: + description: Publish a specific version of a form, making it available for submissions. + operationId: PublishForm + 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 + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + version: 1 + type: form_publications + schema: + $ref: "#/components/schemas/PublishFormRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2026-05-29T20:06:13.677353Z" + form_id: afc67600-0511-43b1-9b18-578fb4979bd3 + form_version: 1 + id: "42" + modified_at: "2026-05-29T20:06:13.677353Z" + org_id: 2 + publish_seq: 1 + user_id: 10001 + user_uuid: 1fc709aa-be19-4539-a47d-52a30d78a978 + id: "42" + type: form_publications + schema: + $ref: "#/components/schemas/FormPublicationResponse" + 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: Publish a form version + 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}/versions: + post: + description: |- + Create or update the latest draft version of a form. The `upsert_params` field controls + optimistic concurrency behavior. + operationId: UpsertFormVersion + 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 + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + data_definition: {} + state: draft + ui_definition: {} + upsert_params: + match_policy: none + type: form_versions + schema: + $ref: "#/components/schemas/UpsertFormVersionRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2026-05-29T20:06:14.895921Z" + data_definition: + $ref: "#/components/schemas/FormDataDefinition" + definition_signature: '{"signature":"b7f312957a80cea2c8c9950532b205a90a3f8a7ebb7e52fc25437a25d903d545","version":1}' + etag: b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d + modified_at: "2026-05-29T20:06:14.949163Z" + state: draft + ui_definition: {} + user_id: 10001 + user_uuid: 1fc709aa-be19-4539-a47d-52a30d78a978 + version: 2 + id: "126" + type: form_versions + schema: + $ref: "#/components/schemas/FormVersionResponse" + 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: Create or update a form version + 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: |- @@ -183619,7 +184175,8 @@ tags: - 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. + The Datadog Forms API lets you create and manage forms within the App Builder platform. + You can configure form settings, manage versions, and publish forms. name: Forms - description: |- Configure your Datadog-Google Cloud Platform (GCP) integration directly diff --git a/cassettes/features/v2/forms/Clone-a-form-returns-Not-Found-response.frozen b/cassettes/features/v2/forms/Clone-a-form-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..3cb13361bfbb --- /dev/null +++ b/cassettes/features/v2/forms/Clone-a-form-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2026-06-10T18:49:58.475Z \ No newline at end of file diff --git a/cassettes/features/v2/forms/Clone-a-form-returns-Not-Found-response.yml b/cassettes/features/v2/forms/Clone-a-form-returns-Not-Found-response.yml new file mode 100644 index 000000000000..9ca595b76cec --- /dev/null +++ b/cassettes/features/v2/forms/Clone-a-form-returns-Not-Found-response.yml @@ -0,0 +1,25 @@ +http_interactions: +- recorded_at: Wed, 10 Jun 2026 18:49:58 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"name":"Copy of My Form"},"type":"forms"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/forms/00000000-0000-0000-0000-000000000001/clone + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"404","id":"32db2695-29bd-4280-b547-3737365608c3","title":"form + not found"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/forms/Create-or-update-a-form-version-returns-Not-Found-response.frozen b/cassettes/features/v2/forms/Create-or-update-a-form-version-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..e11ef0b046e8 --- /dev/null +++ b/cassettes/features/v2/forms/Create-or-update-a-form-version-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2026-06-10T18:49:59.498Z \ No newline at end of file diff --git a/cassettes/features/v2/forms/Create-or-update-a-form-version-returns-Not-Found-response.yml b/cassettes/features/v2/forms/Create-or-update-a-form-version-returns-Not-Found-response.yml new file mode 100644 index 000000000000..fb226f26fd69 --- /dev/null +++ b/cassettes/features/v2/forms/Create-or-update-a-form-version-returns-Not-Found-response.yml @@ -0,0 +1,27 @@ +http_interactions: +- recorded_at: Wed, 10 Jun 2026 18:49:59 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"data_definition":{"description":"Welcome to + the Engineering Experience Survey.","required":[],"title":"Developer Experience + Survey","type":"object"},"state":"frozen","ui_definition":{"ui:order":[],"ui:theme":{"primaryColor":"gray"}},"upsert_params":{"etag":"b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d","insert_only":false,"match_policy":"none"}},"type":"form_versions"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/forms/00000000-0000-0000-0000-000000000001/versions + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"404","id":"f24e2ab1-4ba1-48cf-a4a2-86a32cc2e702","title":"form + not found"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/forms/Create-or-update-a-form-version-returns-OK-response.frozen b/cassettes/features/v2/forms/Create-or-update-a-form-version-returns-OK-response.frozen new file mode 100644 index 000000000000..825b0d0aab6c --- /dev/null +++ b/cassettes/features/v2/forms/Create-or-update-a-form-version-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-06-10T18:49:59.826Z \ No newline at end of file diff --git a/cassettes/features/v2/forms/Create-or-update-a-form-version-returns-OK-response.yml b/cassettes/features/v2/forms/Create-or-update-a-form-version-returns-OK-response.yml new file mode 100644 index 000000000000..86153dacd82b --- /dev/null +++ b/cassettes/features/v2/forms/Create-or-update-a-form-version-returns-OK-response.yml @@ -0,0 +1,70 @@ +http_interactions: +- recorded_at: Wed, 10 Jun 2026 18:49:59 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"anonymous":false,"data_definition":{},"description":"A + simple test form.","idp_survey":false,"name":"Test-Create_or_update_a_form_version_returns_OK_response-1781117399","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: + encoding: UTF-8 + string: '{"data":{"id":"49ccfa97-825c-46f8-872b-5368fd1b56a4","type":"forms","attributes":{"active":true,"anonymous":false,"created_at":"2026-06-10T18:50:00.188982Z","datastore_config":{"datastore_id":"be7e7cf5-6a73-4d07-9654-a40997bee800","primary_column_name":"id","primary_key_generation_strategy":"none"},"description":"A + simple test form.","idp_survey":false,"modified_at":"2026-06-10T18:50:00.188982Z","name":"Test-Create_or_update_a_form_version_returns_OK_response-1781117399","org_id":321813,"self_service":false,"single_response":false,"user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","version":{"id":"376765","state":"draft","version":1,"etag":"b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d","definition_signature":"{\"signature\":\"{\\\"version\\\":2,\\\"algorithm\\\":\\\"ecdsa-p384\\\",\\\"pubkey\\\":\\\"S2KAuCoip8JbyZNOT2gYbpUouidttEGvYWyvqeoMQjE=\\\",\\\"timestamp\\\":1781117400,\\\"proof\\\":\\\"MGUCMQDyae03EWzAe3gENsZt4WVLiPP8TGQg7UO7I28dcEK5w70MRYRf9x18lDXfOEDoPrgCMCHlQeXp/K5AKKmyVYwtJd9VI1SsJoOBOXbj26BhPKZBF386oH7LxK45J12htxj9hw==\\\"}\",\"version\":1}","data_definition":{},"ui_definition":{},"created_at":"2026-06-10T18:50:00.188982Z","modified_at":"2026-06-10T18:50:00.188982Z","user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Wed, 10 Jun 2026 18:49:59 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"data_definition":{"description":"Welcome to + the Engineering Experience Survey.","required":[],"title":"Developer Experience + Survey","type":"object"},"state":"frozen","ui_definition":{"ui:order":[],"ui:theme":{"primaryColor":"gray"}},"upsert_params":{"etag":"b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d","insert_only":false,"match_policy":"none"}},"type":"form_versions"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/forms/49ccfa97-825c-46f8-872b-5368fd1b56a4/versions + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"376765","type":"form_versions","attributes":{"created_at":"2026-06-10T18:50:00.188982Z","data_definition":{"description":"Welcome + to the Engineering Experience Survey.","required":[],"title":"Developer Experience + Survey","type":"object"},"definition_signature":"{\"signature\":\"{\\\"version\\\":2,\\\"algorithm\\\":\\\"ecdsa-p384\\\",\\\"pubkey\\\":\\\"XOOWpRG1rFvaLHaG9qLf+GG78llET0BKnZtokyAtLfg=\\\",\\\"timestamp\\\":1781117400,\\\"proof\\\":\\\"MGQCMGbAihRvSVO+KjM9uttjprG+2ZR6D5kKoXwIS4em5mjg9StXgu/pi08NfU4WMdTD8wIwcxxGWh+MzG6awNnii2Cjl46YNhPBV39JpU03mlQsb+9cGVgqL2JYVsDaAJ0G+YzN\\\"}\",\"version\":1}","etag":"30586851d6ab0b26080d3f34629e5e2cfb9f2f57457eec927b72eafefae81e48","modified_at":"2026-06-10T18:50:00.568923Z","state":"frozen","ui_definition":{"ui:order":[],"ui:theme":{"primaryColor":"gray"}},"user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","version":1}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Wed, 10 Jun 2026 18:49:59 GMT + request: + body: null + headers: + Accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v2/forms/49ccfa97-825c-46f8-872b-5368fd1b56a4 + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"49ccfa97-825c-46f8-872b-5368fd1b56a4","type":"forms"}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/forms/Publish-a-form-version-returns-Not-Found-response.frozen b/cassettes/features/v2/forms/Publish-a-form-version-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..bb764fbf5b28 --- /dev/null +++ b/cassettes/features/v2/forms/Publish-a-form-version-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2026-06-10T18:50:01.064Z \ No newline at end of file diff --git a/cassettes/features/v2/forms/Publish-a-form-version-returns-Not-Found-response.yml b/cassettes/features/v2/forms/Publish-a-form-version-returns-Not-Found-response.yml new file mode 100644 index 000000000000..4fee5eb7c931 --- /dev/null +++ b/cassettes/features/v2/forms/Publish-a-form-version-returns-Not-Found-response.yml @@ -0,0 +1,25 @@ +http_interactions: +- recorded_at: Wed, 10 Jun 2026 18:50:01 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"version":1},"type":"form_publications"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/forms/00000000-0000-0000-0000-000000000001/publish + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"404","id":"890f7bea-c0e2-45f9-a06a-e3214a19be57","title":"form + not found"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/forms/Publish-a-form-version-returns-OK-response.frozen b/cassettes/features/v2/forms/Publish-a-form-version-returns-OK-response.frozen new file mode 100644 index 000000000000..1468de2aa1d6 --- /dev/null +++ b/cassettes/features/v2/forms/Publish-a-form-version-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-06-10T18:50:01.393Z \ No newline at end of file diff --git a/cassettes/features/v2/forms/Publish-a-form-version-returns-OK-response.yml b/cassettes/features/v2/forms/Publish-a-form-version-returns-OK-response.yml new file mode 100644 index 000000000000..8b1165067622 --- /dev/null +++ b/cassettes/features/v2/forms/Publish-a-form-version-returns-OK-response.yml @@ -0,0 +1,66 @@ +http_interactions: +- recorded_at: Wed, 10 Jun 2026 18:50:01 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"anonymous":false,"data_definition":{},"description":"A + simple test form.","idp_survey":false,"name":"Test-Publish_a_form_version_returns_OK_response-1781117401","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: + encoding: UTF-8 + string: '{"data":{"id":"c73796e4-0dd3-4da4-8a9a-9297ba412b3e","type":"forms","attributes":{"active":true,"anonymous":false,"created_at":"2026-06-10T18:50:01.747408Z","datastore_config":{"datastore_id":"23249c30-b740-4a4b-8c23-34fb653dfdea","primary_column_name":"id","primary_key_generation_strategy":"none"},"description":"A + simple test form.","idp_survey":false,"modified_at":"2026-06-10T18:50:01.747408Z","name":"Test-Publish_a_form_version_returns_OK_response-1781117401","org_id":321813,"self_service":false,"single_response":false,"user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","version":{"id":"376767","state":"draft","version":1,"etag":"b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d","definition_signature":"{\"signature\":\"{\\\"version\\\":2,\\\"algorithm\\\":\\\"ecdsa-p384\\\",\\\"pubkey\\\":\\\"XOOWpRG1rFvaLHaG9qLf+GG78llET0BKnZtokyAtLfg=\\\",\\\"timestamp\\\":1781117401,\\\"proof\\\":\\\"MGYCMQCE98ZIPD8JYrsEi1xXxe+8SVCjLroQbr+RRxKDmhfT++nN4tdcUXYYNtpNJDundgwCMQDG5TdraksHELR6ovN9xQtacfKq3wr2rKAIejh6Ut7m+jO5dmLml90pBOQMnAFXed4=\\\"}\",\"version\":1}","data_definition":{},"ui_definition":{},"created_at":"2026-06-10T18:50:01.747408Z","modified_at":"2026-06-10T18:50:01.747408Z","user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Wed, 10 Jun 2026 18:50:01 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"version":1},"type":"form_publications"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/forms/c73796e4-0dd3-4da4-8a9a-9297ba412b3e/publish + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"380020","type":"form_publications","attributes":{"created_at":"2026-06-10T18:50:02.131227Z","form_id":"c73796e4-0dd3-4da4-8a9a-9297ba412b3e","form_version":1,"modified_at":"2026-06-10T18:50:02.131227Z","org_id":321813,"publish_seq":1,"user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Wed, 10 Jun 2026 18:50:01 GMT + request: + body: null + headers: + Accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v2/forms/c73796e4-0dd3-4da4-8a9a-9297ba412b3e + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"c73796e4-0dd3-4da4-8a9a-9297ba412b3e","type":"forms"}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/forms/Update-a-form-returns-Not-Found-response.frozen b/cassettes/features/v2/forms/Update-a-form-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..6a4eb039c7e2 --- /dev/null +++ b/cassettes/features/v2/forms/Update-a-form-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2026-06-10T18:50:02.747Z \ No newline at end of file diff --git a/cassettes/features/v2/forms/Update-a-form-returns-Not-Found-response.yml b/cassettes/features/v2/forms/Update-a-form-returns-Not-Found-response.yml new file mode 100644 index 000000000000..28f905b40b24 --- /dev/null +++ b/cassettes/features/v2/forms/Update-a-form-returns-Not-Found-response.yml @@ -0,0 +1,26 @@ +http_interactions: +- recorded_at: Wed, 10 Jun 2026 18:50:02 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"form_update":{"datastore_config":{"datastore_id":"5108ea24-dd83-4696-9caa-f069f73d0fad","primary_column_name":"id","primary_key_generation_strategy":"none"},"description":"An + updated description.","name":"Updated Form Name"}},"id":"22f6006a-2302-4926-9396-d2dfcf7b0b34","type":"forms"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/forms/00000000-0000-0000-0000-000000000001 + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"404","id":"c5564241-69a8-4a9e-af78-20c7913fbf5b","title":"form + not found"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/forms/Update-a-form-returns-OK-response.frozen b/cassettes/features/v2/forms/Update-a-form-returns-OK-response.frozen new file mode 100644 index 000000000000..131934de132a --- /dev/null +++ b/cassettes/features/v2/forms/Update-a-form-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-06-10T18:50:03.118Z \ No newline at end of file diff --git a/cassettes/features/v2/forms/Update-a-form-returns-OK-response.yml b/cassettes/features/v2/forms/Update-a-form-returns-OK-response.yml new file mode 100644 index 000000000000..2e1e28f97f38 --- /dev/null +++ b/cassettes/features/v2/forms/Update-a-form-returns-OK-response.yml @@ -0,0 +1,69 @@ +http_interactions: +- recorded_at: Wed, 10 Jun 2026 18:50:03 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"anonymous":false,"data_definition":{},"description":"A + simple test form.","idp_survey":false,"name":"Test-Update_a_form_returns_OK_response-1781117403","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: + encoding: UTF-8 + string: '{"data":{"id":"a365c4e1-5c1f-476f-9330-091fe52a6483","type":"forms","attributes":{"active":true,"anonymous":false,"created_at":"2026-06-10T18:50:03.541399Z","datastore_config":{"datastore_id":"ec62b00b-6683-4943-8bd0-28d56f5dca64","primary_column_name":"id","primary_key_generation_strategy":"none"},"description":"A + simple test form.","idp_survey":false,"modified_at":"2026-06-10T18:50:03.541399Z","name":"Test-Update_a_form_returns_OK_response-1781117403","org_id":321813,"self_service":false,"single_response":false,"user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","version":{"id":"376768","state":"draft","version":1,"etag":"b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d","definition_signature":"{\"signature\":\"{\\\"version\\\":2,\\\"algorithm\\\":\\\"ecdsa-p384\\\",\\\"pubkey\\\":\\\"XOOWpRG1rFvaLHaG9qLf+GG78llET0BKnZtokyAtLfg=\\\",\\\"timestamp\\\":1781117403,\\\"proof\\\":\\\"MGUCMFvO8GziqWVPfIg06kFsX3mHcT5e/Ub8cJ/9H1oJXqCp56oL/IRLCI351BB2xHXTFAIxALOhp9M+jw87Xn+Qvl//9uiS011jgg6a8e0UftJ1NY+G/ycp/aLzZrFKaBCt6RG8sA==\\\"}\",\"version\":1}","data_definition":{},"ui_definition":{},"created_at":"2026-06-10T18:50:03.541399Z","modified_at":"2026-06-10T18:50:03.541399Z","user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Wed, 10 Jun 2026 18:50:03 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"form_update":{"datastore_config":{"datastore_id":"5108ea24-dd83-4696-9caa-f069f73d0fad","primary_column_name":"id","primary_key_generation_strategy":"none"},"description":"An + updated description.","name":"Updated Form Name"}},"id":"22f6006a-2302-4926-9396-d2dfcf7b0b34","type":"forms"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/forms/a365c4e1-5c1f-476f-9330-091fe52a6483 + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"a365c4e1-5c1f-476f-9330-091fe52a6483","type":"forms","attributes":{"active":true,"anonymous":false,"created_at":"2026-06-10T18:50:03.541399Z","datastore_config":{"datastore_id":"5108ea24-dd83-4696-9caa-f069f73d0fad","primary_column_name":"id","primary_key_generation_strategy":"none"},"description":"An + updated description.","idp_survey":false,"modified_at":"2026-06-10T18:50:03.926234Z","name":"Updated + Form Name","org_id":321813,"self_service":false,"single_response":false,"user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","version":{"id":"376768","state":"draft","version":1,"etag":"b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d","definition_signature":"{\"signature\":\"{\\\"version\\\":2,\\\"algorithm\\\":\\\"ecdsa-p384\\\",\\\"pubkey\\\":\\\"XOOWpRG1rFvaLHaG9qLf+GG78llET0BKnZtokyAtLfg=\\\",\\\"timestamp\\\":1781117403,\\\"proof\\\":\\\"MGUCMFvO8GziqWVPfIg06kFsX3mHcT5e/Ub8cJ/9H1oJXqCp56oL/IRLCI351BB2xHXTFAIxALOhp9M+jw87Xn+Qvl//9uiS011jgg6a8e0UftJ1NY+G/ycp/aLzZrFKaBCt6RG8sA==\\\"}\",\"version\":1}","data_definition":{},"ui_definition":{},"created_at":"2026-06-10T18:50:03.541399Z","modified_at":"2026-06-10T18:50:03.541399Z","user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Wed, 10 Jun 2026 18:50:03 GMT + request: + body: null + headers: + Accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v2/forms/a365c4e1-5c1f-476f-9330-091fe52a6483 + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"a365c4e1-5c1f-476f-9330-091fe52a6483","type":"forms"}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/examples/v2/forms/CloneForm.rb b/examples/v2/forms/CloneForm.rb new file mode 100644 index 000000000000..122aaa8dd6d5 --- /dev/null +++ b/examples/v2/forms/CloneForm.rb @@ -0,0 +1,17 @@ +# Clone a form returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.clone_form".to_sym] = true +end +api_instance = DatadogAPIClient::V2::FormsAPI.new + +body = DatadogAPIClient::V2::CloneFormRequest.new({ + data: DatadogAPIClient::V2::CloneFormData.new({ + attributes: DatadogAPIClient::V2::CloneFormDataAttributes.new({ + name: "Copy of My Form", + }), + type: DatadogAPIClient::V2::FormType::FORMS, + }), +}) +p api_instance.clone_form("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d", body) diff --git a/examples/v2/forms/PublishForm.rb b/examples/v2/forms/PublishForm.rb new file mode 100644 index 000000000000..d3fd25ffea5b --- /dev/null +++ b/examples/v2/forms/PublishForm.rb @@ -0,0 +1,20 @@ +# Publish a form version returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.publish_form".to_sym] = true +end +api_instance = DatadogAPIClient::V2::FormsAPI.new + +# there is a valid "form" in the system +FORM_DATA_ID = ENV["FORM_DATA_ID"] + +body = DatadogAPIClient::V2::PublishFormRequest.new({ + data: DatadogAPIClient::V2::PublishFormData.new({ + attributes: DatadogAPIClient::V2::PublishFormDataAttributes.new({ + version: 1, + }), + type: DatadogAPIClient::V2::FormPublicationType::FORM_PUBLICATIONS, + }), +}) +p api_instance.publish_form(FORM_DATA_ID, body) diff --git a/examples/v2/forms/UpdateForm.rb b/examples/v2/forms/UpdateForm.rb new file mode 100644 index 000000000000..569eead70ec6 --- /dev/null +++ b/examples/v2/forms/UpdateForm.rb @@ -0,0 +1,29 @@ +# Update a form returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.update_form".to_sym] = true +end +api_instance = DatadogAPIClient::V2::FormsAPI.new + +# there is a valid "form" in the system +FORM_DATA_ID = ENV["FORM_DATA_ID"] + +body = DatadogAPIClient::V2::UpdateFormRequest.new({ + data: DatadogAPIClient::V2::UpdateFormData.new({ + attributes: DatadogAPIClient::V2::UpdateFormDataAttributes.new({ + form_update: DatadogAPIClient::V2::FormUpdateAttributes.new({ + datastore_config: DatadogAPIClient::V2::FormDatastoreConfigAttributes.new({ + datastore_id: "5108ea24-dd83-4696-9caa-f069f73d0fad", + primary_column_name: "id", + primary_key_generation_strategy: "none", + }), + description: "An updated description.", + name: "Updated Form Name", + }), + }), + id: FORM_DATA_ID, + type: DatadogAPIClient::V2::FormType::FORMS, + }), +}) +p api_instance.update_form(FORM_DATA_ID, body) diff --git a/examples/v2/forms/UpsertFormVersion.rb b/examples/v2/forms/UpsertFormVersion.rb new file mode 100644 index 000000000000..e483fc119792 --- /dev/null +++ b/examples/v2/forms/UpsertFormVersion.rb @@ -0,0 +1,37 @@ +# Create or update a form version returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.upsert_form_version".to_sym] = true +end +api_instance = DatadogAPIClient::V2::FormsAPI.new + +# there is a valid "form" in the system +FORM_DATA_ID = ENV["FORM_DATA_ID"] + +body = DatadogAPIClient::V2::UpsertFormVersionRequest.new({ + data: DatadogAPIClient::V2::UpsertFormVersionData.new({ + attributes: DatadogAPIClient::V2::UpsertFormVersionDataAttributes.new({ + data_definition: DatadogAPIClient::V2::FormDataDefinition.new({ + description: "Welcome to the Engineering Experience Survey.", + required: [], + title: "Developer Experience Survey", + type: DatadogAPIClient::V2::FormDataDefinitionType::OBJECT, + }), + state: DatadogAPIClient::V2::FormVersionState::FROZEN, + ui_definition: DatadogAPIClient::V2::FormUiDefinition.new({ + ui_order: [], + ui_theme: DatadogAPIClient::V2::FormUiDefinitionUiTheme.new({ + primary_color: DatadogAPIClient::V2::FormUiDefinitionUiThemePrimaryColor::GRAY, + }), + }), + upsert_params: DatadogAPIClient::V2::UpsertFormVersionUpsertParams.new({ + etag: "b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d", + insert_only: false, + match_policy: DatadogAPIClient::V2::LatestVersionMatchPolicy::NONE, + }), + }), + type: DatadogAPIClient::V2::FormVersionType::FORM_VERSIONS, + }), +}) +p api_instance.upsert_form_version(FORM_DATA_ID, body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 9707cb7577db..bf7bcebddad9 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -3183,6 +3183,22 @@ "form_id" => "UUID", "version" => "String", }, + "v2.UpdateForm" => { + "form_id" => "UUID", + "body" => "UpdateFormRequest", + }, + "v2.CloneForm" => { + "form_id" => "UUID", + "body" => "CloneFormRequest", + }, + "v2.PublishForm" => { + "form_id" => "UUID", + "body" => "PublishFormRequest", + }, + "v2.UpsertFormVersion" => { + "form_id" => "UUID", + "body" => "UpsertFormVersionRequest", + }, "v2.CreateHamrOrgConnection" => { "body" => "HamrOrgConnectionRequest", }, diff --git a/features/v2/forms.feature b/features/v2/forms.feature index 40823edbc0f2..53cc1ba4d85f 100644 --- a/features/v2/forms.feature +++ b/features/v2/forms.feature @@ -1,14 +1,41 @@ @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. + Builder platform. You can configure form settings, manage versions, and + publish forms. 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: Clone a form returns "Bad Request" response + Given operation "CloneForm" enabled + And new "CloneForm" request + And request contains "form_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "Copy of My Form"}, "type": "forms"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/app-builder-backend + Scenario: Clone a form returns "Not Found" response + Given operation "CloneForm" enabled + And new "CloneForm" request + And request contains "form_id" parameter with value "00000000-0000-0000-0000-000000000001" + And body with value {"data": {"attributes": {"name": "Copy of My Form"}, "type": "forms"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/app-builder-backend + Scenario: Clone a form returns "OK" response + Given operation "CloneForm" enabled + And new "CloneForm" request + And request contains "form_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "Copy of My Form"}, "type": "forms"}} + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/app-builder-backend Scenario: Create a form returns "Bad Request" response Given operation "CreateForm" enabled @@ -41,6 +68,34 @@ Feature: Forms When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/app-builder-backend + Scenario: Create or update a form version returns "Bad Request" response + Given operation "UpsertFormVersion" enabled + And new "UpsertFormVersion" request + And request contains "form_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"data_definition": {"description": "Welcome to the Engineering Experience Survey.", "required": [], "title": "Developer Experience Survey", "type": "object"}, "state": "frozen", "ui_definition": {"ui:order": [], "ui:theme": {"primaryColor": "gray"}}, "upsert_params": {"etag": "b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d", "insert_only": false, "match_policy": "none"}}, "type": "form_versions"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/app-builder-backend + Scenario: Create or update a form version returns "Not Found" response + Given operation "UpsertFormVersion" enabled + And new "UpsertFormVersion" request + And request contains "form_id" parameter with value "00000000-0000-0000-0000-000000000001" + And body with value {"data": {"attributes": {"data_definition": {"description": "Welcome to the Engineering Experience Survey.", "required": [], "title": "Developer Experience Survey", "type": "object"}, "state": "frozen", "ui_definition": {"ui:order": [], "ui:theme": {"primaryColor": "gray"}}, "upsert_params": {"etag": "b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d", "insert_only": false, "match_policy": "none"}}, "type": "form_versions"}} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/app-builder-backend + Scenario: Create or update a form version returns "OK" response + Given operation "UpsertFormVersion" enabled + And there is a valid "form" in the system + And new "UpsertFormVersion" request + And request contains "form_id" parameter from "form.data.id" + And body with value {"data": {"attributes": {"data_definition": {"description": "Welcome to the Engineering Experience Survey.", "required": [], "title": "Developer Experience Survey", "type": "object"}, "state": "frozen", "ui_definition": {"ui:order": [], "ui:theme": {"primaryColor": "gray"}}, "upsert_params": {"etag": "b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d", "insert_only": false, "match_policy": "none"}}, "type": "form_versions"}} + 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 @@ -105,3 +160,59 @@ Feature: Forms 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 }}" + + @generated @skip @team:DataDog/app-builder-backend + Scenario: Publish a form version returns "Bad Request" response + Given operation "PublishForm" enabled + And new "PublishForm" request + And request contains "form_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"version": 1}, "type": "form_publications"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/app-builder-backend + Scenario: Publish a form version returns "Not Found" response + Given operation "PublishForm" enabled + And new "PublishForm" request + And request contains "form_id" parameter with value "00000000-0000-0000-0000-000000000001" + And body with value {"data": {"attributes": {"version": 1}, "type": "form_publications"}} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/app-builder-backend + Scenario: Publish a form version returns "OK" response + Given operation "PublishForm" enabled + And there is a valid "form" in the system + And new "PublishForm" request + And request contains "form_id" parameter from "form.data.id" + And body with value {"data": {"attributes": {"version": 1}, "type": "form_publications"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/app-builder-backend + Scenario: Update a form returns "Bad Request" response + Given operation "UpdateForm" enabled + And new "UpdateForm" request + And request contains "form_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"form_update": {"datastore_config": {"datastore_id": "5108ea24-dd83-4696-9caa-f069f73d0fad", "primary_column_name": "id", "primary_key_generation_strategy": "none"}, "description": "An updated description.", "name": "Updated Form Name"}}, "id": "22f6006a-2302-4926-9396-d2dfcf7b0b34", "type": "forms"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/app-builder-backend + Scenario: Update a form returns "Not Found" response + Given operation "UpdateForm" enabled + And new "UpdateForm" request + And request contains "form_id" parameter with value "00000000-0000-0000-0000-000000000001" + And body with value {"data": {"attributes": {"form_update": {"datastore_config": {"datastore_id": "5108ea24-dd83-4696-9caa-f069f73d0fad", "primary_column_name": "id", "primary_key_generation_strategy": "none"}, "description": "An updated description.", "name": "Updated Form Name"}}, "id": "22f6006a-2302-4926-9396-d2dfcf7b0b34", "type": "forms"}} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/app-builder-backend + Scenario: Update a form returns "OK" response + Given operation "UpdateForm" enabled + And there is a valid "form" in the system + And new "UpdateForm" request + And request contains "form_id" parameter from "form.data.id" + And body with value {"data": {"attributes": {"form_update": {"datastore_config": {"datastore_id": "5108ea24-dd83-4696-9caa-f069f73d0fad", "primary_column_name": "id", "primary_key_generation_strategy": "none"}, "description": "An updated description.", "name": "Updated Form Name"}}, "id": "22f6006a-2302-4926-9396-d2dfcf7b0b34", "type": "forms"}} + When the request is sent + Then the response status is 200 OK diff --git a/features/v2/undo.json b/features/v2/undo.json index 811e650c25b9..6f7d3dba59b0 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -2713,6 +2713,37 @@ "type": "safe" } }, + "UpdateForm": { + "tag": "Forms", + "undo": { + "type": "idempotent" + } + }, + "CloneForm": { + "tag": "Forms", + "undo": { + "operationId": "DeleteForm", + "parameters": [ + { + "name": "form_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "PublishForm": { + "tag": "Forms", + "undo": { + "type": "idempotent" + } + }, + "UpsertFormVersion": { + "tag": "Forms", + "undo": { + "type": "idempotent" + } + }, "GetHamrOrgConnection": { "tag": "High Availability MultiRegion", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 1323e5b92ec1..4638bd72dfad 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -442,11 +442,15 @@ def initialize "v2.trigger_deployment_gates_evaluation": false, "v2.update_deployment_gate": false, "v2.update_deployment_rule": false, + "v2.clone_form": false, "v2.create_and_publish_form": false, "v2.create_form": false, "v2.delete_form": false, "v2.get_form": false, "v2.list_forms": false, + "v2.publish_form": false, + "v2.update_form": false, + "v2.upsert_form_version": false, "v2.create_hamr_org_connection": false, "v2.get_hamr_org_connection": false, "v2.delete_entity_integration_config": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 93b0106d173c..5d04c4098ba0 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -2072,6 +2072,9 @@ def overrides "v2.clickup_integration" => "ClickupIntegration", "v2.clickup_integration_type" => "ClickupIntegrationType", "v2.clickup_integration_update" => "ClickupIntegrationUpdate", + "v2.clone_form_data" => "CloneFormData", + "v2.clone_form_data_attributes" => "CloneFormDataAttributes", + "v2.clone_form_request" => "CloneFormRequest", "v2.cloud_asset_type" => "CloudAssetType", "v2.cloud_configuration_compliance_rule_options" => "CloudConfigurationComplianceRuleOptions", "v2.cloud_configuration_rego_rule" => "CloudConfigurationRegoRule", @@ -3257,6 +3260,9 @@ def overrides "v2.form_data_definition_type" => "FormDataDefinitionType", "v2.form_datastore_config_attributes" => "FormDatastoreConfigAttributes", "v2.form_publication_attributes" => "FormPublicationAttributes", + "v2.form_publication_data" => "FormPublicationData", + "v2.form_publication_response" => "FormPublicationResponse", + "v2.form_publication_type" => "FormPublicationType", "v2.form_response" => "FormResponse", "v2.forms_response" => "FormsResponse", "v2.form_trigger" => "FormTrigger", @@ -3266,8 +3272,12 @@ def overrides "v2.form_ui_definition_ui_theme" => "FormUiDefinitionUiTheme", "v2.form_ui_definition_ui_theme_primary_color" => "FormUiDefinitionUiThemePrimaryColor", "v2.formula_limit" => "FormulaLimit", + "v2.form_update_attributes" => "FormUpdateAttributes", "v2.form_version_attributes" => "FormVersionAttributes", + "v2.form_version_data" => "FormVersionData", + "v2.form_version_response" => "FormVersionResponse", "v2.form_version_state" => "FormVersionState", + "v2.form_version_type" => "FormVersionType", "v2.framework_handle_and_version_response_data" => "FrameworkHandleAndVersionResponseData", "v2.freshservice_api_key" => "FreshserviceAPIKey", "v2.freshservice_api_key_type" => "FreshserviceAPIKeyType", @@ -3869,6 +3879,7 @@ def overrides "v2.kind_obj" => "KindObj", "v2.kind_response_meta" => "KindResponseMeta", "v2.language" => "Language", + "v2.latest_version_match_policy" => "LatestVersionMatchPolicy", "v2.launch_darkly_api_key" => "LaunchDarklyAPIKey", "v2.launch_darkly_api_key_type" => "LaunchDarklyAPIKeyType", "v2.launch_darkly_api_key_update" => "LaunchDarklyAPIKeyUpdate", @@ -5438,6 +5449,9 @@ def overrides "v2.pruned_trace_response" => "PrunedTraceResponse", "v2.pruned_trace_type" => "PrunedTraceType", "v2.publish_app_response" => "PublishAppResponse", + "v2.publish_form_data" => "PublishFormData", + "v2.publish_form_data_attributes" => "PublishFormDataAttributes", + "v2.publish_form_request" => "PublishFormRequest", "v2.publish_request_type" => "PublishRequestType", "v2.put_apps_datastore_item_response_array" => "PutAppsDatastoreItemResponseArray", "v2.put_apps_datastore_item_response_data" => "PutAppsDatastoreItemResponseData", @@ -7247,6 +7261,9 @@ def overrides "v2.update_flaky_tests_response_data" => "UpdateFlakyTestsResponseData", "v2.update_flaky_tests_response_data_type" => "UpdateFlakyTestsResponseDataType", "v2.update_flaky_tests_response_result" => "UpdateFlakyTestsResponseResult", + "v2.update_form_data" => "UpdateFormData", + "v2.update_form_data_attributes" => "UpdateFormDataAttributes", + "v2.update_form_request" => "UpdateFormRequest", "v2.update_on_call_notification_rule_request" => "UpdateOnCallNotificationRuleRequest", "v2.update_on_call_notification_rule_request_attributes" => "UpdateOnCallNotificationRuleRequestAttributes", "v2.update_on_call_notification_rule_request_data" => "UpdateOnCallNotificationRuleRequestData", @@ -7294,6 +7311,10 @@ def overrides "v2.upsert_cloud_inventory_sync_config_request" => "UpsertCloudInventorySyncConfigRequest", "v2.upsert_cloud_inventory_sync_config_request_attributes" => "UpsertCloudInventorySyncConfigRequestAttributes", "v2.upsert_cloud_inventory_sync_config_request_data" => "UpsertCloudInventorySyncConfigRequestData", + "v2.upsert_form_version_data" => "UpsertFormVersionData", + "v2.upsert_form_version_data_attributes" => "UpsertFormVersionDataAttributes", + "v2.upsert_form_version_request" => "UpsertFormVersionRequest", + "v2.upsert_form_version_upsert_params" => "UpsertFormVersionUpsertParams", "v2.upsert_o_auth_scopes_restriction_data" => "UpsertOAuthScopesRestrictionData", "v2.upsert_o_auth_scopes_restriction_data_attributes" => "UpsertOAuthScopesRestrictionDataAttributes", "v2.upsert_o_auth_scopes_restriction_request" => "UpsertOAuthScopesRestrictionRequest", diff --git a/lib/datadog_api_client/v2/api/forms_api.rb b/lib/datadog_api_client/v2/api/forms_api.rb index dd0778bbefba..9f73d3cd0a95 100644 --- a/lib/datadog_api_client/v2/api/forms_api.rb +++ b/lib/datadog_api_client/v2/api/forms_api.rb @@ -23,6 +23,84 @@ def initialize(api_client = DatadogAPIClient::APIClient.default) @api_client = api_client end + # Clone a form. + # + # @see #clone_form_with_http_info + def clone_form(form_id, body, opts = {}) + data, _status_code, _headers = clone_form_with_http_info(form_id, body, opts) + data + end + + # Clone a form. + # + # Clone an existing form. The clone is created in draft mode using the source form's latest version. + # + # @param form_id [UUID] The ID of the form to clone. + # @param body [CloneFormRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(FormResponse, Integer, Hash)>] FormResponse data, response status code and response headers + def clone_form_with_http_info(form_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.clone_form".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.clone_form") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.clone_form")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FormsAPI.clone_form ...' + end + # verify the required parameter 'form_id' is set + if @api_client.config.client_side_validation && form_id.nil? + fail ArgumentError, "Missing the required parameter 'form_id' when calling FormsAPI.clone_form" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling FormsAPI.clone_form" + end + # resource path + local_var_path = '/api/v2/forms/{form_id}/clone'.sub('{form_id}', CGI.escape(form_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'FormResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :clone_form, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FormsAPI#clone_form\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Create and publish a form. # # @see #create_and_publish_form_with_http_info @@ -378,5 +456,240 @@ def list_forms_with_http_info(opts = {}) end return data, status_code, headers end + + # Publish a form version. + # + # @see #publish_form_with_http_info + def publish_form(form_id, body, opts = {}) + data, _status_code, _headers = publish_form_with_http_info(form_id, body, opts) + data + end + + # Publish a form version. + # + # Publish a specific version of a form, making it available for submissions. + # + # @param form_id [UUID] The ID of the form. + # @param body [PublishFormRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(FormPublicationResponse, Integer, Hash)>] FormPublicationResponse data, response status code and response headers + def publish_form_with_http_info(form_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.publish_form".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.publish_form") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.publish_form")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FormsAPI.publish_form ...' + end + # verify the required parameter 'form_id' is set + if @api_client.config.client_side_validation && form_id.nil? + fail ArgumentError, "Missing the required parameter 'form_id' when calling FormsAPI.publish_form" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling FormsAPI.publish_form" + end + # resource path + local_var_path = '/api/v2/forms/{form_id}/publish'.sub('{form_id}', CGI.escape(form_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'FormPublicationResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :publish_form, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FormsAPI#publish_form\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update a form. + # + # @see #update_form_with_http_info + def update_form(form_id, body, opts = {}) + data, _status_code, _headers = update_form_with_http_info(form_id, body, opts) + data + end + + # Update a form. + # + # Update a form's properties such as its name, description, or datastore configuration. + # + # @param form_id [UUID] The ID of the form. + # @param body [UpdateFormRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(FormResponse, Integer, Hash)>] FormResponse data, response status code and response headers + def update_form_with_http_info(form_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.update_form".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.update_form") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.update_form")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FormsAPI.update_form ...' + end + # verify the required parameter 'form_id' is set + if @api_client.config.client_side_validation && form_id.nil? + fail ArgumentError, "Missing the required parameter 'form_id' when calling FormsAPI.update_form" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling FormsAPI.update_form" + end + # resource path + local_var_path = '/api/v2/forms/{form_id}'.sub('{form_id}', CGI.escape(form_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'FormResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :update_form, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Patch, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FormsAPI#update_form\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Create or update a form version. + # + # @see #upsert_form_version_with_http_info + def upsert_form_version(form_id, body, opts = {}) + data, _status_code, _headers = upsert_form_version_with_http_info(form_id, body, opts) + data + end + + # Create or update a form version. + # + # Create or update the latest draft version of a form. The `upsert_params` field controls + # optimistic concurrency behavior. + # + # @param form_id [UUID] The ID of the form. + # @param body [UpsertFormVersionRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(FormVersionResponse, Integer, Hash)>] FormVersionResponse data, response status code and response headers + def upsert_form_version_with_http_info(form_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.upsert_form_version".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.upsert_form_version") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.upsert_form_version")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FormsAPI.upsert_form_version ...' + end + # verify the required parameter 'form_id' is set + if @api_client.config.client_side_validation && form_id.nil? + fail ArgumentError, "Missing the required parameter 'form_id' when calling FormsAPI.upsert_form_version" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling FormsAPI.upsert_form_version" + end + # resource path + local_var_path = '/api/v2/forms/{form_id}/versions'.sub('{form_id}', CGI.escape(form_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'FormVersionResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :upsert_form_version, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FormsAPI#upsert_form_version\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end end end diff --git a/lib/datadog_api_client/v2/models/clone_form_data.rb b/lib/datadog_api_client/v2/models/clone_form_data.rb new file mode 100644 index 000000000000..f643b689c444 --- /dev/null +++ b/lib/datadog_api_client/v2/models/clone_form_data.rb @@ -0,0 +1,133 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The data for cloning a form. + class CloneFormData + include BaseGenericModel + + # The attributes for cloning a form. + attr_accessor :attributes + + # The resource type for a form. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'CloneFormDataAttributes', + :'type' => :'FormType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CloneFormData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/clone_form_data_attributes.rb b/lib/datadog_api_client/v2/models/clone_form_data_attributes.rb new file mode 100644 index 000000000000..02c2ff0bde9e --- /dev/null +++ b/lib/datadog_api_client/v2/models/clone_form_data_attributes.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The attributes for cloning a form. + class CloneFormDataAttributes + include BaseGenericModel + + # The name for the cloned form. Defaults to "Copy of (source form name)" if not provided. + attr_accessor :name + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'name' => :'name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'name' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CloneFormDataAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [name, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/clone_form_request.rb b/lib/datadog_api_client/v2/models/clone_form_request.rb new file mode 100644 index 000000000000..64375eddd335 --- /dev/null +++ b/lib/datadog_api_client/v2/models/clone_form_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A request to clone a form. + class CloneFormRequest + include BaseGenericModel + + # The data for cloning a form. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'CloneFormData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CloneFormRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/form_publication_data.rb b/lib/datadog_api_client/v2/models/form_publication_data.rb new file mode 100644 index 000000000000..17638b1b0edf --- /dev/null +++ b/lib/datadog_api_client/v2/models/form_publication_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A form publication resource object. + class FormPublicationData + include BaseGenericModel + + # The attributes of a form publication. + attr_reader :attributes + + # The ID of the form publication. + attr_reader :id + + # The resource type for a form publication. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'FormPublicationAttributes', + :'id' => :'String', + :'type' => :'FormPublicationType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::FormPublicationData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/form_publication_response.rb b/lib/datadog_api_client/v2/models/form_publication_response.rb new file mode 100644 index 000000000000..3c3a0c0c9ba4 --- /dev/null +++ b/lib/datadog_api_client/v2/models/form_publication_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A response containing a single form publication. + class FormPublicationResponse + include BaseGenericModel + + # A form publication resource object. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'FormPublicationData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::FormPublicationResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/form_publication_type.rb b/lib/datadog_api_client/v2/models/form_publication_type.rb new file mode 100644 index 000000000000..0821e6ae56b8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/form_publication_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The resource type for a form publication. + class FormPublicationType + include BaseEnumModel + + FORM_PUBLICATIONS = "form_publications".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/form_update_attributes.rb b/lib/datadog_api_client/v2/models/form_update_attributes.rb new file mode 100644 index 000000000000..64be30c964a6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/form_update_attributes.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The fields to update on a form. At least one field must be provided. + class FormUpdateAttributes + include BaseGenericModel + + # The datastore configuration for a form. + attr_accessor :datastore_config + + # The updated description of the form. + attr_accessor :description + + # The updated name of the form. + attr_accessor :name + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'datastore_config' => :'datastore_config', + :'description' => :'description', + :'name' => :'name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'datastore_config' => :'FormDatastoreConfigAttributes', + :'description' => :'String', + :'name' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::FormUpdateAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'datastore_config') + self.datastore_config = attributes[:'datastore_config'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + datastore_config == o.datastore_config && + description == o.description && + name == o.name && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [datastore_config, description, name, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/form_version_data.rb b/lib/datadog_api_client/v2/models/form_version_data.rb new file mode 100644 index 000000000000..6cb5cffedca0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/form_version_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A form version resource object. + class FormVersionData + include BaseGenericModel + + # The attributes of a form version. + attr_reader :attributes + + # The ID of the form version. + attr_reader :id + + # The resource type for a form version. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'FormVersionAttributes', + :'id' => :'String', + :'type' => :'FormVersionType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::FormVersionData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/form_version_response.rb b/lib/datadog_api_client/v2/models/form_version_response.rb new file mode 100644 index 000000000000..739c07f36c94 --- /dev/null +++ b/lib/datadog_api_client/v2/models/form_version_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A response containing a single form version. + class FormVersionResponse + include BaseGenericModel + + # A form version resource object. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'FormVersionData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::FormVersionResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/form_version_type.rb b/lib/datadog_api_client/v2/models/form_version_type.rb new file mode 100644 index 000000000000..05f2e2f6d2c8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/form_version_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The resource type for a form version. + class FormVersionType + include BaseEnumModel + + FORM_VERSIONS = "form_versions".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/latest_version_match_policy.rb b/lib/datadog_api_client/v2/models/latest_version_match_policy.rb new file mode 100644 index 000000000000..b5fc2c20fff7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/latest_version_match_policy.rb @@ -0,0 +1,27 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The policy for matching the latest form version during an upsert operation. + class LatestVersionMatchPolicy + include BaseEnumModel + + NONE = "none".freeze + IF_ETAG_MATCH = "if_etag_match".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/publish_form_data.rb b/lib/datadog_api_client/v2/models/publish_form_data.rb new file mode 100644 index 000000000000..42ae2c0774f8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/publish_form_data.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The data for publishing a form version. + class PublishFormData + include BaseGenericModel + + # The attributes for publishing a form version. + attr_reader :attributes + + # The resource type for a form publication. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'PublishFormDataAttributes', + :'type' => :'FormPublicationType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::PublishFormData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/publish_form_data_attributes.rb b/lib/datadog_api_client/v2/models/publish_form_data_attributes.rb new file mode 100644 index 000000000000..81a97d0c0b67 --- /dev/null +++ b/lib/datadog_api_client/v2/models/publish_form_data_attributes.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The attributes for publishing a form version. + class PublishFormDataAttributes + include BaseGenericModel + + # The version number to publish. + attr_reader :version + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'version' => :'version' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'version' => :'Integer' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::PublishFormDataAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'version') + self.version = attributes[:'version'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @version.nil? + true + end + + # Custom attribute writer method with validation + # @param version [Object] Object to be assigned + # @!visibility private + def version=(version) + if version.nil? + fail ArgumentError, 'invalid value for "version", version cannot be nil.' + end + @version = version + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + version == o.version && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [version, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/publish_form_request.rb b/lib/datadog_api_client/v2/models/publish_form_request.rb new file mode 100644 index 000000000000..643a1ea2d6b5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/publish_form_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A request to publish a form version. + class PublishFormRequest + include BaseGenericModel + + # The data for publishing a form version. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'PublishFormData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::PublishFormRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/update_form_data.rb b/lib/datadog_api_client/v2/models/update_form_data.rb new file mode 100644 index 000000000000..8cf454a92c30 --- /dev/null +++ b/lib/datadog_api_client/v2/models/update_form_data.rb @@ -0,0 +1,154 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The data for updating a form. + class UpdateFormData + include BaseGenericModel + + # The attributes for updating a form. + attr_reader :attributes + + # The ID of the form. + attr_accessor :id + + # The resource type for a form. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'UpdateFormDataAttributes', + :'id' => :'UUID', + :'type' => :'FormType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::UpdateFormData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/update_form_data_attributes.rb b/lib/datadog_api_client/v2/models/update_form_data_attributes.rb new file mode 100644 index 000000000000..4c2308560b62 --- /dev/null +++ b/lib/datadog_api_client/v2/models/update_form_data_attributes.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The attributes for updating a form. + class UpdateFormDataAttributes + include BaseGenericModel + + # The fields to update on a form. At least one field must be provided. + attr_reader :form_update + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'form_update' => :'form_update' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'form_update' => :'FormUpdateAttributes' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::UpdateFormDataAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'form_update') + self.form_update = attributes[:'form_update'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @form_update.nil? + true + end + + # Custom attribute writer method with validation + # @param form_update [Object] Object to be assigned + # @!visibility private + def form_update=(form_update) + if form_update.nil? + fail ArgumentError, 'invalid value for "form_update", form_update cannot be nil.' + end + @form_update = form_update + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + form_update == o.form_update && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [form_update, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/update_form_request.rb b/lib/datadog_api_client/v2/models/update_form_request.rb new file mode 100644 index 000000000000..06dc5a756db0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/update_form_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A request to update a form. + class UpdateFormRequest + include BaseGenericModel + + # The data for updating a form. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'UpdateFormData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::UpdateFormRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/upsert_form_version_data.rb b/lib/datadog_api_client/v2/models/upsert_form_version_data.rb new file mode 100644 index 000000000000..3687b92de0b1 --- /dev/null +++ b/lib/datadog_api_client/v2/models/upsert_form_version_data.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The data for creating or updating a form version. + class UpsertFormVersionData + include BaseGenericModel + + # The attributes for creating or updating a form version. + attr_reader :attributes + + # The resource type for a form version. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'UpsertFormVersionDataAttributes', + :'type' => :'FormVersionType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::UpsertFormVersionData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/upsert_form_version_data_attributes.rb b/lib/datadog_api_client/v2/models/upsert_form_version_data_attributes.rb new file mode 100644 index 000000000000..353117e2dd45 --- /dev/null +++ b/lib/datadog_api_client/v2/models/upsert_form_version_data_attributes.rb @@ -0,0 +1,186 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The attributes for creating or updating a form version. + class UpsertFormVersionDataAttributes + include BaseGenericModel + + # A JSON Schema definition that describes the form's data fields. + attr_reader :data_definition + + # The state of a form version. + attr_reader :state + + # UI configuration for rendering form fields, including widget overrides, field ordering, and themes. + attr_reader :ui_definition + + # Concurrency control parameters for the form version upsert operation. + attr_reader :upsert_params + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data_definition' => :'data_definition', + :'state' => :'state', + :'ui_definition' => :'ui_definition', + :'upsert_params' => :'upsert_params' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data_definition' => :'FormDataDefinition', + :'state' => :'FormVersionState', + :'ui_definition' => :'FormUiDefinition', + :'upsert_params' => :'UpsertFormVersionUpsertParams' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::UpsertFormVersionDataAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data_definition') + self.data_definition = attributes[:'data_definition'] + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + + if attributes.key?(:'ui_definition') + self.ui_definition = attributes[:'ui_definition'] + end + + if attributes.key?(:'upsert_params') + self.upsert_params = attributes[:'upsert_params'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data_definition.nil? + return false if @state.nil? + return false if @ui_definition.nil? + return false if @upsert_params.nil? + true + end + + # Custom attribute writer method with validation + # @param data_definition [Object] Object to be assigned + # @!visibility private + def data_definition=(data_definition) + if data_definition.nil? + fail ArgumentError, 'invalid value for "data_definition", data_definition cannot be nil.' + end + @data_definition = data_definition + end + + # Custom attribute writer method with validation + # @param state [Object] Object to be assigned + # @!visibility private + def state=(state) + if state.nil? + fail ArgumentError, 'invalid value for "state", state cannot be nil.' + end + @state = state + end + + # Custom attribute writer method with validation + # @param ui_definition [Object] Object to be assigned + # @!visibility private + def ui_definition=(ui_definition) + if ui_definition.nil? + fail ArgumentError, 'invalid value for "ui_definition", ui_definition cannot be nil.' + end + @ui_definition = ui_definition + end + + # Custom attribute writer method with validation + # @param upsert_params [Object] Object to be assigned + # @!visibility private + def upsert_params=(upsert_params) + if upsert_params.nil? + fail ArgumentError, 'invalid value for "upsert_params", upsert_params cannot be nil.' + end + @upsert_params = upsert_params + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data_definition == o.data_definition && + state == o.state && + ui_definition == o.ui_definition && + upsert_params == o.upsert_params && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data_definition, state, ui_definition, upsert_params, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/upsert_form_version_request.rb b/lib/datadog_api_client/v2/models/upsert_form_version_request.rb new file mode 100644 index 000000000000..1ba5b8c37bfa --- /dev/null +++ b/lib/datadog_api_client/v2/models/upsert_form_version_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A request to create or update a form version. + class UpsertFormVersionRequest + include BaseGenericModel + + # The data for creating or updating a form version. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'UpsertFormVersionData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::UpsertFormVersionRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/upsert_form_version_upsert_params.rb b/lib/datadog_api_client/v2/models/upsert_form_version_upsert_params.rb new file mode 100644 index 000000000000..1370b1bb985c --- /dev/null +++ b/lib/datadog_api_client/v2/models/upsert_form_version_upsert_params.rb @@ -0,0 +1,151 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Concurrency control parameters for the form version upsert operation. + class UpsertFormVersionUpsertParams + include BaseGenericModel + + # The ETag of the latest version. Required when `match_policy` is `if_etag_match`. + attr_accessor :etag + + # If true, only a new version may be inserted; updating the current draft is not allowed. + attr_accessor :insert_only + + # The policy for matching the latest form version during an upsert operation. + attr_reader :match_policy + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'etag' => :'etag', + :'insert_only' => :'insert_only', + :'match_policy' => :'match_policy' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'etag' => :'String', + :'insert_only' => :'Boolean', + :'match_policy' => :'LatestVersionMatchPolicy' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'etag', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::UpsertFormVersionUpsertParams` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'etag') + self.etag = attributes[:'etag'] + end + + if attributes.key?(:'insert_only') + self.insert_only = attributes[:'insert_only'] + end + + if attributes.key?(:'match_policy') + self.match_policy = attributes[:'match_policy'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @match_policy.nil? + true + end + + # Custom attribute writer method with validation + # @param match_policy [Object] Object to be assigned + # @!visibility private + def match_policy=(match_policy) + if match_policy.nil? + fail ArgumentError, 'invalid value for "match_policy", match_policy cannot be nil.' + end + @match_policy = match_policy + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + etag == o.etag && + insert_only == o.insert_only && + match_policy == o.match_policy && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [etag, insert_only, match_policy, additional_properties].hash + end + end +end