From 6aaa56571d6012dd6a572f09d944501c317a6f51 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 12 Dec 2024 19:20:51 +0000 Subject: [PATCH 1/4] Regenerate client from commit bc9e8733 of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 1691 +++++++++++++++++ examples/v2_app-deployment_DeployApp.rs | 18 + examples/v2_app-deployment_DisableApp.rs | 18 + examples/v2_apps_CreateApp.rs | 55 + examples/v2_apps_DeleteApp.rs | 18 + examples/v2_apps_DeleteApps.rs | 25 + examples/v2_apps_GetApp.rs | 18 + examples/v2_apps_ListApps.rs | 17 + examples/v2_apps_UpdateApp.rs | 31 + src/datadog/configuration.rs | 8 + src/datadogV2/api/api_app_deployment.rs | 316 +++ src/datadogV2/api/api_apps.rs | 1078 +++++++++++ src/datadogV2/api/mod.rs | 2 + src/datadogV2/mod.rs | 2 + src/datadogV2/model/mod.rs | 174 ++ .../model/model_app_builder_error.rs | 109 ++ .../model_app_builder_error_errors_items.rs | 126 ++ ...l_app_builder_error_errors_items_source.rs | 122 ++ .../model/model_app_builder_event.rs | 138 ++ .../model/model_app_builder_event_name.rs | 75 + .../model/model_app_builder_event_type.rs | 69 + src/datadogV2/model/model_app_meta.rs | 260 +++ src/datadogV2/model/model_apps_sort_field.rs | 69 + src/datadogV2/model/model_component.rs | 157 ++ src/datadogV2/model/model_component_grid.rs | 160 ++ .../model/model_component_grid_properties.rs | 153 ++ ...el_component_grid_properties_is_visible.rs | 33 + .../model/model_component_grid_type.rs | 48 + .../model/model_component_properties.rs | 134 ++ .../model_component_properties_is_visible.rs | 33 + src/datadogV2/model/model_component_type.rs | 105 + .../model/model_create_app_request.rs | 105 + .../model/model_create_app_request_data.rs | 122 ++ ...odel_create_app_request_data_attributes.rs | 228 +++ .../model_create_app_request_data_type.rs | 48 + .../model/model_create_app_response.rs | 105 + .../model/model_create_app_response_data.rs | 113 ++ .../model_create_app_response_data_type.rs | 48 + .../model/model_custom_connection.rs | 151 ++ .../model_custom_connection_attributes.rs | 128 ++ ...om_connection_attributes_on_prem_runner.rs | 122 ++ .../model/model_custom_connection_type.rs | 48 + .../model/model_delete_app_response.rs | 105 + .../model/model_delete_app_response_data.rs | 113 ++ .../model_delete_app_response_data_type.rs | 48 + .../model/model_delete_apps_request.rs | 106 ++ .../model_delete_apps_request_data_items.rs | 114 ++ ...del_delete_apps_request_data_items_type.rs | 48 + .../model/model_delete_apps_response.rs | 109 ++ .../model_delete_apps_response_data_items.rs | 114 ++ ...el_delete_apps_response_data_items_type.rs | 48 + .../model/model_deploy_app_response.rs | 105 + .../model/model_deploy_app_response_data.rs | 169 ++ ...del_deploy_app_response_data_attributes.rs | 106 ++ .../model_deploy_app_response_data_type.rs | 48 + .../model/model_deployment_included.rs | 168 ++ .../model_deployment_included_attributes.rs | 106 ++ .../model/model_deployment_included_meta.rs | 156 ++ .../model/model_deployment_included_type.rs | 48 + src/datadogV2/model/model_deployment_meta.rs | 156 ++ .../model/model_deployment_relationship.rs | 122 ++ .../model_deployment_relationship_data.rs | 131 ++ ...model_deployment_relationship_data_type.rs | 48 + .../model_deployment_relationship_meta.rs | 156 ++ .../model/model_disable_app_response.rs | 105 + .../model/model_disable_app_response_data.rs | 169 ++ ...el_disable_app_response_data_attributes.rs | 106 ++ .../model_disable_app_response_data_type.rs | 48 + src/datadogV2/model/model_get_app_response.rs | 161 ++ .../model/model_get_app_response_data.rs | 125 ++ .../model_get_app_response_data_attributes.rs | 245 +++ .../model/model_get_app_response_data_type.rs | 48 + .../model_get_app_response_relationship.rs | 123 ++ src/datadogV2/model/model_input_schema.rs | 105 + .../model/model_input_schema_data.rs | 148 ++ .../model_input_schema_data_attributes.rs | 110 ++ ...schema_data_attributes_parameters_items.rs | 110 ++ ...a_data_attributes_parameters_items_data.rs | 111 ++ ...ibutes_parameters_items_data_attributes.rs | 192 ++ .../model/model_input_schema_data_type.rs | 48 + .../model/model_list_apps_response.rs | 140 ++ .../model_list_apps_response_data_items.rs | 167 ++ ...ist_apps_response_data_items_attributes.rs | 175 ++ ..._apps_response_data_items_relationships.rs | 105 + ...odel_list_apps_response_data_items_type.rs | 48 + .../model/model_list_apps_response_meta.rs | 105 + .../model_list_apps_response_meta_page.rs | 124 ++ src/datadogV2/model/model_query.rs | 154 ++ src/datadogV2/model/model_query_type.rs | 54 + src/datadogV2/model/model_script.rs | 105 + src/datadogV2/model/model_script_data.rs | 149 ++ .../model/model_script_data_attributes.rs | 139 ++ src/datadogV2/model/model_script_data_type.rs | 48 + .../model/model_update_app_request.rs | 105 + .../model/model_update_app_request_data.rs | 139 ++ ...odel_update_app_request_data_attributes.rs | 228 +++ .../model_update_app_request_data_type.rs | 48 + .../model/model_update_app_response.rs | 162 ++ .../model/model_update_app_response_data.rs | 126 ++ ...del_update_app_response_data_attributes.rs | 245 +++ .../model_update_app_response_data_type.rs | 48 + .../model_update_app_response_relationship.rs | 123 ++ ...oy-App-returns-Bad-Request-response.frozen | 1 + ...ploy-App-returns-Bad-Request-response.json | 33 + ...Deploy-App-returns-Created-response.frozen | 1 + .../Deploy-App-returns-Created-response.json | 95 + ...ploy-App-returns-Not-Found-response.frozen | 1 + ...Deploy-App-returns-Not-Found-response.json | 33 + ...le-App-returns-Bad-Request-response.frozen | 1 + ...able-App-returns-Bad-Request-response.json | 33 + ...able-App-returns-Not-Found-response.frozen | 1 + ...isable-App-returns-Not-Found-response.json | 33 + .../Disable-App-returns-OK-response.frozen | 1 + .../Disable-App-returns-OK-response.json | 95 + ...te-App-returns-App-Created-response.frozen | 1 + ...eate-App-returns-App-Created-response.json | 67 + ...te-App-returns-Bad-Request-response.frozen | 1 + ...eate-App-returns-Bad-Request-response.json | 39 + ...te-App-returns-Bad-Request-response.frozen | 1 + ...lete-App-returns-Bad-Request-response.json | 33 + ...lete-App-returns-Not-Found-response.frozen | 1 + ...Delete-App-returns-Not-Found-response.json | 33 + .../Delete-App-returns-OK-response.frozen | 1 + .../apps/Delete-App-returns-OK-response.json | 95 + ...e-Apps-returns-Bad-Request-response.frozen | 1 + ...ple-Apps-returns-Bad-Request-response.json | 39 + ...ple-Apps-returns-Not-Found-response.frozen | 1 + ...tiple-Apps-returns-Not-Found-response.json | 39 + ...e-Multiple-Apps-returns-OK-response.frozen | 1 + ...ete-Multiple-Apps-returns-OK-response.json | 101 + ...et-App-returns-Bad-Request-response.frozen | 1 + .../Get-App-returns-Bad-Request-response.json | 33 + .../Get-App-returns-Not-Found-response.frozen | 1 + .../Get-App-returns-Not-Found-response.json | 33 + .../apps/Get-App-returns-OK-response.frozen | 1 + .../v2/apps/Get-App-returns-OK-response.json | 95 + .../apps/List-Apps-returns-OK-response.frozen | 1 + .../apps/List-Apps-returns-OK-response.json | 33 + ...te-App-returns-Bad-Request-response.frozen | 1 + ...date-App-returns-Bad-Request-response.json | 101 + .../Update-App-returns-OK-response.frozen | 1 + .../apps/Update-App-returns-OK-response.json | 101 + .../features/v2/app_deployment.feature | 58 + tests/scenarios/features/v2/apps.feature | 155 ++ tests/scenarios/features/v2/given.json | 12 + tests/scenarios/features/v2/undo.json | 55 + tests/scenarios/function_mappings.rs | 282 +++ 148 files changed, 15245 insertions(+), 4 deletions(-) create mode 100644 examples/v2_app-deployment_DeployApp.rs create mode 100644 examples/v2_app-deployment_DisableApp.rs create mode 100644 examples/v2_apps_CreateApp.rs create mode 100644 examples/v2_apps_DeleteApp.rs create mode 100644 examples/v2_apps_DeleteApps.rs create mode 100644 examples/v2_apps_GetApp.rs create mode 100644 examples/v2_apps_ListApps.rs create mode 100644 examples/v2_apps_UpdateApp.rs create mode 100644 src/datadogV2/api/api_app_deployment.rs create mode 100644 src/datadogV2/api/api_apps.rs create mode 100644 src/datadogV2/model/model_app_builder_error.rs create mode 100644 src/datadogV2/model/model_app_builder_error_errors_items.rs create mode 100644 src/datadogV2/model/model_app_builder_error_errors_items_source.rs create mode 100644 src/datadogV2/model/model_app_builder_event.rs create mode 100644 src/datadogV2/model/model_app_builder_event_name.rs create mode 100644 src/datadogV2/model/model_app_builder_event_type.rs create mode 100644 src/datadogV2/model/model_app_meta.rs create mode 100644 src/datadogV2/model/model_apps_sort_field.rs create mode 100644 src/datadogV2/model/model_component.rs create mode 100644 src/datadogV2/model/model_component_grid.rs create mode 100644 src/datadogV2/model/model_component_grid_properties.rs create mode 100644 src/datadogV2/model/model_component_grid_properties_is_visible.rs create mode 100644 src/datadogV2/model/model_component_grid_type.rs create mode 100644 src/datadogV2/model/model_component_properties.rs create mode 100644 src/datadogV2/model/model_component_properties_is_visible.rs create mode 100644 src/datadogV2/model/model_component_type.rs create mode 100644 src/datadogV2/model/model_create_app_request.rs create mode 100644 src/datadogV2/model/model_create_app_request_data.rs create mode 100644 src/datadogV2/model/model_create_app_request_data_attributes.rs create mode 100644 src/datadogV2/model/model_create_app_request_data_type.rs create mode 100644 src/datadogV2/model/model_create_app_response.rs create mode 100644 src/datadogV2/model/model_create_app_response_data.rs create mode 100644 src/datadogV2/model/model_create_app_response_data_type.rs create mode 100644 src/datadogV2/model/model_custom_connection.rs create mode 100644 src/datadogV2/model/model_custom_connection_attributes.rs create mode 100644 src/datadogV2/model/model_custom_connection_attributes_on_prem_runner.rs create mode 100644 src/datadogV2/model/model_custom_connection_type.rs create mode 100644 src/datadogV2/model/model_delete_app_response.rs create mode 100644 src/datadogV2/model/model_delete_app_response_data.rs create mode 100644 src/datadogV2/model/model_delete_app_response_data_type.rs create mode 100644 src/datadogV2/model/model_delete_apps_request.rs create mode 100644 src/datadogV2/model/model_delete_apps_request_data_items.rs create mode 100644 src/datadogV2/model/model_delete_apps_request_data_items_type.rs create mode 100644 src/datadogV2/model/model_delete_apps_response.rs create mode 100644 src/datadogV2/model/model_delete_apps_response_data_items.rs create mode 100644 src/datadogV2/model/model_delete_apps_response_data_items_type.rs create mode 100644 src/datadogV2/model/model_deploy_app_response.rs create mode 100644 src/datadogV2/model/model_deploy_app_response_data.rs create mode 100644 src/datadogV2/model/model_deploy_app_response_data_attributes.rs create mode 100644 src/datadogV2/model/model_deploy_app_response_data_type.rs create mode 100644 src/datadogV2/model/model_deployment_included.rs create mode 100644 src/datadogV2/model/model_deployment_included_attributes.rs create mode 100644 src/datadogV2/model/model_deployment_included_meta.rs create mode 100644 src/datadogV2/model/model_deployment_included_type.rs create mode 100644 src/datadogV2/model/model_deployment_meta.rs create mode 100644 src/datadogV2/model/model_deployment_relationship.rs create mode 100644 src/datadogV2/model/model_deployment_relationship_data.rs create mode 100644 src/datadogV2/model/model_deployment_relationship_data_type.rs create mode 100644 src/datadogV2/model/model_deployment_relationship_meta.rs create mode 100644 src/datadogV2/model/model_disable_app_response.rs create mode 100644 src/datadogV2/model/model_disable_app_response_data.rs create mode 100644 src/datadogV2/model/model_disable_app_response_data_attributes.rs create mode 100644 src/datadogV2/model/model_disable_app_response_data_type.rs create mode 100644 src/datadogV2/model/model_get_app_response.rs create mode 100644 src/datadogV2/model/model_get_app_response_data.rs create mode 100644 src/datadogV2/model/model_get_app_response_data_attributes.rs create mode 100644 src/datadogV2/model/model_get_app_response_data_type.rs create mode 100644 src/datadogV2/model/model_get_app_response_relationship.rs create mode 100644 src/datadogV2/model/model_input_schema.rs create mode 100644 src/datadogV2/model/model_input_schema_data.rs create mode 100644 src/datadogV2/model/model_input_schema_data_attributes.rs create mode 100644 src/datadogV2/model/model_input_schema_data_attributes_parameters_items.rs create mode 100644 src/datadogV2/model/model_input_schema_data_attributes_parameters_items_data.rs create mode 100644 src/datadogV2/model/model_input_schema_data_attributes_parameters_items_data_attributes.rs create mode 100644 src/datadogV2/model/model_input_schema_data_type.rs create mode 100644 src/datadogV2/model/model_list_apps_response.rs create mode 100644 src/datadogV2/model/model_list_apps_response_data_items.rs create mode 100644 src/datadogV2/model/model_list_apps_response_data_items_attributes.rs create mode 100644 src/datadogV2/model/model_list_apps_response_data_items_relationships.rs create mode 100644 src/datadogV2/model/model_list_apps_response_data_items_type.rs create mode 100644 src/datadogV2/model/model_list_apps_response_meta.rs create mode 100644 src/datadogV2/model/model_list_apps_response_meta_page.rs create mode 100644 src/datadogV2/model/model_query.rs create mode 100644 src/datadogV2/model/model_query_type.rs create mode 100644 src/datadogV2/model/model_script.rs create mode 100644 src/datadogV2/model/model_script_data.rs create mode 100644 src/datadogV2/model/model_script_data_attributes.rs create mode 100644 src/datadogV2/model/model_script_data_type.rs create mode 100644 src/datadogV2/model/model_update_app_request.rs create mode 100644 src/datadogV2/model/model_update_app_request_data.rs create mode 100644 src/datadogV2/model/model_update_app_request_data_attributes.rs create mode 100644 src/datadogV2/model/model_update_app_request_data_type.rs create mode 100644 src/datadogV2/model/model_update_app_response.rs create mode 100644 src/datadogV2/model/model_update_app_response_data.rs create mode 100644 src/datadogV2/model/model_update_app_response_data_attributes.rs create mode 100644 src/datadogV2/model/model_update_app_response_data_type.rs create mode 100644 src/datadogV2/model/model_update_app_response_relationship.rs create mode 100644 tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Bad-Request-response.frozen create mode 100644 tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Bad-Request-response.json create mode 100644 tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Created-response.frozen create mode 100644 tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Created-response.json create mode 100644 tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Not-Found-response.frozen create mode 100644 tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Not-Found-response.json create mode 100644 tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Bad-Request-response.frozen create mode 100644 tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Bad-Request-response.json create mode 100644 tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Not-Found-response.frozen create mode 100644 tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Not-Found-response.json create mode 100644 tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-OK-response.frozen create mode 100644 tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-OK-response.json create mode 100644 tests/scenarios/cassettes/v2/apps/Create-App-returns-App-Created-response.frozen create mode 100644 tests/scenarios/cassettes/v2/apps/Create-App-returns-App-Created-response.json create mode 100644 tests/scenarios/cassettes/v2/apps/Create-App-returns-Bad-Request-response.frozen create mode 100644 tests/scenarios/cassettes/v2/apps/Create-App-returns-Bad-Request-response.json create mode 100644 tests/scenarios/cassettes/v2/apps/Delete-App-returns-Bad-Request-response.frozen create mode 100644 tests/scenarios/cassettes/v2/apps/Delete-App-returns-Bad-Request-response.json create mode 100644 tests/scenarios/cassettes/v2/apps/Delete-App-returns-Not-Found-response.frozen create mode 100644 tests/scenarios/cassettes/v2/apps/Delete-App-returns-Not-Found-response.json create mode 100644 tests/scenarios/cassettes/v2/apps/Delete-App-returns-OK-response.frozen create mode 100644 tests/scenarios/cassettes/v2/apps/Delete-App-returns-OK-response.json create mode 100644 tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Bad-Request-response.frozen create mode 100644 tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Bad-Request-response.json create mode 100644 tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Not-Found-response.frozen create mode 100644 tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Not-Found-response.json create mode 100644 tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-OK-response.frozen create mode 100644 tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-OK-response.json create mode 100644 tests/scenarios/cassettes/v2/apps/Get-App-returns-Bad-Request-response.frozen create mode 100644 tests/scenarios/cassettes/v2/apps/Get-App-returns-Bad-Request-response.json create mode 100644 tests/scenarios/cassettes/v2/apps/Get-App-returns-Not-Found-response.frozen create mode 100644 tests/scenarios/cassettes/v2/apps/Get-App-returns-Not-Found-response.json create mode 100644 tests/scenarios/cassettes/v2/apps/Get-App-returns-OK-response.frozen create mode 100644 tests/scenarios/cassettes/v2/apps/Get-App-returns-OK-response.json create mode 100644 tests/scenarios/cassettes/v2/apps/List-Apps-returns-OK-response.frozen create mode 100644 tests/scenarios/cassettes/v2/apps/List-Apps-returns-OK-response.json create mode 100644 tests/scenarios/cassettes/v2/apps/Update-App-returns-Bad-Request-response.frozen create mode 100644 tests/scenarios/cassettes/v2/apps/Update-App-returns-Bad-Request-response.json create mode 100644 tests/scenarios/cassettes/v2/apps/Update-App-returns-OK-response.frozen create mode 100644 tests/scenarios/cassettes/v2/apps/Update-App-returns-OK-response.json create mode 100644 tests/scenarios/features/v2/app_deployment.feature create mode 100644 tests/scenarios/features/v2/apps.feature diff --git a/.apigentools-info b/.apigentools-info index 2ffdcbbe0..f4ddf6c44 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-12-12 15:23:50.266080", - "spec_repo_commit": "222e1f81" + "regenerated": "2024-12-12 19:15:10.175848", + "spec_repo_commit": "bc9e8733" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-12-12 15:23:50.285587", - "spec_repo_commit": "222e1f81" + "regenerated": "2024-12-12 19:15:10.195036", + "spec_repo_commit": "bc9e8733" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 05e8f325c..6689e131b 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1615,6 +1615,126 @@ components: type: string x-enum-varnames: - apm_retention_filter + AppBuilderError: + description: The definition of `AppBuilderError` object. + properties: + errors: + description: The `AppBuilderError` `errors`. + items: + $ref: '#/components/schemas/AppBuilderErrorErrorsItems' + type: array + type: object + AppBuilderErrorErrorsItems: + description: The definition of `AppBuilderErrorErrorsItems` object. + properties: + detail: + description: The `items` `detail`. + type: string + source: + $ref: '#/components/schemas/AppBuilderErrorErrorsItemsSource' + type: object + AppBuilderErrorErrorsItemsSource: + description: The definition of `AppBuilderErrorErrorsItemsSource` object. + properties: + parameter: + description: The `source` `parameter`. + type: string + pointer: + description: The `source` `pointer`. + type: string + type: object + AppBuilderEvent: + additionalProperties: {} + description: The definition of `AppBuilderEvent` object. + properties: + name: + $ref: '#/components/schemas/AppBuilderEventName' + type: + $ref: '#/components/schemas/AppBuilderEventType' + type: object + AppBuilderEventName: + description: The triggering action for the event. + enum: + - pageChange + - tableRowClick + - _tableRowButtonClick + - change + - submit + - click + - toggleOpen + - close + - open + - executionFinished + type: string + x-enum-varnames: + - PAGECHANGE + - TABLEROWCLICK + - TABLEROWBUTTONCLICK + - CHANGE + - SUBMIT + - CLICK + - TOGGLEOPEN + - CLOSE + - OPEN + - EXECUTIONFINISHED + AppBuilderEventType: + description: The response to the event. + enum: + - custom + - setComponentState + - triggerQuery + - openModal + - closeModal + - openUrl + - downloadFile + - setStateVariableValue + type: string + x-enum-varnames: + - CUSTOM + - SETCOMPONENTSTATE + - TRIGGERQUERY + - OPENMODAL + - CLOSEMODAL + - OPENURL + - DOWNLOADFILE + - SETSTATEVARIABLEVALUE + AppMeta: + description: The definition of `AppMeta` object. + properties: + created_at: + description: The `AppMeta` `created_at`. + type: string + deleted_at: + description: The `AppMeta` `deleted_at`. + type: string + org_id: + description: The `AppMeta` `org_id`. + format: int64 + type: integer + run_as_user: + description: The `AppMeta` `run_as_user`. + type: string + updated_at: + description: The `AppMeta` `updated_at`. + type: string + updated_since_deployment: + description: The `AppMeta` `updated_since_deployment`. + type: boolean + user_id: + description: The `AppMeta` `user_id`. + format: int64 + type: integer + user_name: + description: The `AppMeta` `user_name`. + type: string + user_uuid: + description: The `AppMeta` `user_uuid`. + type: string + version: + description: The `AppMeta` `version`. + format: int64 + type: integer + type: object ApplicationKeyCreateAttributes: description: Attributes used to create an application Key. properties: @@ -1766,6 +1886,27 @@ components: type: string x-enum-varnames: - APPLICATION_KEYS + AppsSortField: + description: The field and direction to sort apps by + enum: + - name + - created_at + - updated_at + - user_name + - -name + - -created_at + - -updated_at + - -user_name + type: string + x-enum-varnames: + - NAME + - CREATED_AT + - UPDATED_AT + - USER_NAME + - NAME_DESC + - CREATED_AT_DESC + - UPDATED_AT_DESC + - USER_NAME_DESC AuditLogsEvent: description: Object description of an Audit Logs event after it is processed and stored by Datadog. @@ -5500,6 +5641,150 @@ components: $ref: '#/components/schemas/CloudflareAccountResponseData' type: array type: object + Component: + description: The definition of `Component` object. + properties: + events: + description: The `Component` `events`. + items: + $ref: '#/components/schemas/AppBuilderEvent' + type: array + id: + description: The `Component` `id`. + nullable: true + type: string + name: + description: The `Component` `name`. + example: '' + type: string + properties: + $ref: '#/components/schemas/ComponentProperties' + type: + $ref: '#/components/schemas/ComponentType' + required: + - name + - type + - properties + type: object + ComponentGrid: + description: The definition of `ComponentGrid` object. + properties: + events: + description: The `ComponentGrid` `events`. + items: + $ref: '#/components/schemas/AppBuilderEvent' + type: array + id: + description: The `ComponentGrid` `id`. + type: string + name: + description: The `ComponentGrid` `name`. + example: '' + type: string + properties: + $ref: '#/components/schemas/ComponentGridProperties' + type: + $ref: '#/components/schemas/ComponentGridType' + required: + - name + - type + - properties + type: object + ComponentGridProperties: + description: The definition of `ComponentGridProperties` object. + properties: + backgroundColor: + default: default + description: The `ComponentGridProperties` `backgroundColor`. + type: string + children: + description: The `ComponentGridProperties` `children`. + items: + $ref: '#/components/schemas/Component' + type: array + isVisible: + $ref: '#/components/schemas/ComponentGridPropertiesIsVisible' + type: object + ComponentGridPropertiesIsVisible: + description: The definition of `ComponentGridPropertiesIsVisible` object. + oneOf: + - type: string + - default: true + type: boolean + ComponentGridType: + description: The definition of `ComponentGridType` object. + enum: + - grid + example: grid + type: string + x-enum-varnames: + - GRID + ComponentProperties: + additionalProperties: {} + description: The definition of `ComponentProperties` object. + properties: + children: + description: The `ComponentProperties` `children`. + items: + $ref: '#/components/schemas/Component' + type: array + isVisible: + $ref: '#/components/schemas/ComponentPropertiesIsVisible' + type: object + ComponentPropertiesIsVisible: + description: The definition of `ComponentPropertiesIsVisible` object. + oneOf: + - type: boolean + - description: If a string, it should be a valid JavaScript expression that + evaluates to a boolean. + example: ${true} + type: string + ComponentType: + description: The definition of `ComponentType` object. + enum: + - table + - textInput + - textArea + - button + - text + - select + - modal + - schemaForm + - checkbox + - tabs + - vegaChart + - radioButtons + - numberInput + - fileInput + - jsonInput + - gridCell + - dateRangePicker + - search + - container + - calloutValue + example: table + type: string + x-enum-varnames: + - TABLE + - TEXTINPUT + - TEXTAREA + - BUTTON + - TEXT + - SELECT + - MODAL + - SCHEMAFORM + - CHECKBOX + - TABS + - VEGACHART + - RADIOBUTTONS + - NUMBERINPUT + - FILEINPUT + - JSONINPUT + - GRIDCELL + - DATERANGEPICKER + - SEARCH + - CONTAINER + - CALLOUTVALUE ConfluentAccountCreateRequest: description: Payload schema when adding a Confluent account. properties: @@ -6501,6 +6786,132 @@ components: type: string x-enum-varnames: - COST_BY_ORG + CreateAppRequest: + description: The definition of `CreateAppRequest` object. + example: + data: + attributes: + components: + - events: [] + name: grid0 + properties: + children: + - events: [] + name: gridCell0 + properties: + children: + - events: [] + name: calloutValue0 + properties: + isDisabled: false + isLoading: false + isVisible: true + label: CPU Usage + size: sm + style: vivid_yellow + unit: kB + value: '42' + type: calloutValue + isVisible: 'true' + layout: + default: + height: 8 + width: 2 + x: 0 + y: 0 + type: gridCell + type: grid + description: This is a simple example app + embeddedQueries: [] + name: Example App + rootInstanceName: grid0 + type: appDefinitions + properties: + data: + $ref: '#/components/schemas/CreateAppRequestData' + type: object + CreateAppRequestData: + description: The definition of `CreateAppRequestData` object. + properties: + attributes: + $ref: '#/components/schemas/CreateAppRequestDataAttributes' + type: + $ref: '#/components/schemas/CreateAppRequestDataType' + required: + - type + type: object + CreateAppRequestDataAttributes: + description: The definition of `CreateAppRequestDataAttributes` object. + properties: + components: + description: The `attributes` `components`. + items: + $ref: '#/components/schemas/ComponentGrid' + type: array + description: + description: The `attributes` `description`. + type: string + embeddedQueries: + description: The `attributes` `embeddedQueries`. + items: + $ref: '#/components/schemas/Query' + type: array + inputSchema: + $ref: '#/components/schemas/InputSchema' + name: + description: The `attributes` `name`. + type: string + rootInstanceName: + description: The `attributes` `rootInstanceName`. + type: string + scripts: + description: The `attributes` `scripts`. + items: + $ref: '#/components/schemas/Script' + type: array + tags: + description: The `attributes` `tags`. + items: + type: string + type: array + type: object + CreateAppRequestDataType: + default: appDefinitions + description: The definition of `CreateAppRequestDataType` object. + enum: + - appDefinitions + example: appDefinitions + type: string + x-enum-varnames: + - APPDEFINITIONS + CreateAppResponse: + description: The definition of `CreateAppResponse` object. + properties: + data: + $ref: '#/components/schemas/CreateAppResponseData' + type: object + CreateAppResponseData: + description: The definition of `CreateAppResponseData` object. + properties: + id: + description: The `data` `id`. + example: '' + type: string + type: + $ref: '#/components/schemas/CreateAppResponseDataType' + required: + - id + - type + type: object + CreateAppResponseDataType: + default: appDefinitions + description: The definition of `CreateAppResponseDataType` object. + enum: + - appDefinitions + example: appDefinitions + type: string + x-enum-varnames: + - APPDEFINITIONS CreateDataDeletionRequestBody: description: Object needed to create a data deletion request. properties: @@ -6630,6 +7041,44 @@ components: nullable: true type: string type: object + CustomConnection: + description: The definition of `CustomConnection` object. + properties: + attributes: + $ref: '#/components/schemas/CustomConnectionAttributes' + id: + description: The `CustomConnection` `id`. + type: string + type: + $ref: '#/components/schemas/CustomConnectionType' + type: object + CustomConnectionAttributes: + description: The definition of `CustomConnectionAttributes` object. + properties: + name: + description: The `attributes` `name`. + type: string + onPremRunner: + $ref: '#/components/schemas/CustomConnectionAttributesOnPremRunner' + type: object + CustomConnectionAttributesOnPremRunner: + description: The definition of `CustomConnectionAttributesOnPremRunner` object. + properties: + id: + description: The `onPremRunner` `id`. + type: string + url: + description: The `onPremRunner` `url`. + type: string + type: object + CustomConnectionType: + default: custom_connections + description: The definition of `CustomConnectionType` object. + enum: + - custom_connections + type: string + x-enum-varnames: + - CUSTOM_CONNECTIONS CustomCostGetResponseMeta: description: Meta for the response from the Get Custom Costs endpoints. properties: @@ -8011,6 +8460,270 @@ components: type: number type: array type: object + DeleteAppResponse: + description: The definition of `DeleteAppResponse` object. + properties: + data: + $ref: '#/components/schemas/DeleteAppResponseData' + type: object + DeleteAppResponseData: + description: The definition of `DeleteAppResponseData` object. + properties: + id: + description: The `data` `id`. + example: '' + type: string + type: + $ref: '#/components/schemas/DeleteAppResponseDataType' + required: + - id + - type + type: object + DeleteAppResponseDataType: + default: appDefinitions + description: The definition of `DeleteAppResponseDataType` object. + enum: + - appDefinitions + example: appDefinitions + type: string + x-enum-varnames: + - APPDEFINITIONS + DeleteAppsRequest: + description: The definition of `DeleteAppsRequest` object. + example: + data: + - id: 29494ddd-ac13-46a7-8558-b05b050ee755 + type: appDefinitions + - id: 71c0d358-eac5-41e3-892d-a7467571b9b0 + type: appDefinitions + - id: 98e7e44d-1562-474a-90f7-3a94e739c006 + type: appDefinitions + properties: + data: + description: The `DeleteAppsRequest` `data`. + items: + $ref: '#/components/schemas/DeleteAppsRequestDataItems' + type: array + type: object + DeleteAppsRequestDataItems: + description: The definition of `DeleteAppsRequestDataItems` object. + properties: + id: + description: The `items` `id`. + example: '' + type: string + type: + $ref: '#/components/schemas/DeleteAppsRequestDataItemsType' + required: + - id + - type + type: object + DeleteAppsRequestDataItemsType: + default: appDefinitions + description: The definition of `DeleteAppsRequestDataItemsType` object. + enum: + - appDefinitions + example: appDefinitions + type: string + x-enum-varnames: + - APPDEFINITIONS + DeleteAppsResponse: + description: The definition of `DeleteAppsResponse` object. + properties: + data: + description: The `DeleteAppsResponse` `data`. + items: + $ref: '#/components/schemas/DeleteAppsResponseDataItems' + type: array + type: object + DeleteAppsResponseDataItems: + description: The definition of `DeleteAppsResponseDataItems` object. + properties: + id: + description: The `items` `id`. + example: '' + type: string + type: + $ref: '#/components/schemas/DeleteAppsResponseDataItemsType' + required: + - id + - type + type: object + DeleteAppsResponseDataItemsType: + default: appDefinitions + description: The definition of `DeleteAppsResponseDataItemsType` object. + enum: + - appDefinitions + example: appDefinitions + type: string + x-enum-varnames: + - APPDEFINITIONS + DeployAppResponse: + description: The definition of `DeployAppResponse` object. + properties: + data: + $ref: '#/components/schemas/DeployAppResponseData' + type: object + DeployAppResponseData: + description: The definition of `DeployAppResponseData` object. + properties: + attributes: + $ref: '#/components/schemas/DeployAppResponseDataAttributes' + id: + description: The `data` `id`. + type: string + meta: + $ref: '#/components/schemas/DeploymentMeta' + type: + $ref: '#/components/schemas/DeployAppResponseDataType' + type: object + DeployAppResponseDataAttributes: + description: The definition of `DeployAppResponseDataAttributes` object. + properties: + app_version_id: + description: The `attributes` `app_version_id`. + type: string + type: object + DeployAppResponseDataType: + default: deployment + description: The definition of `DeployAppResponseDataType` object. + enum: + - deployment + type: string + x-enum-varnames: + - DEPLOYMENT + Deployment: + description: The definition of `Deployment` object. + properties: + attributes: + $ref: '#/components/schemas/DeploymentAttributes' + id: + description: The `Deployment` `id`. + type: string + meta: + $ref: '#/components/schemas/DeploymentMeta' + type: + $ref: '#/components/schemas/DeploymentType' + type: object + DeploymentAttributes: + description: The definition of `DeploymentAttributes` object. + properties: + app_version_id: + description: The `attributes` `app_version_id`. + type: string + type: object + DeploymentIncluded: + description: The definition of `DeploymentIncluded` object. + properties: + attributes: + $ref: '#/components/schemas/DeploymentIncludedAttributes' + id: + description: The `DeploymentIncluded` `id`. + type: string + meta: + $ref: '#/components/schemas/DeploymentIncludedMeta' + type: + $ref: '#/components/schemas/DeploymentIncludedType' + type: object + DeploymentIncludedAttributes: + description: The definition of `DeploymentIncludedAttributes` object. + properties: + app_version_id: + description: The `attributes` `app_version_id`. + type: string + type: object + DeploymentIncludedMeta: + description: The definition of `DeploymentIncludedMeta` object. + properties: + created_at: + description: The `meta` `created_at`. + type: string + user_id: + description: The `meta` `user_id`. + format: int64 + type: integer + user_name: + description: The `meta` `user_name`. + type: string + user_uuid: + description: The `meta` `user_uuid`. + type: string + type: object + DeploymentIncludedType: + default: deployment + description: The definition of `DeploymentIncludedType` object. + enum: + - deployment + type: string + x-enum-varnames: + - DEPLOYMENT + DeploymentMeta: + description: The definition of `DeploymentMeta` object. + properties: + created_at: + description: The `DeploymentMeta` `created_at`. + type: string + user_id: + description: The `DeploymentMeta` `user_id`. + format: int64 + type: integer + user_name: + description: The `DeploymentMeta` `user_name`. + type: string + user_uuid: + description: The `DeploymentMeta` `user_uuid`. + type: string + type: object + DeploymentRelationship: + description: The definition of `DeploymentRelationship` object. + properties: + data: + $ref: '#/components/schemas/DeploymentRelationshipData' + meta: + $ref: '#/components/schemas/DeploymentRelationshipMeta' + type: object + DeploymentRelationshipData: + description: The definition of `DeploymentRelationshipData` object. + properties: + id: + description: The `data` `id`. + type: string + type: + $ref: '#/components/schemas/DeploymentRelationshipDataType' + type: object + DeploymentRelationshipDataType: + default: deployment + description: The definition of `DeploymentRelationshipDataType` object. + enum: + - deployment + type: string + x-enum-varnames: + - DEPLOYMENT + DeploymentRelationshipMeta: + description: The definition of `DeploymentRelationshipMeta` object. + properties: + created_at: + description: The `meta` `created_at`. + type: string + user_id: + description: The `meta` `user_id`. + format: int64 + type: integer + user_name: + description: The `meta` `user_name`. + type: string + user_uuid: + description: The `meta` `user_uuid`. + type: string + type: object + DeploymentType: + default: deployment + description: The definition of `DeploymentType` object. + enum: + - deployment + type: string + x-enum-varnames: + - DEPLOYMENT DetailedFinding: description: A single finding with with message and resource configuration. properties: @@ -8194,6 +8907,40 @@ components: description: The type of the resource. The value should always be device. type: string type: object + DisableAppResponse: + description: The definition of `DisableAppResponse` object. + properties: + data: + $ref: '#/components/schemas/DisableAppResponseData' + type: object + DisableAppResponseData: + description: The definition of `DisableAppResponseData` object. + properties: + attributes: + $ref: '#/components/schemas/DisableAppResponseDataAttributes' + id: + description: The `data` `id`. + type: string + meta: + $ref: '#/components/schemas/DeploymentMeta' + type: + $ref: '#/components/schemas/DisableAppResponseDataType' + type: object + DisableAppResponseDataAttributes: + description: The definition of `DisableAppResponseDataAttributes` object. + properties: + app_version_id: + description: The `attributes` `app_version_id`. + type: string + type: object + DisableAppResponseDataType: + default: deployment + description: The definition of `DisableAppResponseDataType` object. + enum: + - deployment + type: string + x-enum-varnames: + - DEPLOYMENT DomainAllowlist: description: The email domain allowlist for an org. properties: @@ -10974,6 +11721,95 @@ components: type: string x-enum-varnames: - GCP_SERVICE_ACCOUNT + GetAppResponse: + description: The definition of `GetAppResponse` object. + properties: + data: + $ref: '#/components/schemas/GetAppResponseData' + included: + description: The `GetAppResponse` `included`. + items: + $ref: '#/components/schemas/DeploymentIncluded' + type: array + meta: + $ref: '#/components/schemas/AppMeta' + relationship: + $ref: '#/components/schemas/GetAppResponseRelationship' + type: object + GetAppResponseData: + description: The definition of `GetAppResponseData` object. + properties: + attributes: + $ref: '#/components/schemas/GetAppResponseDataAttributes' + id: + description: The `data` `id`. + example: '' + type: string + type: + $ref: '#/components/schemas/GetAppResponseDataType' + required: + - id + - type + - attributes + type: object + GetAppResponseDataAttributes: + description: The definition of `GetAppResponseDataAttributes` object. + properties: + components: + description: The `attributes` `components`. + items: + $ref: '#/components/schemas/ComponentGrid' + type: array + description: + description: The `attributes` `description`. + type: string + embeddedQueries: + description: The `attributes` `embeddedQueries`. + items: + $ref: '#/components/schemas/Query' + type: array + favorite: + description: The `attributes` `favorite`. + type: boolean + inputSchema: + $ref: '#/components/schemas/InputSchema' + name: + description: The `attributes` `name`. + type: string + rootInstanceName: + description: The `attributes` `rootInstanceName`. + type: string + scripts: + description: The `attributes` `scripts`. + items: + $ref: '#/components/schemas/Script' + type: array + tags: + description: The `attributes` `tags`. + items: + type: string + type: array + type: object + GetAppResponseDataType: + default: appDefinitions + description: The definition of `GetAppResponseDataType` object. + enum: + - appDefinitions + example: appDefinitions + type: string + x-enum-varnames: + - APPDEFINITIONS + GetAppResponseRelationship: + description: The definition of `GetAppResponseRelationship` object. + properties: + connections: + description: The `relationship` `connections`. + items: + $ref: '#/components/schemas/CustomConnection' + type: array + deployment: + $ref: '#/components/schemas/DeploymentRelationship' + type: object GetDataDeletionsResponseBody: description: The response from the get data deletion requests endpoint. properties: @@ -13627,6 +14463,77 @@ components: - ONCALL - INCIDENT - RELATION + InputSchema: + description: The definition of `InputSchema` object. + properties: + data: + $ref: '#/components/schemas/InputSchemaData' + type: object + InputSchemaData: + description: The definition of `InputSchemaData` object. + properties: + attributes: + $ref: '#/components/schemas/InputSchemaDataAttributes' + id: + description: The `data` `id`. + type: string + type: + $ref: '#/components/schemas/InputSchemaDataType' + type: object + InputSchemaDataAttributes: + description: The definition of `InputSchemaDataAttributes` object. + properties: + parameters: + description: The `attributes` `parameters`. + items: + $ref: '#/components/schemas/InputSchemaDataAttributesParametersItems' + type: array + type: object + InputSchemaDataAttributesParametersItems: + description: The definition of `InputSchemaDataAttributesParametersItems` object. + properties: + data: + $ref: '#/components/schemas/InputSchemaDataAttributesParametersItemsData' + type: object + InputSchemaDataAttributesParametersItemsData: + description: The definition of `InputSchemaDataAttributesParametersItemsData` + object. + properties: + attributes: + $ref: '#/components/schemas/InputSchemaDataAttributesParametersItemsDataAttributes' + type: object + InputSchemaDataAttributesParametersItemsDataAttributes: + description: The definition of `InputSchemaDataAttributesParametersItemsDataAttributes` + object. + properties: + defaultValue: + description: The `attributes` `defaultValue`. + description: + description: The `attributes` `description`. + type: string + enum: + description: The `attributes` `enum`. + items: + type: string + type: array + label: + description: The `attributes` `label`. + type: string + name: + description: The `attributes` `name`. + type: string + type: + description: The `attributes` `type`. + type: string + type: object + InputSchemaDataType: + default: inputSchema + description: The definition of `InputSchemaDataType` object. + enum: + - inputSchema + type: string + x-enum-varnames: + - INPUTSCHEMA IntakePayloadAccepted: description: The payload accepted for intake. properties: @@ -14012,6 +14919,96 @@ components: meta: $ref: '#/components/schemas/ApplicationKeyResponseMeta' type: object + ListAppsResponse: + description: The definition of `ListAppsResponse` object. + properties: + data: + description: The `ListAppsResponse` `data`. + items: + $ref: '#/components/schemas/ListAppsResponseDataItems' + type: array + included: + description: The `ListAppsResponse` `included`. + items: + $ref: '#/components/schemas/DeploymentIncluded' + type: array + meta: + $ref: '#/components/schemas/ListAppsResponseMeta' + type: object + ListAppsResponseDataItems: + description: The definition of `ListAppsResponseDataItems` object. + properties: + attributes: + $ref: '#/components/schemas/ListAppsResponseDataItemsAttributes' + id: + description: The `items` `id`. + example: '' + type: string + meta: + $ref: '#/components/schemas/AppMeta' + relationships: + $ref: '#/components/schemas/ListAppsResponseDataItemsRelationships' + type: + $ref: '#/components/schemas/ListAppsResponseDataItemsType' + required: + - id + - type + - attributes + type: object + ListAppsResponseDataItemsAttributes: + description: The definition of `ListAppsResponseDataItemsAttributes` object. + properties: + description: + description: The `attributes` `description`. + type: string + favorite: + description: The `attributes` `favorite`. + type: boolean + name: + description: The `attributes` `name`. + type: string + selfService: + description: The `attributes` `selfService`. + type: boolean + tags: + description: The `attributes` `tags`. + items: + type: string + type: array + type: object + ListAppsResponseDataItemsRelationships: + description: The definition of `ListAppsResponseDataItemsRelationships` object. + properties: + deployment: + $ref: '#/components/schemas/DeploymentRelationship' + type: object + ListAppsResponseDataItemsType: + default: appDefinitions + description: The definition of `ListAppsResponseDataItemsType` object. + enum: + - appDefinitions + example: appDefinitions + type: string + x-enum-varnames: + - APPDEFINITIONS + ListAppsResponseMeta: + description: The definition of `ListAppsResponseMeta` object. + properties: + page: + $ref: '#/components/schemas/ListAppsResponseMetaPage' + type: object + ListAppsResponseMetaPage: + description: The definition of `ListAppsResponseMetaPage` object. + properties: + totalCount: + description: The `page` `totalCount`. + format: int64 + type: integer + totalFilteredCount: + description: The `page` `totalFilteredCount`. + format: int64 + type: integer + type: object ListDevicesResponse: description: List devices response. properties: @@ -18780,6 +19777,31 @@ components: $ref: '#/components/schemas/Project' type: array type: object + Query: + description: The definition of `Query` object. + properties: + events: + description: The `Query` `events`. + items: + $ref: '#/components/schemas/AppBuilderEvent' + type: array + id: + description: The `Query` `id`. + example: '' + type: string + name: + description: The `Query` `name`. + example: '' + type: string + properties: + description: The `Query` `properties`. + type: + $ref: '#/components/schemas/QueryType' + required: + - id + - name + - type + type: object QueryFormula: description: A formula for calculation based on one or more queries. properties: @@ -18803,6 +19825,18 @@ components: x-enum-varnames: - ASC - DESC + QueryType: + description: The definition of `QueryType` object. + enum: + - action + - stateVariable + - dataTransform + example: action + type: string + x-enum-varnames: + - ACTION + - STATEVARIABLE + - DATATRANSFORM RUMAggregateBucketValue: description: A bucket value, can be either a timeseries or a single value. oneOf: @@ -21337,6 +22371,44 @@ components: type: string x-enum-varnames: - SCORECARD + Script: + description: The definition of `Script` object. + properties: + data: + $ref: '#/components/schemas/ScriptData' + type: object + ScriptData: + description: The definition of `ScriptData` object. + properties: + attributes: + $ref: '#/components/schemas/ScriptDataAttributes' + id: + description: The `data` `id`. + type: string + type: + $ref: '#/components/schemas/ScriptDataType' + type: object + ScriptDataAttributes: + description: The definition of `ScriptDataAttributes` object. + properties: + name: + description: The `attributes` `name`. + type: string + src: + description: The `attributes` `src`. + type: string + type: + description: The `attributes` `type`. + type: string + type: object + ScriptDataType: + default: scripts + description: The definition of `ScriptDataType` object. + enum: + - scripts + type: string + x-enum-varnames: + - SCRIPTS SecurityFilter: description: The security filter's properties. properties: @@ -26930,6 +28002,197 @@ components: example: min type: string type: object + UpdateAppRequest: + description: The definition of `UpdateAppRequest` object. + example: + data: + attributes: + components: + - events: [] + name: grid0 + properties: + children: + - events: [] + name: gridCell0 + properties: + children: + - events: [] + name: calloutValue0 + properties: + isDisabled: false + isLoading: false + isVisible: true + label: CPU Usage + size: sm + style: vivid_yellow + unit: kB + value: '42' + type: calloutValue + isVisible: 'true' + layout: + default: + height: 8 + width: 2 + x: 0 + y: 0 + type: gridCell + type: grid + description: This is a simple example app + embeddedQueries: [] + name: Example App + rootInstanceName: grid0 + id: 9e20cbaf-68da-45a6-9ccf-54193ac29fa5 + type: appDefinitions + properties: + data: + $ref: '#/components/schemas/UpdateAppRequestData' + type: object + UpdateAppRequestData: + description: The definition of `UpdateAppRequestData` object. + properties: + attributes: + $ref: '#/components/schemas/UpdateAppRequestDataAttributes' + id: + description: The `data` `id`. + type: string + type: + $ref: '#/components/schemas/UpdateAppRequestDataType' + required: + - type + type: object + UpdateAppRequestDataAttributes: + description: The definition of `UpdateAppRequestDataAttributes` object. + properties: + components: + description: The `attributes` `components`. + items: + $ref: '#/components/schemas/ComponentGrid' + type: array + description: + description: The `attributes` `description`. + type: string + embeddedQueries: + description: The `attributes` `embeddedQueries`. + items: + $ref: '#/components/schemas/Query' + type: array + inputSchema: + $ref: '#/components/schemas/InputSchema' + name: + description: The `attributes` `name`. + type: string + rootInstanceName: + description: The `attributes` `rootInstanceName`. + type: string + scripts: + description: The `attributes` `scripts`. + items: + $ref: '#/components/schemas/Script' + type: array + tags: + description: The `attributes` `tags`. + items: + type: string + type: array + type: object + UpdateAppRequestDataType: + default: appDefinitions + description: The definition of `UpdateAppRequestDataType` object. + enum: + - appDefinitions + example: appDefinitions + type: string + x-enum-varnames: + - APPDEFINITIONS + UpdateAppResponse: + description: The definition of `UpdateAppResponse` object. + properties: + data: + $ref: '#/components/schemas/UpdateAppResponseData' + included: + description: The `UpdateAppResponse` `included`. + items: + $ref: '#/components/schemas/DeploymentIncluded' + type: array + meta: + $ref: '#/components/schemas/AppMeta' + relationship: + $ref: '#/components/schemas/UpdateAppResponseRelationship' + type: object + UpdateAppResponseData: + description: The definition of `UpdateAppResponseData` object. + properties: + attributes: + $ref: '#/components/schemas/UpdateAppResponseDataAttributes' + id: + description: The `data` `id`. + example: '' + type: string + type: + $ref: '#/components/schemas/UpdateAppResponseDataType' + required: + - id + - type + - attributes + type: object + UpdateAppResponseDataAttributes: + description: The definition of `UpdateAppResponseDataAttributes` object. + properties: + components: + description: The `attributes` `components`. + items: + $ref: '#/components/schemas/ComponentGrid' + type: array + description: + description: The `attributes` `description`. + type: string + embeddedQueries: + description: The `attributes` `embeddedQueries`. + items: + $ref: '#/components/schemas/Query' + type: array + favorite: + description: The `attributes` `favorite`. + type: boolean + inputSchema: + $ref: '#/components/schemas/InputSchema' + name: + description: The `attributes` `name`. + type: string + rootInstanceName: + description: The `attributes` `rootInstanceName`. + type: string + scripts: + description: The `attributes` `scripts`. + items: + $ref: '#/components/schemas/Script' + type: array + tags: + description: The `attributes` `tags`. + items: + type: string + type: array + type: object + UpdateAppResponseDataType: + default: appDefinitions + description: The definition of `UpdateAppResponseDataType` object. + enum: + - appDefinitions + example: appDefinitions + type: string + x-enum-varnames: + - APPDEFINITIONS + UpdateAppResponseRelationship: + description: The definition of `UpdateAppResponseRelationship` object. + properties: + connections: + description: The `relationship` `connections`. + items: + $ref: '#/components/schemas/CustomConnection' + type: array + deployment: + $ref: '#/components/schemas/DeploymentRelationship' + type: object UpdateOpenAPIResponse: description: Response for `UpdateOpenAPI`. properties: @@ -28688,6 +29951,430 @@ paths: permissions: - apm_retention_filter_write - apm_pipelines_write + /api/v2/app-builder/apps: + delete: + description: Delete multiple apps by ID + operationId: DeleteApps + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteAppsRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteAppsResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Forbidden, e.g. missing permissions to delete one or more apps + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Delete Multiple Apps + tags: + - Apps + x-permission: + operator: OR + permissions: + - apps_write + x-unstable: '**Note**: App Builder API endpoints are still under active development + and may change at any time.' + get: + description: List all apps, with optional filters and sorting + operationId: ListApps + parameters: + - description: The number of apps to return per page + in: query + name: limit + required: false + schema: + format: int64 + type: integer + - description: The page number to return + in: query + name: page + required: false + schema: + format: int64 + type: integer + - description: The `AppsFilter` `user_name`. + in: query + name: filter[user_name] + required: false + schema: + type: string + - description: The `AppsFilter` `user_uuid`. + in: query + name: filter[user_uuid] + required: false + schema: + type: string + - description: The `AppsFilter` `name`. + in: query + name: filter[name] + required: false + schema: + type: string + - description: The `AppsFilter` `query`. + in: query + name: filter[query] + required: false + schema: + type: string + - description: The `AppsFilter` `deployed`. + in: query + name: filter[deployed] + required: false + schema: + type: boolean + - description: The `AppsFilter` `tags`. + in: query + name: filter[tags] + required: false + schema: + type: string + - description: The `AppsFilter` `favorite`. + in: query + name: filter[favorite] + required: false + schema: + type: boolean + - explode: false + in: query + name: sort + required: false + schema: + items: + $ref: '#/components/schemas/AppsSortField' + type: array + style: form + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ListAppsResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Bad Request, e.g. invalid sort parameter + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: List Apps + tags: + - Apps + x-permission: + operator: OR + permissions: + - apps_run + x-unstable: '**Note**: App Builder API endpoints are still under active development + and may change at any time.' + post: + description: Create a new app, returning the app ID + operationId: CreateApp + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateAppRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/CreateAppResponse' + description: App Created + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Forbidden, e.g. missing required permissions to a connection + or workflow used in the app + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Create App + tags: + - Apps + x-permission: + operator: AND + permissions: + - apps_write + - connections_resolve + - workflows_run + x-unstable: '**Note**: App Builder API endpoints are still under active development + and may change at any time.' + /api/v2/app-builder/apps/{app_id}: + delete: + description: Delete an app by ID + operationId: DeleteApp + parameters: + - in: path + name: app_id + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteAppResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Not Found + '410': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Gone + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Delete App + tags: + - Apps + x-permission: + operator: OR + permissions: + - apps_write + x-unstable: '**Note**: App Builder API endpoints are still under active development + and may change at any time.' + get: + description: Get the full definition of an app by ID + operationId: GetApp + parameters: + - in: path + name: app_id + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/GetAppResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get App + tags: + - Apps + x-permission: + operator: AND + permissions: + - apps_run + - connections_read + x-unstable: '**Note**: App Builder API endpoints are still under active development + and may change at any time.' + patch: + description: Update an existing app by ID. Creates a new version of the app + operationId: UpdateApp + parameters: + - in: path + name: app_id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateAppRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateAppResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Forbidden, e.g. missing required permissions to a connection + or workflow used in the app + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Update App + tags: + - Apps + x-permission: + operator: AND + permissions: + - apps_write + - connections_resolve + - workflows_run + x-unstable: '**Note**: App Builder API endpoints are still under active development + and may change at any time.' + /api/v2/app-builder/apps/{app_id}/deployment: + delete: + description: Disable an app by ID + operationId: DisableApp + parameters: + - in: path + name: app_id + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DisableAppResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Disable App + tags: + - App Deployment + x-permission: + operator: OR + permissions: + - apps_write + x-unstable: '**Note**: App Builder API endpoints are still under active development + and may change at any time.' + post: + description: Deploy (publish) an app by ID + operationId: DeployApp + parameters: + - in: path + name: app_id + required: true + schema: + type: string + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/DeployAppResponse' + description: Created + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Deploy App + tags: + - App Deployment + x-permission: + operator: OR + permissions: + - apps_write + x-unstable: '**Note**: App Builder API endpoints are still under active development + and may change at any time.' /api/v2/application_keys: get: description: List all application keys available for your org @@ -44601,6 +46288,10 @@ tags: externalDocs: url: https://docs.datadoghq.com/integrations/amazon_web_services/#log-collection name: AWS Logs Integration +- description: Deploy and disable apps in App Builder. + name: App Deployment +- description: Create, read, update, and delete apps in App Builder. + name: Apps - description: Search your Audit Logs events over HTTP. name: Audit - description: '[The AuthN Mappings API](https://docs.datadoghq.com/account_management/authn_mapping/?tab=example) diff --git a/examples/v2_app-deployment_DeployApp.rs b/examples/v2_app-deployment_DeployApp.rs new file mode 100644 index 000000000..27dd9dcdd --- /dev/null +++ b/examples/v2_app-deployment_DeployApp.rs @@ -0,0 +1,18 @@ +// Deploy App returns "Created" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_app_deployment::AppDeploymentAPI; + +#[tokio::main] +async fn main() { + // there is a valid "app" in the system + let app_data_id = std::env::var("APP_DATA_ID").unwrap(); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.DeployApp", true); + let api = AppDeploymentAPI::with_config(configuration); + let resp = api.deploy_app(app_data_id.clone()).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_app-deployment_DisableApp.rs b/examples/v2_app-deployment_DisableApp.rs new file mode 100644 index 000000000..d12e7c6c5 --- /dev/null +++ b/examples/v2_app-deployment_DisableApp.rs @@ -0,0 +1,18 @@ +// Disable App returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_app_deployment::AppDeploymentAPI; + +#[tokio::main] +async fn main() { + // there is a valid "app" in the system + let app_data_id = std::env::var("APP_DATA_ID").unwrap(); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.DisableApp", true); + let api = AppDeploymentAPI::with_config(configuration); + let resp = api.disable_app(app_data_id.clone()).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_apps_CreateApp.rs b/examples/v2_apps_CreateApp.rs new file mode 100644 index 000000000..8a7eb8516 --- /dev/null +++ b/examples/v2_apps_CreateApp.rs @@ -0,0 +1,55 @@ +// Create App returns "App Created" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_apps::AppsAPI; +use datadog_api_client::datadogV2::model::Component; +use datadog_api_client::datadogV2::model::ComponentGrid; +use datadog_api_client::datadogV2::model::ComponentGridProperties; +use datadog_api_client::datadogV2::model::ComponentGridType; +use datadog_api_client::datadogV2::model::ComponentProperties; +use datadog_api_client::datadogV2::model::ComponentPropertiesIsVisible; +use datadog_api_client::datadogV2::model::ComponentType; +use datadog_api_client::datadogV2::model::CreateAppRequest; +use datadog_api_client::datadogV2::model::CreateAppRequestData; +use datadog_api_client::datadogV2::model::CreateAppRequestDataAttributes; +use datadog_api_client::datadogV2::model::CreateAppRequestDataType; + +#[tokio::main] +async fn main() { + let body = CreateAppRequest::new().data( + CreateAppRequestData::new(CreateAppRequestDataType::APPDEFINITIONS).attributes( + CreateAppRequestDataAttributes::new() + .components(vec![ComponentGrid::new( + "grid0".to_string(), + ComponentGridProperties::new().children(vec![Component::new( + "gridCell0".to_string(), + ComponentProperties::new() + .children(vec![Component::new( + "calloutValue0".to_string(), + ComponentProperties::new() + .is_visible(ComponentPropertiesIsVisible::Bool(true)), + ComponentType::CALLOUTVALUE, + ) + .events(vec![])]) + .is_visible(ComponentPropertiesIsVisible::String("true".to_string())), + ComponentType::GRIDCELL, + ) + .events(vec![])]), + ComponentGridType::GRID, + ) + .events(vec![])]) + .description("This is a simple example app".to_string()) + .embedded_queries(vec![]) + .name("Example App".to_string()) + .root_instance_name("grid0".to_string()), + ), + ); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.CreateApp", true); + let api = AppsAPI::with_config(configuration); + let resp = api.create_app(body).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_apps_DeleteApp.rs b/examples/v2_apps_DeleteApp.rs new file mode 100644 index 000000000..43eb44227 --- /dev/null +++ b/examples/v2_apps_DeleteApp.rs @@ -0,0 +1,18 @@ +// Delete App returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_apps::AppsAPI; + +#[tokio::main] +async fn main() { + // there is a valid "app" in the system + let app_data_id = std::env::var("APP_DATA_ID").unwrap(); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.DeleteApp", true); + let api = AppsAPI::with_config(configuration); + let resp = api.delete_app(app_data_id.clone()).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_apps_DeleteApps.rs b/examples/v2_apps_DeleteApps.rs new file mode 100644 index 000000000..59491dd2a --- /dev/null +++ b/examples/v2_apps_DeleteApps.rs @@ -0,0 +1,25 @@ +// Delete Multiple Apps returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_apps::AppsAPI; +use datadog_api_client::datadogV2::model::DeleteAppsRequest; +use datadog_api_client::datadogV2::model::DeleteAppsRequestDataItems; +use datadog_api_client::datadogV2::model::DeleteAppsRequestDataItemsType; + +#[tokio::main] +async fn main() { + // there is a valid "app" in the system + let app_data_id = std::env::var("APP_DATA_ID").unwrap(); + let body = DeleteAppsRequest::new().data(vec![DeleteAppsRequestDataItems::new( + app_data_id.clone(), + DeleteAppsRequestDataItemsType::APPDEFINITIONS, + )]); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.DeleteApps", true); + let api = AppsAPI::with_config(configuration); + let resp = api.delete_apps(body).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_apps_GetApp.rs b/examples/v2_apps_GetApp.rs new file mode 100644 index 000000000..0cd550bf5 --- /dev/null +++ b/examples/v2_apps_GetApp.rs @@ -0,0 +1,18 @@ +// Get App returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_apps::AppsAPI; + +#[tokio::main] +async fn main() { + // there is a valid "app" in the system + let app_data_id = std::env::var("APP_DATA_ID").unwrap(); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.GetApp", true); + let api = AppsAPI::with_config(configuration); + let resp = api.get_app(app_data_id.clone()).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_apps_ListApps.rs b/examples/v2_apps_ListApps.rs new file mode 100644 index 000000000..7d6d3bf9d --- /dev/null +++ b/examples/v2_apps_ListApps.rs @@ -0,0 +1,17 @@ +// List Apps returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_apps::AppsAPI; +use datadog_api_client::datadogV2::api_apps::ListAppsOptionalParams; + +#[tokio::main] +async fn main() { + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.ListApps", true); + let api = AppsAPI::with_config(configuration); + let resp = api.list_apps(ListAppsOptionalParams::default()).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_apps_UpdateApp.rs b/examples/v2_apps_UpdateApp.rs new file mode 100644 index 000000000..b04fc833a --- /dev/null +++ b/examples/v2_apps_UpdateApp.rs @@ -0,0 +1,31 @@ +// Update App returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_apps::AppsAPI; +use datadog_api_client::datadogV2::model::UpdateAppRequest; +use datadog_api_client::datadogV2::model::UpdateAppRequestData; +use datadog_api_client::datadogV2::model::UpdateAppRequestDataAttributes; +use datadog_api_client::datadogV2::model::UpdateAppRequestDataType; + +#[tokio::main] +async fn main() { + // there is a valid "app" in the system + let app_data_id = std::env::var("APP_DATA_ID").unwrap(); + let body = UpdateAppRequest::new().data( + UpdateAppRequestData::new(UpdateAppRequestDataType::APPDEFINITIONS) + .attributes( + UpdateAppRequestDataAttributes::new() + .name("Updated Name".to_string()) + .root_instance_name("grid0".to_string()), + ) + .id(app_data_id.clone()), + ); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.UpdateApp", true); + let api = AppsAPI::with_config(configuration); + let resp = api.update_app(app_data_id.clone(), body).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/src/datadog/configuration.rs b/src/datadog/configuration.rs index 2672d6143..b50265f50 100644 --- a/src/datadog/configuration.rs +++ b/src/datadog/configuration.rs @@ -134,6 +134,14 @@ impl Default for Configuration { ("v2.get_open_api".to_owned(), false), ("v2.list_apis".to_owned(), false), ("v2.update_open_api".to_owned(), false), + ("v2.create_app".to_owned(), false), + ("v2.delete_app".to_owned(), false), + ("v2.delete_apps".to_owned(), false), + ("v2.get_app".to_owned(), false), + ("v2.list_apps".to_owned(), false), + ("v2.update_app".to_owned(), false), + ("v2.deploy_app".to_owned(), false), + ("v2.disable_app".to_owned(), false), ("v2.get_active_billing_dimensions".to_owned(), false), ("v2.get_billing_dimension_mapping".to_owned(), false), ("v2.get_monthly_cost_attribution".to_owned(), false), diff --git a/src/datadogV2/api/api_app_deployment.rs b/src/datadogV2/api/api_app_deployment.rs new file mode 100644 index 000000000..8f61c3185 --- /dev/null +++ b/src/datadogV2/api/api_app_deployment.rs @@ -0,0 +1,316 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use crate::datadog; +use log::warn; +use reqwest::header::{HeaderMap, HeaderValue}; +use serde::{Deserialize, Serialize}; + +/// DeployAppError is a struct for typed errors of method [`AppDeploymentAPI::deploy_app`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DeployAppError { + AppBuilderError(crate::datadogV2::model::AppBuilderError), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// DisableAppError is a struct for typed errors of method [`AppDeploymentAPI::disable_app`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DisableAppError { + AppBuilderError(crate::datadogV2::model::AppBuilderError), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// Deploy and disable apps in App Builder. +#[derive(Debug, Clone)] +pub struct AppDeploymentAPI { + config: datadog::Configuration, + client: reqwest_middleware::ClientWithMiddleware, +} + +impl Default for AppDeploymentAPI { + fn default() -> Self { + Self::with_config(datadog::Configuration::default()) + } +} + +impl AppDeploymentAPI { + pub fn new() -> Self { + Self::default() + } + pub fn with_config(config: datadog::Configuration) -> Self { + let mut reqwest_client_builder = reqwest::Client::builder(); + + if let Some(proxy_url) = &config.proxy_url { + let proxy = reqwest::Proxy::all(proxy_url).expect("Failed to parse proxy URL"); + reqwest_client_builder = reqwest_client_builder.proxy(proxy); + } + + let mut middleware_client_builder = + reqwest_middleware::ClientBuilder::new(reqwest_client_builder.build().unwrap()); + + if config.enable_retry { + struct RetryableStatus; + impl reqwest_retry::RetryableStrategy for RetryableStatus { + fn handle( + &self, + res: &Result, + ) -> Option { + match res { + Ok(success) => reqwest_retry::default_on_request_success(success), + Err(_) => None, + } + } + } + let backoff_policy = reqwest_retry::policies::ExponentialBackoff::builder() + .build_with_max_retries(config.max_retries); + + let retry_middleware = + reqwest_retry::RetryTransientMiddleware::new_with_policy_and_strategy( + backoff_policy, + RetryableStatus, + ); + + middleware_client_builder = middleware_client_builder.with(retry_middleware); + } + + let client = middleware_client_builder.build(); + + Self { config, client } + } + + pub fn with_client_and_config( + config: datadog::Configuration, + client: reqwest_middleware::ClientWithMiddleware, + ) -> Self { + Self { config, client } + } + + /// Deploy (publish) an app by ID + pub async fn deploy_app( + &self, + app_id: String, + ) -> Result> { + match self.deploy_app_with_http_info(app_id).await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Deploy (publish) an app by ID + pub async fn deploy_app_with_http_info( + &self, + app_id: String, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.deploy_app"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.deploy_app' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/app-builder/apps/{app_id}/deployment", + local_configuration.get_operation_host(operation_id), + app_id = datadog::urlencode(app_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::POST, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::(&local_content) + { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Disable an app by ID + pub async fn disable_app( + &self, + app_id: String, + ) -> Result> { + match self.disable_app_with_http_info(app_id).await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Disable an app by ID + pub async fn disable_app_with_http_info( + &self, + app_id: String, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.disable_app"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.disable_app' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/app-builder/apps/{app_id}/deployment", + local_configuration.get_operation_host(operation_id), + app_id = datadog::urlencode(app_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } +} diff --git a/src/datadogV2/api/api_apps.rs b/src/datadogV2/api/api_apps.rs new file mode 100644 index 000000000..3b2eac039 --- /dev/null +++ b/src/datadogV2/api/api_apps.rs @@ -0,0 +1,1078 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use crate::datadog; +use flate2::{ + write::{GzEncoder, ZlibEncoder}, + Compression, +}; +use log::warn; +use reqwest::header::{HeaderMap, HeaderValue}; +use serde::{Deserialize, Serialize}; +use std::io::Write; + +/// ListAppsOptionalParams is a struct for passing parameters to the method [`AppsAPI::list_apps`] +#[non_exhaustive] +#[derive(Clone, Default, Debug)] +pub struct ListAppsOptionalParams { + /// The number of apps to return per page + pub limit: Option, + /// The page number to return + pub page: Option, + /// The `AppsFilter` `user_name`. + pub filter_user_name: Option, + /// The `AppsFilter` `user_uuid`. + pub filter_user_uuid: Option, + /// The `AppsFilter` `name`. + pub filter_name: Option, + /// The `AppsFilter` `query`. + pub filter_query: Option, + /// The `AppsFilter` `deployed`. + pub filter_deployed: Option, + /// The `AppsFilter` `tags`. + pub filter_tags: Option, + /// The `AppsFilter` `favorite`. + pub filter_favorite: Option, + pub sort: Option>, +} + +impl ListAppsOptionalParams { + /// The number of apps to return per page + pub fn limit(mut self, value: i64) -> Self { + self.limit = Some(value); + self + } + /// The page number to return + pub fn page(mut self, value: i64) -> Self { + self.page = Some(value); + self + } + /// The `AppsFilter` `user_name`. + pub fn filter_user_name(mut self, value: String) -> Self { + self.filter_user_name = Some(value); + self + } + /// The `AppsFilter` `user_uuid`. + pub fn filter_user_uuid(mut self, value: String) -> Self { + self.filter_user_uuid = Some(value); + self + } + /// The `AppsFilter` `name`. + pub fn filter_name(mut self, value: String) -> Self { + self.filter_name = Some(value); + self + } + /// The `AppsFilter` `query`. + pub fn filter_query(mut self, value: String) -> Self { + self.filter_query = Some(value); + self + } + /// The `AppsFilter` `deployed`. + pub fn filter_deployed(mut self, value: bool) -> Self { + self.filter_deployed = Some(value); + self + } + /// The `AppsFilter` `tags`. + pub fn filter_tags(mut self, value: String) -> Self { + self.filter_tags = Some(value); + self + } + /// The `AppsFilter` `favorite`. + pub fn filter_favorite(mut self, value: bool) -> Self { + self.filter_favorite = Some(value); + self + } + pub fn sort(mut self, value: Vec) -> Self { + self.sort = Some(value); + self + } +} + +/// CreateAppError is a struct for typed errors of method [`AppsAPI::create_app`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum CreateAppError { + AppBuilderError(crate::datadogV2::model::AppBuilderError), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// DeleteAppError is a struct for typed errors of method [`AppsAPI::delete_app`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DeleteAppError { + AppBuilderError(crate::datadogV2::model::AppBuilderError), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// DeleteAppsError is a struct for typed errors of method [`AppsAPI::delete_apps`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DeleteAppsError { + AppBuilderError(crate::datadogV2::model::AppBuilderError), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// GetAppError is a struct for typed errors of method [`AppsAPI::get_app`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetAppError { + AppBuilderError(crate::datadogV2::model::AppBuilderError), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// ListAppsError is a struct for typed errors of method [`AppsAPI::list_apps`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ListAppsError { + AppBuilderError(crate::datadogV2::model::AppBuilderError), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// UpdateAppError is a struct for typed errors of method [`AppsAPI::update_app`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum UpdateAppError { + AppBuilderError(crate::datadogV2::model::AppBuilderError), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// Create, read, update, and delete apps in App Builder. +#[derive(Debug, Clone)] +pub struct AppsAPI { + config: datadog::Configuration, + client: reqwest_middleware::ClientWithMiddleware, +} + +impl Default for AppsAPI { + fn default() -> Self { + Self::with_config(datadog::Configuration::default()) + } +} + +impl AppsAPI { + pub fn new() -> Self { + Self::default() + } + pub fn with_config(config: datadog::Configuration) -> Self { + let mut reqwest_client_builder = reqwest::Client::builder(); + + if let Some(proxy_url) = &config.proxy_url { + let proxy = reqwest::Proxy::all(proxy_url).expect("Failed to parse proxy URL"); + reqwest_client_builder = reqwest_client_builder.proxy(proxy); + } + + let mut middleware_client_builder = + reqwest_middleware::ClientBuilder::new(reqwest_client_builder.build().unwrap()); + + if config.enable_retry { + struct RetryableStatus; + impl reqwest_retry::RetryableStrategy for RetryableStatus { + fn handle( + &self, + res: &Result, + ) -> Option { + match res { + Ok(success) => reqwest_retry::default_on_request_success(success), + Err(_) => None, + } + } + } + let backoff_policy = reqwest_retry::policies::ExponentialBackoff::builder() + .build_with_max_retries(config.max_retries); + + let retry_middleware = + reqwest_retry::RetryTransientMiddleware::new_with_policy_and_strategy( + backoff_policy, + RetryableStatus, + ); + + middleware_client_builder = middleware_client_builder.with(retry_middleware); + } + + let client = middleware_client_builder.build(); + + Self { config, client } + } + + pub fn with_client_and_config( + config: datadog::Configuration, + client: reqwest_middleware::ClientWithMiddleware, + ) -> Self { + Self { config, client } + } + + /// Create a new app, returning the app ID + pub async fn create_app( + &self, + body: crate::datadogV2::model::CreateAppRequest, + ) -> Result> { + match self.create_app_with_http_info(body).await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Create a new app, returning the app ID + pub async fn create_app_with_http_info( + &self, + body: crate::datadogV2::model::CreateAppRequest, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.create_app"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.create_app' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/app-builder/apps", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::POST, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::(&local_content) + { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Delete an app by ID + pub async fn delete_app( + &self, + app_id: String, + ) -> Result> { + match self.delete_app_with_http_info(app_id).await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Delete an app by ID + pub async fn delete_app_with_http_info( + &self, + app_id: String, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.delete_app"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.delete_app' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/app-builder/apps/{app_id}", + local_configuration.get_operation_host(operation_id), + app_id = datadog::urlencode(app_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::(&local_content) + { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Delete multiple apps by ID + pub async fn delete_apps( + &self, + body: crate::datadogV2::model::DeleteAppsRequest, + ) -> Result> { + match self.delete_apps_with_http_info(body).await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Delete multiple apps by ID + pub async fn delete_apps_with_http_info( + &self, + body: crate::datadogV2::model::DeleteAppsRequest, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.delete_apps"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.delete_apps' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/app-builder/apps", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Get the full definition of an app by ID + pub async fn get_app( + &self, + app_id: String, + ) -> Result> { + match self.get_app_with_http_info(app_id).await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Get the full definition of an app by ID + pub async fn get_app_with_http_info( + &self, + app_id: String, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.get_app"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.get_app' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/app-builder/apps/{app_id}", + local_configuration.get_operation_host(operation_id), + app_id = datadog::urlencode(app_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::(&local_content) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// List all apps, with optional filters and sorting + pub async fn list_apps( + &self, + params: ListAppsOptionalParams, + ) -> Result> { + match self.list_apps_with_http_info(params).await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// List all apps, with optional filters and sorting + pub async fn list_apps_with_http_info( + &self, + params: ListAppsOptionalParams, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.list_apps"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.list_apps' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + // unbox and build optional parameters + let limit = params.limit; + let page = params.page; + let filter_user_name = params.filter_user_name; + let filter_user_uuid = params.filter_user_uuid; + let filter_name = params.filter_name; + let filter_query = params.filter_query; + let filter_deployed = params.filter_deployed; + let filter_tags = params.filter_tags; + let filter_favorite = params.filter_favorite; + let sort = params.sort; + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/app-builder/apps", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + + if let Some(ref local_query_param) = limit { + local_req_builder = + local_req_builder.query(&[("limit", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = page { + local_req_builder = + local_req_builder.query(&[("page", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_user_name { + local_req_builder = + local_req_builder.query(&[("filter[user_name]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_user_uuid { + local_req_builder = + local_req_builder.query(&[("filter[user_uuid]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_name { + local_req_builder = + local_req_builder.query(&[("filter[name]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_query { + local_req_builder = + local_req_builder.query(&[("filter[query]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_deployed { + local_req_builder = + local_req_builder.query(&[("filter[deployed]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_tags { + local_req_builder = + local_req_builder.query(&[("filter[tags]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_favorite { + local_req_builder = + local_req_builder.query(&[("filter[favorite]", &local_query_param.to_string())]); + }; + if let Some(ref local) = sort { + local_req_builder = local_req_builder.query(&[( + "sort", + &local + .iter() + .map(|p| p.to_string()) + .collect::>() + .join(",") + .to_string(), + )]); + }; + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::(&local_content) + { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Update an existing app by ID. Creates a new version of the app + pub async fn update_app( + &self, + app_id: String, + body: crate::datadogV2::model::UpdateAppRequest, + ) -> Result> { + match self.update_app_with_http_info(app_id, body).await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Update an existing app by ID. Creates a new version of the app + pub async fn update_app_with_http_info( + &self, + app_id: String, + body: crate::datadogV2::model::UpdateAppRequest, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.update_app"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.update_app' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/app-builder/apps/{app_id}", + local_configuration.get_operation_host(operation_id), + app_id = datadog::urlencode(app_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::(&local_content) + { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } +} diff --git a/src/datadogV2/api/mod.rs b/src/datadogV2/api/mod.rs index 2eab40719..678a9caeb 100644 --- a/src/datadogV2/api/mod.rs +++ b/src/datadogV2/api/mod.rs @@ -4,6 +4,8 @@ pub mod api_api_management; pub mod api_apm_retention_filters; +pub mod api_app_deployment; +pub mod api_apps; pub mod api_audit; pub mod api_authn_mappings; pub mod api_aws_integration; diff --git a/src/datadogV2/mod.rs b/src/datadogV2/mod.rs index f57d3d8da..014b5cd84 100644 --- a/src/datadogV2/mod.rs +++ b/src/datadogV2/mod.rs @@ -5,6 +5,8 @@ pub mod api; pub use self::api::api_api_management; pub use self::api::api_apm_retention_filters; +pub use self::api::api_app_deployment; +pub use self::api::api_apps; pub use self::api::api_audit; pub use self::api::api_authn_mappings; pub use self::api::api_aws_integration; diff --git a/src/datadogV2/model/mod.rs b/src/datadogV2/model/mod.rs index 238d684b9..8565c579a 100644 --- a/src/datadogV2/model/mod.rs +++ b/src/datadogV2/model/mod.rs @@ -186,6 +186,180 @@ pub mod model_retention_filter_update_data; pub use self::model_retention_filter_update_data::RetentionFilterUpdateData; pub mod model_retention_filter_update_attributes; pub use self::model_retention_filter_update_attributes::RetentionFilterUpdateAttributes; +pub mod model_delete_apps_request; +pub use self::model_delete_apps_request::DeleteAppsRequest; +pub mod model_delete_apps_request_data_items; +pub use self::model_delete_apps_request_data_items::DeleteAppsRequestDataItems; +pub mod model_delete_apps_request_data_items_type; +pub use self::model_delete_apps_request_data_items_type::DeleteAppsRequestDataItemsType; +pub mod model_delete_apps_response; +pub use self::model_delete_apps_response::DeleteAppsResponse; +pub mod model_delete_apps_response_data_items; +pub use self::model_delete_apps_response_data_items::DeleteAppsResponseDataItems; +pub mod model_delete_apps_response_data_items_type; +pub use self::model_delete_apps_response_data_items_type::DeleteAppsResponseDataItemsType; +pub mod model_app_builder_error; +pub use self::model_app_builder_error::AppBuilderError; +pub mod model_app_builder_error_errors_items; +pub use self::model_app_builder_error_errors_items::AppBuilderErrorErrorsItems; +pub mod model_app_builder_error_errors_items_source; +pub use self::model_app_builder_error_errors_items_source::AppBuilderErrorErrorsItemsSource; +pub mod model_apps_sort_field; +pub use self::model_apps_sort_field::AppsSortField; +pub mod model_list_apps_response; +pub use self::model_list_apps_response::ListAppsResponse; +pub mod model_list_apps_response_data_items; +pub use self::model_list_apps_response_data_items::ListAppsResponseDataItems; +pub mod model_list_apps_response_data_items_attributes; +pub use self::model_list_apps_response_data_items_attributes::ListAppsResponseDataItemsAttributes; +pub mod model_app_meta; +pub use self::model_app_meta::AppMeta; +pub mod model_list_apps_response_data_items_relationships; +pub use self::model_list_apps_response_data_items_relationships::ListAppsResponseDataItemsRelationships; +pub mod model_deployment_relationship; +pub use self::model_deployment_relationship::DeploymentRelationship; +pub mod model_deployment_relationship_data; +pub use self::model_deployment_relationship_data::DeploymentRelationshipData; +pub mod model_deployment_relationship_data_type; +pub use self::model_deployment_relationship_data_type::DeploymentRelationshipDataType; +pub mod model_deployment_relationship_meta; +pub use self::model_deployment_relationship_meta::DeploymentRelationshipMeta; +pub mod model_list_apps_response_data_items_type; +pub use self::model_list_apps_response_data_items_type::ListAppsResponseDataItemsType; +pub mod model_deployment_included; +pub use self::model_deployment_included::DeploymentIncluded; +pub mod model_deployment_included_attributes; +pub use self::model_deployment_included_attributes::DeploymentIncludedAttributes; +pub mod model_deployment_included_meta; +pub use self::model_deployment_included_meta::DeploymentIncludedMeta; +pub mod model_deployment_included_type; +pub use self::model_deployment_included_type::DeploymentIncludedType; +pub mod model_list_apps_response_meta; +pub use self::model_list_apps_response_meta::ListAppsResponseMeta; +pub mod model_list_apps_response_meta_page; +pub use self::model_list_apps_response_meta_page::ListAppsResponseMetaPage; +pub mod model_create_app_request; +pub use self::model_create_app_request::CreateAppRequest; +pub mod model_create_app_request_data; +pub use self::model_create_app_request_data::CreateAppRequestData; +pub mod model_create_app_request_data_attributes; +pub use self::model_create_app_request_data_attributes::CreateAppRequestDataAttributes; +pub mod model_component_grid; +pub use self::model_component_grid::ComponentGrid; +pub mod model_app_builder_event; +pub use self::model_app_builder_event::AppBuilderEvent; +pub mod model_app_builder_event_name; +pub use self::model_app_builder_event_name::AppBuilderEventName; +pub mod model_app_builder_event_type; +pub use self::model_app_builder_event_type::AppBuilderEventType; +pub mod model_component_grid_properties; +pub use self::model_component_grid_properties::ComponentGridProperties; +pub mod model_component; +pub use self::model_component::Component; +pub mod model_component_properties; +pub use self::model_component_properties::ComponentProperties; +pub mod model_component_properties_is_visible; +pub use self::model_component_properties_is_visible::ComponentPropertiesIsVisible; +pub mod model_component_type; +pub use self::model_component_type::ComponentType; +pub mod model_component_grid_properties_is_visible; +pub use self::model_component_grid_properties_is_visible::ComponentGridPropertiesIsVisible; +pub mod model_component_grid_type; +pub use self::model_component_grid_type::ComponentGridType; +pub mod model_query; +pub use self::model_query::Query; +pub mod model_query_type; +pub use self::model_query_type::QueryType; +pub mod model_input_schema; +pub use self::model_input_schema::InputSchema; +pub mod model_input_schema_data; +pub use self::model_input_schema_data::InputSchemaData; +pub mod model_input_schema_data_attributes; +pub use self::model_input_schema_data_attributes::InputSchemaDataAttributes; +pub mod model_input_schema_data_attributes_parameters_items; +pub use self::model_input_schema_data_attributes_parameters_items::InputSchemaDataAttributesParametersItems; +pub mod model_input_schema_data_attributes_parameters_items_data; +pub use self::model_input_schema_data_attributes_parameters_items_data::InputSchemaDataAttributesParametersItemsData; +pub mod model_input_schema_data_attributes_parameters_items_data_attributes; +pub use self::model_input_schema_data_attributes_parameters_items_data_attributes::InputSchemaDataAttributesParametersItemsDataAttributes; +pub mod model_input_schema_data_type; +pub use self::model_input_schema_data_type::InputSchemaDataType; +pub mod model_script; +pub use self::model_script::Script; +pub mod model_script_data; +pub use self::model_script_data::ScriptData; +pub mod model_script_data_attributes; +pub use self::model_script_data_attributes::ScriptDataAttributes; +pub mod model_script_data_type; +pub use self::model_script_data_type::ScriptDataType; +pub mod model_create_app_request_data_type; +pub use self::model_create_app_request_data_type::CreateAppRequestDataType; +pub mod model_create_app_response; +pub use self::model_create_app_response::CreateAppResponse; +pub mod model_create_app_response_data; +pub use self::model_create_app_response_data::CreateAppResponseData; +pub mod model_create_app_response_data_type; +pub use self::model_create_app_response_data_type::CreateAppResponseDataType; +pub mod model_delete_app_response; +pub use self::model_delete_app_response::DeleteAppResponse; +pub mod model_delete_app_response_data; +pub use self::model_delete_app_response_data::DeleteAppResponseData; +pub mod model_delete_app_response_data_type; +pub use self::model_delete_app_response_data_type::DeleteAppResponseDataType; +pub mod model_get_app_response; +pub use self::model_get_app_response::GetAppResponse; +pub mod model_get_app_response_data; +pub use self::model_get_app_response_data::GetAppResponseData; +pub mod model_get_app_response_data_attributes; +pub use self::model_get_app_response_data_attributes::GetAppResponseDataAttributes; +pub mod model_get_app_response_data_type; +pub use self::model_get_app_response_data_type::GetAppResponseDataType; +pub mod model_get_app_response_relationship; +pub use self::model_get_app_response_relationship::GetAppResponseRelationship; +pub mod model_custom_connection; +pub use self::model_custom_connection::CustomConnection; +pub mod model_custom_connection_attributes; +pub use self::model_custom_connection_attributes::CustomConnectionAttributes; +pub mod model_custom_connection_attributes_on_prem_runner; +pub use self::model_custom_connection_attributes_on_prem_runner::CustomConnectionAttributesOnPremRunner; +pub mod model_custom_connection_type; +pub use self::model_custom_connection_type::CustomConnectionType; +pub mod model_update_app_request; +pub use self::model_update_app_request::UpdateAppRequest; +pub mod model_update_app_request_data; +pub use self::model_update_app_request_data::UpdateAppRequestData; +pub mod model_update_app_request_data_attributes; +pub use self::model_update_app_request_data_attributes::UpdateAppRequestDataAttributes; +pub mod model_update_app_request_data_type; +pub use self::model_update_app_request_data_type::UpdateAppRequestDataType; +pub mod model_update_app_response; +pub use self::model_update_app_response::UpdateAppResponse; +pub mod model_update_app_response_data; +pub use self::model_update_app_response_data::UpdateAppResponseData; +pub mod model_update_app_response_data_attributes; +pub use self::model_update_app_response_data_attributes::UpdateAppResponseDataAttributes; +pub mod model_update_app_response_data_type; +pub use self::model_update_app_response_data_type::UpdateAppResponseDataType; +pub mod model_update_app_response_relationship; +pub use self::model_update_app_response_relationship::UpdateAppResponseRelationship; +pub mod model_disable_app_response; +pub use self::model_disable_app_response::DisableAppResponse; +pub mod model_disable_app_response_data; +pub use self::model_disable_app_response_data::DisableAppResponseData; +pub mod model_disable_app_response_data_attributes; +pub use self::model_disable_app_response_data_attributes::DisableAppResponseDataAttributes; +pub mod model_deployment_meta; +pub use self::model_deployment_meta::DeploymentMeta; +pub mod model_disable_app_response_data_type; +pub use self::model_disable_app_response_data_type::DisableAppResponseDataType; +pub mod model_deploy_app_response; +pub use self::model_deploy_app_response::DeployAppResponse; +pub mod model_deploy_app_response_data; +pub use self::model_deploy_app_response_data::DeployAppResponseData; +pub mod model_deploy_app_response_data_attributes; +pub use self::model_deploy_app_response_data_attributes::DeployAppResponseDataAttributes; +pub mod model_deploy_app_response_data_type; +pub use self::model_deploy_app_response_data_type::DeployAppResponseDataType; pub mod model_application_keys_sort; pub use self::model_application_keys_sort::ApplicationKeysSort; pub mod model_list_application_keys_response; diff --git a/src/datadogV2/model/model_app_builder_error.rs b/src/datadogV2/model/model_app_builder_error.rs new file mode 100644 index 000000000..8b2154205 --- /dev/null +++ b/src/datadogV2/model/model_app_builder_error.rs @@ -0,0 +1,109 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `AppBuilderError` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AppBuilderError { + /// The `AppBuilderError` `errors`. + #[serde(rename = "errors")] + pub errors: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AppBuilderError { + pub fn new() -> AppBuilderError { + AppBuilderError { + errors: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn errors( + mut self, + value: Vec, + ) -> Self { + self.errors = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for AppBuilderError { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for AppBuilderError { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AppBuilderErrorVisitor; + impl<'a> Visitor<'a> for AppBuilderErrorVisitor { + type Value = AppBuilderError; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut errors: Option> = + None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "errors" => { + if v.is_null() { + continue; + } + errors = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = AppBuilderError { + errors, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AppBuilderErrorVisitor) + } +} diff --git a/src/datadogV2/model/model_app_builder_error_errors_items.rs b/src/datadogV2/model/model_app_builder_error_errors_items.rs new file mode 100644 index 000000000..bd9285ad5 --- /dev/null +++ b/src/datadogV2/model/model_app_builder_error_errors_items.rs @@ -0,0 +1,126 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `AppBuilderErrorErrorsItems` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AppBuilderErrorErrorsItems { + /// The `items` `detail`. + #[serde(rename = "detail")] + pub detail: Option, + /// The definition of `AppBuilderErrorErrorsItemsSource` object. + #[serde(rename = "source")] + pub source: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AppBuilderErrorErrorsItems { + pub fn new() -> AppBuilderErrorErrorsItems { + AppBuilderErrorErrorsItems { + detail: None, + source: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn detail(mut self, value: String) -> Self { + self.detail = Some(value); + self + } + + pub fn source( + mut self, + value: crate::datadogV2::model::AppBuilderErrorErrorsItemsSource, + ) -> Self { + self.source = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for AppBuilderErrorErrorsItems { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for AppBuilderErrorErrorsItems { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AppBuilderErrorErrorsItemsVisitor; + impl<'a> Visitor<'a> for AppBuilderErrorErrorsItemsVisitor { + type Value = AppBuilderErrorErrorsItems; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut detail: Option = None; + let mut source: Option = + None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "detail" => { + if v.is_null() { + continue; + } + detail = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "source" => { + if v.is_null() { + continue; + } + source = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = AppBuilderErrorErrorsItems { + detail, + source, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AppBuilderErrorErrorsItemsVisitor) + } +} diff --git a/src/datadogV2/model/model_app_builder_error_errors_items_source.rs b/src/datadogV2/model/model_app_builder_error_errors_items_source.rs new file mode 100644 index 000000000..349e671b2 --- /dev/null +++ b/src/datadogV2/model/model_app_builder_error_errors_items_source.rs @@ -0,0 +1,122 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `AppBuilderErrorErrorsItemsSource` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AppBuilderErrorErrorsItemsSource { + /// The `source` `parameter`. + #[serde(rename = "parameter")] + pub parameter: Option, + /// The `source` `pointer`. + #[serde(rename = "pointer")] + pub pointer: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AppBuilderErrorErrorsItemsSource { + pub fn new() -> AppBuilderErrorErrorsItemsSource { + AppBuilderErrorErrorsItemsSource { + parameter: None, + pointer: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn parameter(mut self, value: String) -> Self { + self.parameter = Some(value); + self + } + + pub fn pointer(mut self, value: String) -> Self { + self.pointer = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for AppBuilderErrorErrorsItemsSource { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for AppBuilderErrorErrorsItemsSource { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AppBuilderErrorErrorsItemsSourceVisitor; + impl<'a> Visitor<'a> for AppBuilderErrorErrorsItemsSourceVisitor { + type Value = AppBuilderErrorErrorsItemsSource; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut parameter: Option = None; + let mut pointer: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "parameter" => { + if v.is_null() { + continue; + } + parameter = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "pointer" => { + if v.is_null() { + continue; + } + pointer = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = AppBuilderErrorErrorsItemsSource { + parameter, + pointer, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AppBuilderErrorErrorsItemsSourceVisitor) + } +} diff --git a/src/datadogV2/model/model_app_builder_event.rs b/src/datadogV2/model/model_app_builder_event.rs new file mode 100644 index 000000000..8762b3324 --- /dev/null +++ b/src/datadogV2/model/model_app_builder_event.rs @@ -0,0 +1,138 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `AppBuilderEvent` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AppBuilderEvent { + /// The triggering action for the event. + #[serde(rename = "name")] + pub name: Option, + /// The response to the event. + #[serde(rename = "type")] + pub type_: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AppBuilderEvent { + pub fn new() -> AppBuilderEvent { + AppBuilderEvent { + name: None, + type_: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn name(mut self, value: crate::datadogV2::model::AppBuilderEventName) -> Self { + self.name = Some(value); + self + } + + pub fn type_(mut self, value: crate::datadogV2::model::AppBuilderEventType) -> Self { + self.type_ = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for AppBuilderEvent { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for AppBuilderEvent { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AppBuilderEventVisitor; + impl<'a> Visitor<'a> for AppBuilderEventVisitor { + type Value = AppBuilderEvent; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut name: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _name) = name { + match _name { + crate::datadogV2::model::AppBuilderEventName::UnparsedObject(_name) => { + _unparsed = true; + }, + _ => {} + } + } + } + "type" => { + if v.is_null() { + continue; + } + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::AppBuilderEventType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = AppBuilderEvent { + name, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AppBuilderEventVisitor) + } +} diff --git a/src/datadogV2/model/model_app_builder_event_name.rs b/src/datadogV2/model/model_app_builder_event_name.rs new file mode 100644 index 000000000..88daca544 --- /dev/null +++ b/src/datadogV2/model/model_app_builder_event_name.rs @@ -0,0 +1,75 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum AppBuilderEventName { + PAGECHANGE, + TABLEROWCLICK, + TABLEROWBUTTONCLICK, + CHANGE, + SUBMIT, + CLICK, + TOGGLEOPEN, + CLOSE, + OPEN, + EXECUTIONFINISHED, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for AppBuilderEventName { + fn to_string(&self) -> String { + match self { + Self::PAGECHANGE => String::from("pageChange"), + Self::TABLEROWCLICK => String::from("tableRowClick"), + Self::TABLEROWBUTTONCLICK => String::from("_tableRowButtonClick"), + Self::CHANGE => String::from("change"), + Self::SUBMIT => String::from("submit"), + Self::CLICK => String::from("click"), + Self::TOGGLEOPEN => String::from("toggleOpen"), + Self::CLOSE => String::from("close"), + Self::OPEN => String::from("open"), + Self::EXECUTIONFINISHED => String::from("executionFinished"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for AppBuilderEventName { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for AppBuilderEventName { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "pageChange" => Self::PAGECHANGE, + "tableRowClick" => Self::TABLEROWCLICK, + "_tableRowButtonClick" => Self::TABLEROWBUTTONCLICK, + "change" => Self::CHANGE, + "submit" => Self::SUBMIT, + "click" => Self::CLICK, + "toggleOpen" => Self::TOGGLEOPEN, + "close" => Self::CLOSE, + "open" => Self::OPEN, + "executionFinished" => Self::EXECUTIONFINISHED, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_app_builder_event_type.rs b/src/datadogV2/model/model_app_builder_event_type.rs new file mode 100644 index 000000000..91c817a54 --- /dev/null +++ b/src/datadogV2/model/model_app_builder_event_type.rs @@ -0,0 +1,69 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum AppBuilderEventType { + CUSTOM, + SETCOMPONENTSTATE, + TRIGGERQUERY, + OPENMODAL, + CLOSEMODAL, + OPENURL, + DOWNLOADFILE, + SETSTATEVARIABLEVALUE, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for AppBuilderEventType { + fn to_string(&self) -> String { + match self { + Self::CUSTOM => String::from("custom"), + Self::SETCOMPONENTSTATE => String::from("setComponentState"), + Self::TRIGGERQUERY => String::from("triggerQuery"), + Self::OPENMODAL => String::from("openModal"), + Self::CLOSEMODAL => String::from("closeModal"), + Self::OPENURL => String::from("openUrl"), + Self::DOWNLOADFILE => String::from("downloadFile"), + Self::SETSTATEVARIABLEVALUE => String::from("setStateVariableValue"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for AppBuilderEventType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for AppBuilderEventType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "custom" => Self::CUSTOM, + "setComponentState" => Self::SETCOMPONENTSTATE, + "triggerQuery" => Self::TRIGGERQUERY, + "openModal" => Self::OPENMODAL, + "closeModal" => Self::CLOSEMODAL, + "openUrl" => Self::OPENURL, + "downloadFile" => Self::DOWNLOADFILE, + "setStateVariableValue" => Self::SETSTATEVARIABLEVALUE, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_app_meta.rs b/src/datadogV2/model/model_app_meta.rs new file mode 100644 index 000000000..8a64153c1 --- /dev/null +++ b/src/datadogV2/model/model_app_meta.rs @@ -0,0 +1,260 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `AppMeta` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AppMeta { + /// The `AppMeta` `created_at`. + #[serde(rename = "created_at")] + pub created_at: Option, + /// The `AppMeta` `deleted_at`. + #[serde(rename = "deleted_at")] + pub deleted_at: Option, + /// The `AppMeta` `org_id`. + #[serde(rename = "org_id")] + pub org_id: Option, + /// The `AppMeta` `run_as_user`. + #[serde(rename = "run_as_user")] + pub run_as_user: Option, + /// The `AppMeta` `updated_at`. + #[serde(rename = "updated_at")] + pub updated_at: Option, + /// The `AppMeta` `updated_since_deployment`. + #[serde(rename = "updated_since_deployment")] + pub updated_since_deployment: Option, + /// The `AppMeta` `user_id`. + #[serde(rename = "user_id")] + pub user_id: Option, + /// The `AppMeta` `user_name`. + #[serde(rename = "user_name")] + pub user_name: Option, + /// The `AppMeta` `user_uuid`. + #[serde(rename = "user_uuid")] + pub user_uuid: Option, + /// The `AppMeta` `version`. + #[serde(rename = "version")] + pub version: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AppMeta { + pub fn new() -> AppMeta { + AppMeta { + created_at: None, + deleted_at: None, + org_id: None, + run_as_user: None, + updated_at: None, + updated_since_deployment: None, + user_id: None, + user_name: None, + user_uuid: None, + version: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn created_at(mut self, value: String) -> Self { + self.created_at = Some(value); + self + } + + pub fn deleted_at(mut self, value: String) -> Self { + self.deleted_at = Some(value); + self + } + + pub fn org_id(mut self, value: i64) -> Self { + self.org_id = Some(value); + self + } + + pub fn run_as_user(mut self, value: String) -> Self { + self.run_as_user = Some(value); + self + } + + pub fn updated_at(mut self, value: String) -> Self { + self.updated_at = Some(value); + self + } + + pub fn updated_since_deployment(mut self, value: bool) -> Self { + self.updated_since_deployment = Some(value); + self + } + + pub fn user_id(mut self, value: i64) -> Self { + self.user_id = Some(value); + self + } + + pub fn user_name(mut self, value: String) -> Self { + self.user_name = Some(value); + self + } + + pub fn user_uuid(mut self, value: String) -> Self { + self.user_uuid = Some(value); + self + } + + pub fn version(mut self, value: i64) -> Self { + self.version = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for AppMeta { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for AppMeta { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AppMetaVisitor; + impl<'a> Visitor<'a> for AppMetaVisitor { + type Value = AppMeta; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut created_at: Option = None; + let mut deleted_at: Option = None; + let mut org_id: Option = None; + let mut run_as_user: Option = None; + let mut updated_at: Option = None; + let mut updated_since_deployment: Option = None; + let mut user_id: Option = None; + let mut user_name: Option = None; + let mut user_uuid: Option = None; + let mut version: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "created_at" => { + if v.is_null() { + continue; + } + created_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "deleted_at" => { + if v.is_null() { + continue; + } + deleted_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "org_id" => { + if v.is_null() { + continue; + } + org_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "run_as_user" => { + if v.is_null() { + continue; + } + run_as_user = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "updated_at" => { + if v.is_null() { + continue; + } + updated_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "updated_since_deployment" => { + if v.is_null() { + continue; + } + updated_since_deployment = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "user_id" => { + if v.is_null() { + continue; + } + user_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "user_name" => { + if v.is_null() { + continue; + } + user_name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "user_uuid" => { + if v.is_null() { + continue; + } + user_uuid = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "version" => { + if v.is_null() { + continue; + } + version = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = AppMeta { + created_at, + deleted_at, + org_id, + run_as_user, + updated_at, + updated_since_deployment, + user_id, + user_name, + user_uuid, + version, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AppMetaVisitor) + } +} diff --git a/src/datadogV2/model/model_apps_sort_field.rs b/src/datadogV2/model/model_apps_sort_field.rs new file mode 100644 index 000000000..11b0f0a15 --- /dev/null +++ b/src/datadogV2/model/model_apps_sort_field.rs @@ -0,0 +1,69 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum AppsSortField { + NAME, + CREATED_AT, + UPDATED_AT, + USER_NAME, + NAME_DESC, + CREATED_AT_DESC, + UPDATED_AT_DESC, + USER_NAME_DESC, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for AppsSortField { + fn to_string(&self) -> String { + match self { + Self::NAME => String::from("name"), + Self::CREATED_AT => String::from("created_at"), + Self::UPDATED_AT => String::from("updated_at"), + Self::USER_NAME => String::from("user_name"), + Self::NAME_DESC => String::from("-name"), + Self::CREATED_AT_DESC => String::from("-created_at"), + Self::UPDATED_AT_DESC => String::from("-updated_at"), + Self::USER_NAME_DESC => String::from("-user_name"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for AppsSortField { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for AppsSortField { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "name" => Self::NAME, + "created_at" => Self::CREATED_AT, + "updated_at" => Self::UPDATED_AT, + "user_name" => Self::USER_NAME, + "-name" => Self::NAME_DESC, + "-created_at" => Self::CREATED_AT_DESC, + "-updated_at" => Self::UPDATED_AT_DESC, + "-user_name" => Self::USER_NAME_DESC, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_component.rs b/src/datadogV2/model/model_component.rs new file mode 100644 index 000000000..67731fcf0 --- /dev/null +++ b/src/datadogV2/model/model_component.rs @@ -0,0 +1,157 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `Component` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct Component { + /// The `Component` `events`. + #[serde(rename = "events")] + pub events: Option>, + /// The `Component` `id`. + #[serde(rename = "id", default, with = "::serde_with::rust::double_option")] + pub id: Option>, + /// The `Component` `name`. + #[serde(rename = "name")] + pub name: String, + /// The definition of `ComponentProperties` object. + #[serde(rename = "properties")] + pub properties: crate::datadogV2::model::ComponentProperties, + /// The definition of `ComponentType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::ComponentType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl Component { + pub fn new( + name: String, + properties: crate::datadogV2::model::ComponentProperties, + type_: crate::datadogV2::model::ComponentType, + ) -> Component { + Component { + events: None, + id: None, + name, + properties, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn events(mut self, value: Vec) -> Self { + self.events = Some(value); + self + } + + pub fn id(mut self, value: Option) -> Self { + self.id = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for Component { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ComponentVisitor; + impl<'a> Visitor<'a> for ComponentVisitor { + type Value = Component; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut events: Option> = None; + let mut id: Option> = None; + let mut name: Option = None; + let mut properties: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "events" => { + if v.is_null() { + continue; + } + events = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "properties" => { + properties = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::ComponentType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let name = name.ok_or_else(|| M::Error::missing_field("name"))?; + let properties = properties.ok_or_else(|| M::Error::missing_field("properties"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = Component { + events, + id, + name, + properties, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ComponentVisitor) + } +} diff --git a/src/datadogV2/model/model_component_grid.rs b/src/datadogV2/model/model_component_grid.rs new file mode 100644 index 000000000..d06c4a3fc --- /dev/null +++ b/src/datadogV2/model/model_component_grid.rs @@ -0,0 +1,160 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `ComponentGrid` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ComponentGrid { + /// The `ComponentGrid` `events`. + #[serde(rename = "events")] + pub events: Option>, + /// The `ComponentGrid` `id`. + #[serde(rename = "id")] + pub id: Option, + /// The `ComponentGrid` `name`. + #[serde(rename = "name")] + pub name: String, + /// The definition of `ComponentGridProperties` object. + #[serde(rename = "properties")] + pub properties: crate::datadogV2::model::ComponentGridProperties, + /// The definition of `ComponentGridType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::ComponentGridType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ComponentGrid { + pub fn new( + name: String, + properties: crate::datadogV2::model::ComponentGridProperties, + type_: crate::datadogV2::model::ComponentGridType, + ) -> ComponentGrid { + ComponentGrid { + events: None, + id: None, + name, + properties, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn events(mut self, value: Vec) -> Self { + self.events = Some(value); + self + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for ComponentGrid { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ComponentGridVisitor; + impl<'a> Visitor<'a> for ComponentGridVisitor { + type Value = ComponentGrid; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut events: Option> = None; + let mut id: Option = None; + let mut name: Option = None; + let mut properties: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "events" => { + if v.is_null() { + continue; + } + events = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "properties" => { + properties = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::ComponentGridType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let name = name.ok_or_else(|| M::Error::missing_field("name"))?; + let properties = properties.ok_or_else(|| M::Error::missing_field("properties"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = ComponentGrid { + events, + id, + name, + properties, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ComponentGridVisitor) + } +} diff --git a/src/datadogV2/model/model_component_grid_properties.rs b/src/datadogV2/model/model_component_grid_properties.rs new file mode 100644 index 000000000..205671655 --- /dev/null +++ b/src/datadogV2/model/model_component_grid_properties.rs @@ -0,0 +1,153 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `ComponentGridProperties` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ComponentGridProperties { + /// The `ComponentGridProperties` `backgroundColor`. + #[serde(rename = "backgroundColor")] + pub background_color: Option, + /// The `ComponentGridProperties` `children`. + #[serde(rename = "children")] + pub children: Option>, + /// The definition of `ComponentGridPropertiesIsVisible` object. + #[serde(rename = "isVisible")] + pub is_visible: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ComponentGridProperties { + pub fn new() -> ComponentGridProperties { + ComponentGridProperties { + background_color: None, + children: None, + is_visible: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn background_color(mut self, value: String) -> Self { + self.background_color = Some(value); + self + } + + pub fn children(mut self, value: Vec) -> Self { + self.children = Some(value); + self + } + + pub fn is_visible( + mut self, + value: crate::datadogV2::model::ComponentGridPropertiesIsVisible, + ) -> Self { + self.is_visible = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for ComponentGridProperties { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for ComponentGridProperties { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ComponentGridPropertiesVisitor; + impl<'a> Visitor<'a> for ComponentGridPropertiesVisitor { + type Value = ComponentGridProperties; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut background_color: Option = None; + let mut children: Option> = None; + let mut is_visible: Option< + crate::datadogV2::model::ComponentGridPropertiesIsVisible, + > = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "backgroundColor" => { + if v.is_null() { + continue; + } + background_color = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "children" => { + if v.is_null() { + continue; + } + children = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "isVisible" => { + if v.is_null() { + continue; + } + is_visible = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _is_visible) = is_visible { + match _is_visible { + crate::datadogV2::model::ComponentGridPropertiesIsVisible::UnparsedObject(_is_visible) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = ComponentGridProperties { + background_color, + children, + is_visible, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ComponentGridPropertiesVisitor) + } +} diff --git a/src/datadogV2/model/model_component_grid_properties_is_visible.rs b/src/datadogV2/model/model_component_grid_properties_is_visible.rs new file mode 100644 index 000000000..fa6e0598e --- /dev/null +++ b/src/datadogV2/model/model_component_grid_properties_is_visible.rs @@ -0,0 +1,33 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of `ComponentGridPropertiesIsVisible` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum ComponentGridPropertiesIsVisible { + String(String), + Bool(bool), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for ComponentGridPropertiesIsVisible { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::(value.clone()) { + return Ok(ComponentGridPropertiesIsVisible::String(_v)); + } + if let Ok(_v) = serde_json::from_value::(value.clone()) { + return Ok(ComponentGridPropertiesIsVisible::Bool(_v)); + } + + return Ok(ComponentGridPropertiesIsVisible::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_component_grid_type.rs b/src/datadogV2/model/model_component_grid_type.rs new file mode 100644 index 000000000..59641f31e --- /dev/null +++ b/src/datadogV2/model/model_component_grid_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum ComponentGridType { + GRID, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for ComponentGridType { + fn to_string(&self) -> String { + match self { + Self::GRID => String::from("grid"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for ComponentGridType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for ComponentGridType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "grid" => Self::GRID, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_component_properties.rs b/src/datadogV2/model/model_component_properties.rs new file mode 100644 index 000000000..7813dffed --- /dev/null +++ b/src/datadogV2/model/model_component_properties.rs @@ -0,0 +1,134 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `ComponentProperties` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ComponentProperties { + /// The `ComponentProperties` `children`. + #[serde(rename = "children")] + pub children: Option>, + /// The definition of `ComponentPropertiesIsVisible` object. + #[serde(rename = "isVisible")] + pub is_visible: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ComponentProperties { + pub fn new() -> ComponentProperties { + ComponentProperties { + children: None, + is_visible: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn children(mut self, value: Vec) -> Self { + self.children = Some(value); + self + } + + pub fn is_visible( + mut self, + value: crate::datadogV2::model::ComponentPropertiesIsVisible, + ) -> Self { + self.is_visible = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for ComponentProperties { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for ComponentProperties { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ComponentPropertiesVisitor; + impl<'a> Visitor<'a> for ComponentPropertiesVisitor { + type Value = ComponentProperties; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut children: Option> = None; + let mut is_visible: Option = + None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "children" => { + if v.is_null() { + continue; + } + children = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "isVisible" => { + if v.is_null() { + continue; + } + is_visible = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _is_visible) = is_visible { + match _is_visible { + crate::datadogV2::model::ComponentPropertiesIsVisible::UnparsedObject(_is_visible) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = ComponentProperties { + children, + is_visible, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ComponentPropertiesVisitor) + } +} diff --git a/src/datadogV2/model/model_component_properties_is_visible.rs b/src/datadogV2/model/model_component_properties_is_visible.rs new file mode 100644 index 000000000..b41d7b227 --- /dev/null +++ b/src/datadogV2/model/model_component_properties_is_visible.rs @@ -0,0 +1,33 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of `ComponentPropertiesIsVisible` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum ComponentPropertiesIsVisible { + Bool(bool), + String(String), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for ComponentPropertiesIsVisible { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::(value.clone()) { + return Ok(ComponentPropertiesIsVisible::Bool(_v)); + } + if let Ok(_v) = serde_json::from_value::(value.clone()) { + return Ok(ComponentPropertiesIsVisible::String(_v)); + } + + return Ok(ComponentPropertiesIsVisible::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_component_type.rs b/src/datadogV2/model/model_component_type.rs new file mode 100644 index 000000000..7d8c554c0 --- /dev/null +++ b/src/datadogV2/model/model_component_type.rs @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum ComponentType { + TABLE, + TEXTINPUT, + TEXTAREA, + BUTTON, + TEXT, + SELECT, + MODAL, + SCHEMAFORM, + CHECKBOX, + TABS, + VEGACHART, + RADIOBUTTONS, + NUMBERINPUT, + FILEINPUT, + JSONINPUT, + GRIDCELL, + DATERANGEPICKER, + SEARCH, + CONTAINER, + CALLOUTVALUE, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for ComponentType { + fn to_string(&self) -> String { + match self { + Self::TABLE => String::from("table"), + Self::TEXTINPUT => String::from("textInput"), + Self::TEXTAREA => String::from("textArea"), + Self::BUTTON => String::from("button"), + Self::TEXT => String::from("text"), + Self::SELECT => String::from("select"), + Self::MODAL => String::from("modal"), + Self::SCHEMAFORM => String::from("schemaForm"), + Self::CHECKBOX => String::from("checkbox"), + Self::TABS => String::from("tabs"), + Self::VEGACHART => String::from("vegaChart"), + Self::RADIOBUTTONS => String::from("radioButtons"), + Self::NUMBERINPUT => String::from("numberInput"), + Self::FILEINPUT => String::from("fileInput"), + Self::JSONINPUT => String::from("jsonInput"), + Self::GRIDCELL => String::from("gridCell"), + Self::DATERANGEPICKER => String::from("dateRangePicker"), + Self::SEARCH => String::from("search"), + Self::CONTAINER => String::from("container"), + Self::CALLOUTVALUE => String::from("calloutValue"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for ComponentType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for ComponentType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "table" => Self::TABLE, + "textInput" => Self::TEXTINPUT, + "textArea" => Self::TEXTAREA, + "button" => Self::BUTTON, + "text" => Self::TEXT, + "select" => Self::SELECT, + "modal" => Self::MODAL, + "schemaForm" => Self::SCHEMAFORM, + "checkbox" => Self::CHECKBOX, + "tabs" => Self::TABS, + "vegaChart" => Self::VEGACHART, + "radioButtons" => Self::RADIOBUTTONS, + "numberInput" => Self::NUMBERINPUT, + "fileInput" => Self::FILEINPUT, + "jsonInput" => Self::JSONINPUT, + "gridCell" => Self::GRIDCELL, + "dateRangePicker" => Self::DATERANGEPICKER, + "search" => Self::SEARCH, + "container" => Self::CONTAINER, + "calloutValue" => Self::CALLOUTVALUE, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_create_app_request.rs b/src/datadogV2/model/model_create_app_request.rs new file mode 100644 index 000000000..a7d69ddbe --- /dev/null +++ b/src/datadogV2/model/model_create_app_request.rs @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `CreateAppRequest` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct CreateAppRequest { + /// The definition of `CreateAppRequestData` object. + #[serde(rename = "data")] + pub data: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl CreateAppRequest { + pub fn new() -> CreateAppRequest { + CreateAppRequest { + data: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: crate::datadogV2::model::CreateAppRequestData) -> Self { + self.data = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for CreateAppRequest { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for CreateAppRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct CreateAppRequestVisitor; + impl<'a> Visitor<'a> for CreateAppRequestVisitor { + type Value = CreateAppRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = CreateAppRequest { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(CreateAppRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_create_app_request_data.rs b/src/datadogV2/model/model_create_app_request_data.rs new file mode 100644 index 000000000..0573de1e6 --- /dev/null +++ b/src/datadogV2/model/model_create_app_request_data.rs @@ -0,0 +1,122 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `CreateAppRequestData` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct CreateAppRequestData { + /// The definition of `CreateAppRequestDataAttributes` object. + #[serde(rename = "attributes")] + pub attributes: Option, + /// The definition of `CreateAppRequestDataType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::CreateAppRequestDataType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl CreateAppRequestData { + pub fn new(type_: crate::datadogV2::model::CreateAppRequestDataType) -> CreateAppRequestData { + CreateAppRequestData { + attributes: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes( + mut self, + value: crate::datadogV2::model::CreateAppRequestDataAttributes, + ) -> Self { + self.attributes = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for CreateAppRequestData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct CreateAppRequestDataVisitor; + impl<'a> Visitor<'a> for CreateAppRequestDataVisitor { + type Value = CreateAppRequestData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::CreateAppRequestDataAttributes, + > = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + if v.is_null() { + continue; + } + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::CreateAppRequestDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = CreateAppRequestData { + attributes, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(CreateAppRequestDataVisitor) + } +} diff --git a/src/datadogV2/model/model_create_app_request_data_attributes.rs b/src/datadogV2/model/model_create_app_request_data_attributes.rs new file mode 100644 index 000000000..9d50c24ed --- /dev/null +++ b/src/datadogV2/model/model_create_app_request_data_attributes.rs @@ -0,0 +1,228 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `CreateAppRequestDataAttributes` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct CreateAppRequestDataAttributes { + /// The `attributes` `components`. + #[serde(rename = "components")] + pub components: Option>, + /// The `attributes` `description`. + #[serde(rename = "description")] + pub description: Option, + /// The `attributes` `embeddedQueries`. + #[serde(rename = "embeddedQueries")] + pub embedded_queries: Option>, + /// The definition of `InputSchema` object. + #[serde(rename = "inputSchema")] + pub input_schema: Option, + /// The `attributes` `name`. + #[serde(rename = "name")] + pub name: Option, + /// The `attributes` `rootInstanceName`. + #[serde(rename = "rootInstanceName")] + pub root_instance_name: Option, + /// The `attributes` `scripts`. + #[serde(rename = "scripts")] + pub scripts: Option>, + /// The `attributes` `tags`. + #[serde(rename = "tags")] + pub tags: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl CreateAppRequestDataAttributes { + pub fn new() -> CreateAppRequestDataAttributes { + CreateAppRequestDataAttributes { + components: None, + description: None, + embedded_queries: None, + input_schema: None, + name: None, + root_instance_name: None, + scripts: None, + tags: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn components(mut self, value: Vec) -> Self { + self.components = Some(value); + self + } + + pub fn description(mut self, value: String) -> Self { + self.description = Some(value); + self + } + + pub fn embedded_queries(mut self, value: Vec) -> Self { + self.embedded_queries = Some(value); + self + } + + pub fn input_schema(mut self, value: crate::datadogV2::model::InputSchema) -> Self { + self.input_schema = Some(value); + self + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn root_instance_name(mut self, value: String) -> Self { + self.root_instance_name = Some(value); + self + } + + pub fn scripts(mut self, value: Vec) -> Self { + self.scripts = Some(value); + self + } + + pub fn tags(mut self, value: Vec) -> Self { + self.tags = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for CreateAppRequestDataAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for CreateAppRequestDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct CreateAppRequestDataAttributesVisitor; + impl<'a> Visitor<'a> for CreateAppRequestDataAttributesVisitor { + type Value = CreateAppRequestDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut components: Option> = None; + let mut description: Option = None; + let mut embedded_queries: Option> = None; + let mut input_schema: Option = None; + let mut name: Option = None; + let mut root_instance_name: Option = None; + let mut scripts: Option> = None; + let mut tags: Option> = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "components" => { + if v.is_null() { + continue; + } + components = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "description" => { + if v.is_null() { + continue; + } + description = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "embeddedQueries" => { + if v.is_null() { + continue; + } + embedded_queries = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "inputSchema" => { + if v.is_null() { + continue; + } + input_schema = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "rootInstanceName" => { + if v.is_null() { + continue; + } + root_instance_name = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "scripts" => { + if v.is_null() { + continue; + } + scripts = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "tags" => { + if v.is_null() { + continue; + } + tags = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = CreateAppRequestDataAttributes { + components, + description, + embedded_queries, + input_schema, + name, + root_instance_name, + scripts, + tags, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(CreateAppRequestDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_create_app_request_data_type.rs b/src/datadogV2/model/model_create_app_request_data_type.rs new file mode 100644 index 000000000..b2c40b965 --- /dev/null +++ b/src/datadogV2/model/model_create_app_request_data_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum CreateAppRequestDataType { + APPDEFINITIONS, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for CreateAppRequestDataType { + fn to_string(&self) -> String { + match self { + Self::APPDEFINITIONS => String::from("appDefinitions"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for CreateAppRequestDataType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for CreateAppRequestDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "appDefinitions" => Self::APPDEFINITIONS, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_create_app_response.rs b/src/datadogV2/model/model_create_app_response.rs new file mode 100644 index 000000000..47a75ea42 --- /dev/null +++ b/src/datadogV2/model/model_create_app_response.rs @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `CreateAppResponse` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct CreateAppResponse { + /// The definition of `CreateAppResponseData` object. + #[serde(rename = "data")] + pub data: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl CreateAppResponse { + pub fn new() -> CreateAppResponse { + CreateAppResponse { + data: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: crate::datadogV2::model::CreateAppResponseData) -> Self { + self.data = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for CreateAppResponse { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for CreateAppResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct CreateAppResponseVisitor; + impl<'a> Visitor<'a> for CreateAppResponseVisitor { + type Value = CreateAppResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = CreateAppResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(CreateAppResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_create_app_response_data.rs b/src/datadogV2/model/model_create_app_response_data.rs new file mode 100644 index 000000000..34f5847d7 --- /dev/null +++ b/src/datadogV2/model/model_create_app_response_data.rs @@ -0,0 +1,113 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `CreateAppResponseData` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct CreateAppResponseData { + /// The `data` `id`. + #[serde(rename = "id")] + pub id: String, + /// The definition of `CreateAppResponseDataType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::CreateAppResponseDataType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl CreateAppResponseData { + pub fn new( + id: String, + type_: crate::datadogV2::model::CreateAppResponseDataType, + ) -> CreateAppResponseData { + CreateAppResponseData { + id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for CreateAppResponseData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct CreateAppResponseDataVisitor; + impl<'a> Visitor<'a> for CreateAppResponseDataVisitor { + type Value = CreateAppResponseData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::CreateAppResponseDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = CreateAppResponseData { + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(CreateAppResponseDataVisitor) + } +} diff --git a/src/datadogV2/model/model_create_app_response_data_type.rs b/src/datadogV2/model/model_create_app_response_data_type.rs new file mode 100644 index 000000000..25781c3b9 --- /dev/null +++ b/src/datadogV2/model/model_create_app_response_data_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum CreateAppResponseDataType { + APPDEFINITIONS, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for CreateAppResponseDataType { + fn to_string(&self) -> String { + match self { + Self::APPDEFINITIONS => String::from("appDefinitions"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for CreateAppResponseDataType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for CreateAppResponseDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "appDefinitions" => Self::APPDEFINITIONS, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_custom_connection.rs b/src/datadogV2/model/model_custom_connection.rs new file mode 100644 index 000000000..5d64d7ed1 --- /dev/null +++ b/src/datadogV2/model/model_custom_connection.rs @@ -0,0 +1,151 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `CustomConnection` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct CustomConnection { + /// The definition of `CustomConnectionAttributes` object. + #[serde(rename = "attributes")] + pub attributes: Option, + /// The `CustomConnection` `id`. + #[serde(rename = "id")] + pub id: Option, + /// The definition of `CustomConnectionType` object. + #[serde(rename = "type")] + pub type_: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl CustomConnection { + pub fn new() -> CustomConnection { + CustomConnection { + attributes: None, + id: None, + type_: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes( + mut self, + value: crate::datadogV2::model::CustomConnectionAttributes, + ) -> Self { + self.attributes = Some(value); + self + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn type_(mut self, value: crate::datadogV2::model::CustomConnectionType) -> Self { + self.type_ = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for CustomConnection { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for CustomConnection { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct CustomConnectionVisitor; + impl<'a> Visitor<'a> for CustomConnectionVisitor { + type Value = CustomConnection; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option = + None; + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + if v.is_null() { + continue; + } + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + if v.is_null() { + continue; + } + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::CustomConnectionType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = CustomConnection { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(CustomConnectionVisitor) + } +} diff --git a/src/datadogV2/model/model_custom_connection_attributes.rs b/src/datadogV2/model/model_custom_connection_attributes.rs new file mode 100644 index 000000000..1cb64459b --- /dev/null +++ b/src/datadogV2/model/model_custom_connection_attributes.rs @@ -0,0 +1,128 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `CustomConnectionAttributes` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct CustomConnectionAttributes { + /// The `attributes` `name`. + #[serde(rename = "name")] + pub name: Option, + /// The definition of `CustomConnectionAttributesOnPremRunner` object. + #[serde(rename = "onPremRunner")] + pub on_prem_runner: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl CustomConnectionAttributes { + pub fn new() -> CustomConnectionAttributes { + CustomConnectionAttributes { + name: None, + on_prem_runner: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn on_prem_runner( + mut self, + value: crate::datadogV2::model::CustomConnectionAttributesOnPremRunner, + ) -> Self { + self.on_prem_runner = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for CustomConnectionAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for CustomConnectionAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct CustomConnectionAttributesVisitor; + impl<'a> Visitor<'a> for CustomConnectionAttributesVisitor { + type Value = CustomConnectionAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut name: Option = None; + let mut on_prem_runner: Option< + crate::datadogV2::model::CustomConnectionAttributesOnPremRunner, + > = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "onPremRunner" => { + if v.is_null() { + continue; + } + on_prem_runner = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = CustomConnectionAttributes { + name, + on_prem_runner, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(CustomConnectionAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_custom_connection_attributes_on_prem_runner.rs b/src/datadogV2/model/model_custom_connection_attributes_on_prem_runner.rs new file mode 100644 index 000000000..5521b174a --- /dev/null +++ b/src/datadogV2/model/model_custom_connection_attributes_on_prem_runner.rs @@ -0,0 +1,122 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `CustomConnectionAttributesOnPremRunner` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct CustomConnectionAttributesOnPremRunner { + /// The `onPremRunner` `id`. + #[serde(rename = "id")] + pub id: Option, + /// The `onPremRunner` `url`. + #[serde(rename = "url")] + pub url: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl CustomConnectionAttributesOnPremRunner { + pub fn new() -> CustomConnectionAttributesOnPremRunner { + CustomConnectionAttributesOnPremRunner { + id: None, + url: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn url(mut self, value: String) -> Self { + self.url = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for CustomConnectionAttributesOnPremRunner { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for CustomConnectionAttributesOnPremRunner { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct CustomConnectionAttributesOnPremRunnerVisitor; + impl<'a> Visitor<'a> for CustomConnectionAttributesOnPremRunnerVisitor { + type Value = CustomConnectionAttributesOnPremRunner; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut id: Option = None; + let mut url: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "url" => { + if v.is_null() { + continue; + } + url = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = CustomConnectionAttributesOnPremRunner { + id, + url, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(CustomConnectionAttributesOnPremRunnerVisitor) + } +} diff --git a/src/datadogV2/model/model_custom_connection_type.rs b/src/datadogV2/model/model_custom_connection_type.rs new file mode 100644 index 000000000..f344d7f31 --- /dev/null +++ b/src/datadogV2/model/model_custom_connection_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum CustomConnectionType { + CUSTOM_CONNECTIONS, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for CustomConnectionType { + fn to_string(&self) -> String { + match self { + Self::CUSTOM_CONNECTIONS => String::from("custom_connections"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for CustomConnectionType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for CustomConnectionType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "custom_connections" => Self::CUSTOM_CONNECTIONS, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_delete_app_response.rs b/src/datadogV2/model/model_delete_app_response.rs new file mode 100644 index 000000000..b98e07724 --- /dev/null +++ b/src/datadogV2/model/model_delete_app_response.rs @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DeleteAppResponse` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DeleteAppResponse { + /// The definition of `DeleteAppResponseData` object. + #[serde(rename = "data")] + pub data: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DeleteAppResponse { + pub fn new() -> DeleteAppResponse { + DeleteAppResponse { + data: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: crate::datadogV2::model::DeleteAppResponseData) -> Self { + self.data = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for DeleteAppResponse { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for DeleteAppResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DeleteAppResponseVisitor; + impl<'a> Visitor<'a> for DeleteAppResponseVisitor { + type Value = DeleteAppResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = DeleteAppResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DeleteAppResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_delete_app_response_data.rs b/src/datadogV2/model/model_delete_app_response_data.rs new file mode 100644 index 000000000..100eb7a93 --- /dev/null +++ b/src/datadogV2/model/model_delete_app_response_data.rs @@ -0,0 +1,113 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DeleteAppResponseData` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DeleteAppResponseData { + /// The `data` `id`. + #[serde(rename = "id")] + pub id: String, + /// The definition of `DeleteAppResponseDataType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::DeleteAppResponseDataType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DeleteAppResponseData { + pub fn new( + id: String, + type_: crate::datadogV2::model::DeleteAppResponseDataType, + ) -> DeleteAppResponseData { + DeleteAppResponseData { + id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for DeleteAppResponseData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DeleteAppResponseDataVisitor; + impl<'a> Visitor<'a> for DeleteAppResponseDataVisitor { + type Value = DeleteAppResponseData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::DeleteAppResponseDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = DeleteAppResponseData { + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DeleteAppResponseDataVisitor) + } +} diff --git a/src/datadogV2/model/model_delete_app_response_data_type.rs b/src/datadogV2/model/model_delete_app_response_data_type.rs new file mode 100644 index 000000000..fd3cff12d --- /dev/null +++ b/src/datadogV2/model/model_delete_app_response_data_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum DeleteAppResponseDataType { + APPDEFINITIONS, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for DeleteAppResponseDataType { + fn to_string(&self) -> String { + match self { + Self::APPDEFINITIONS => String::from("appDefinitions"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for DeleteAppResponseDataType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for DeleteAppResponseDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "appDefinitions" => Self::APPDEFINITIONS, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_delete_apps_request.rs b/src/datadogV2/model/model_delete_apps_request.rs new file mode 100644 index 000000000..e70e28151 --- /dev/null +++ b/src/datadogV2/model/model_delete_apps_request.rs @@ -0,0 +1,106 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DeleteAppsRequest` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DeleteAppsRequest { + /// The `DeleteAppsRequest` `data`. + #[serde(rename = "data")] + pub data: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DeleteAppsRequest { + pub fn new() -> DeleteAppsRequest { + DeleteAppsRequest { + data: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: Vec) -> Self { + self.data = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for DeleteAppsRequest { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for DeleteAppsRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DeleteAppsRequestVisitor; + impl<'a> Visitor<'a> for DeleteAppsRequestVisitor { + type Value = DeleteAppsRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option> = + None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = DeleteAppsRequest { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DeleteAppsRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_delete_apps_request_data_items.rs b/src/datadogV2/model/model_delete_apps_request_data_items.rs new file mode 100644 index 000000000..24652ede1 --- /dev/null +++ b/src/datadogV2/model/model_delete_apps_request_data_items.rs @@ -0,0 +1,114 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DeleteAppsRequestDataItems` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DeleteAppsRequestDataItems { + /// The `items` `id`. + #[serde(rename = "id")] + pub id: String, + /// The definition of `DeleteAppsRequestDataItemsType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::DeleteAppsRequestDataItemsType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DeleteAppsRequestDataItems { + pub fn new( + id: String, + type_: crate::datadogV2::model::DeleteAppsRequestDataItemsType, + ) -> DeleteAppsRequestDataItems { + DeleteAppsRequestDataItems { + id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for DeleteAppsRequestDataItems { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DeleteAppsRequestDataItemsVisitor; + impl<'a> Visitor<'a> for DeleteAppsRequestDataItemsVisitor { + type Value = DeleteAppsRequestDataItems; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut id: Option = None; + let mut type_: Option = + None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::DeleteAppsRequestDataItemsType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = DeleteAppsRequestDataItems { + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DeleteAppsRequestDataItemsVisitor) + } +} diff --git a/src/datadogV2/model/model_delete_apps_request_data_items_type.rs b/src/datadogV2/model/model_delete_apps_request_data_items_type.rs new file mode 100644 index 000000000..c322ea9a1 --- /dev/null +++ b/src/datadogV2/model/model_delete_apps_request_data_items_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum DeleteAppsRequestDataItemsType { + APPDEFINITIONS, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for DeleteAppsRequestDataItemsType { + fn to_string(&self) -> String { + match self { + Self::APPDEFINITIONS => String::from("appDefinitions"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for DeleteAppsRequestDataItemsType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for DeleteAppsRequestDataItemsType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "appDefinitions" => Self::APPDEFINITIONS, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_delete_apps_response.rs b/src/datadogV2/model/model_delete_apps_response.rs new file mode 100644 index 000000000..b3dfe257c --- /dev/null +++ b/src/datadogV2/model/model_delete_apps_response.rs @@ -0,0 +1,109 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DeleteAppsResponse` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DeleteAppsResponse { + /// The `DeleteAppsResponse` `data`. + #[serde(rename = "data")] + pub data: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DeleteAppsResponse { + pub fn new() -> DeleteAppsResponse { + DeleteAppsResponse { + data: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data( + mut self, + value: Vec, + ) -> Self { + self.data = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for DeleteAppsResponse { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for DeleteAppsResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DeleteAppsResponseVisitor; + impl<'a> Visitor<'a> for DeleteAppsResponseVisitor { + type Value = DeleteAppsResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option> = + None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = DeleteAppsResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DeleteAppsResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_delete_apps_response_data_items.rs b/src/datadogV2/model/model_delete_apps_response_data_items.rs new file mode 100644 index 000000000..75444b835 --- /dev/null +++ b/src/datadogV2/model/model_delete_apps_response_data_items.rs @@ -0,0 +1,114 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DeleteAppsResponseDataItems` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DeleteAppsResponseDataItems { + /// The `items` `id`. + #[serde(rename = "id")] + pub id: String, + /// The definition of `DeleteAppsResponseDataItemsType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::DeleteAppsResponseDataItemsType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DeleteAppsResponseDataItems { + pub fn new( + id: String, + type_: crate::datadogV2::model::DeleteAppsResponseDataItemsType, + ) -> DeleteAppsResponseDataItems { + DeleteAppsResponseDataItems { + id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for DeleteAppsResponseDataItems { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DeleteAppsResponseDataItemsVisitor; + impl<'a> Visitor<'a> for DeleteAppsResponseDataItemsVisitor { + type Value = DeleteAppsResponseDataItems; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut id: Option = None; + let mut type_: Option = + None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::DeleteAppsResponseDataItemsType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = DeleteAppsResponseDataItems { + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DeleteAppsResponseDataItemsVisitor) + } +} diff --git a/src/datadogV2/model/model_delete_apps_response_data_items_type.rs b/src/datadogV2/model/model_delete_apps_response_data_items_type.rs new file mode 100644 index 000000000..c563ee48d --- /dev/null +++ b/src/datadogV2/model/model_delete_apps_response_data_items_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum DeleteAppsResponseDataItemsType { + APPDEFINITIONS, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for DeleteAppsResponseDataItemsType { + fn to_string(&self) -> String { + match self { + Self::APPDEFINITIONS => String::from("appDefinitions"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for DeleteAppsResponseDataItemsType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for DeleteAppsResponseDataItemsType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "appDefinitions" => Self::APPDEFINITIONS, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_deploy_app_response.rs b/src/datadogV2/model/model_deploy_app_response.rs new file mode 100644 index 000000000..35fc712dc --- /dev/null +++ b/src/datadogV2/model/model_deploy_app_response.rs @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DeployAppResponse` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DeployAppResponse { + /// The definition of `DeployAppResponseData` object. + #[serde(rename = "data")] + pub data: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DeployAppResponse { + pub fn new() -> DeployAppResponse { + DeployAppResponse { + data: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: crate::datadogV2::model::DeployAppResponseData) -> Self { + self.data = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for DeployAppResponse { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for DeployAppResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DeployAppResponseVisitor; + impl<'a> Visitor<'a> for DeployAppResponseVisitor { + type Value = DeployAppResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = DeployAppResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DeployAppResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_deploy_app_response_data.rs b/src/datadogV2/model/model_deploy_app_response_data.rs new file mode 100644 index 000000000..a36623b34 --- /dev/null +++ b/src/datadogV2/model/model_deploy_app_response_data.rs @@ -0,0 +1,169 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DeployAppResponseData` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DeployAppResponseData { + /// The definition of `DeployAppResponseDataAttributes` object. + #[serde(rename = "attributes")] + pub attributes: Option, + /// The `data` `id`. + #[serde(rename = "id")] + pub id: Option, + /// The definition of `DeploymentMeta` object. + #[serde(rename = "meta")] + pub meta: Option, + /// The definition of `DeployAppResponseDataType` object. + #[serde(rename = "type")] + pub type_: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DeployAppResponseData { + pub fn new() -> DeployAppResponseData { + DeployAppResponseData { + attributes: None, + id: None, + meta: None, + type_: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes( + mut self, + value: crate::datadogV2::model::DeployAppResponseDataAttributes, + ) -> Self { + self.attributes = Some(value); + self + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn meta(mut self, value: crate::datadogV2::model::DeploymentMeta) -> Self { + self.meta = Some(value); + self + } + + pub fn type_(mut self, value: crate::datadogV2::model::DeployAppResponseDataType) -> Self { + self.type_ = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for DeployAppResponseData { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for DeployAppResponseData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DeployAppResponseDataVisitor; + impl<'a> Visitor<'a> for DeployAppResponseDataVisitor { + type Value = DeployAppResponseData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::DeployAppResponseDataAttributes, + > = None; + let mut id: Option = None; + let mut meta: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + if v.is_null() { + continue; + } + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "meta" => { + if v.is_null() { + continue; + } + meta = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + if v.is_null() { + continue; + } + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::DeployAppResponseDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = DeployAppResponseData { + attributes, + id, + meta, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DeployAppResponseDataVisitor) + } +} diff --git a/src/datadogV2/model/model_deploy_app_response_data_attributes.rs b/src/datadogV2/model/model_deploy_app_response_data_attributes.rs new file mode 100644 index 000000000..99124000c --- /dev/null +++ b/src/datadogV2/model/model_deploy_app_response_data_attributes.rs @@ -0,0 +1,106 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DeployAppResponseDataAttributes` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DeployAppResponseDataAttributes { + /// The `attributes` `app_version_id`. + #[serde(rename = "app_version_id")] + pub app_version_id: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DeployAppResponseDataAttributes { + pub fn new() -> DeployAppResponseDataAttributes { + DeployAppResponseDataAttributes { + app_version_id: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn app_version_id(mut self, value: String) -> Self { + self.app_version_id = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for DeployAppResponseDataAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for DeployAppResponseDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DeployAppResponseDataAttributesVisitor; + impl<'a> Visitor<'a> for DeployAppResponseDataAttributesVisitor { + type Value = DeployAppResponseDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut app_version_id: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "app_version_id" => { + if v.is_null() { + continue; + } + app_version_id = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = DeployAppResponseDataAttributes { + app_version_id, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DeployAppResponseDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_deploy_app_response_data_type.rs b/src/datadogV2/model/model_deploy_app_response_data_type.rs new file mode 100644 index 000000000..9c1db1742 --- /dev/null +++ b/src/datadogV2/model/model_deploy_app_response_data_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum DeployAppResponseDataType { + DEPLOYMENT, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for DeployAppResponseDataType { + fn to_string(&self) -> String { + match self { + Self::DEPLOYMENT => String::from("deployment"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for DeployAppResponseDataType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for DeployAppResponseDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "deployment" => Self::DEPLOYMENT, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_deployment_included.rs b/src/datadogV2/model/model_deployment_included.rs new file mode 100644 index 000000000..7efa458f6 --- /dev/null +++ b/src/datadogV2/model/model_deployment_included.rs @@ -0,0 +1,168 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DeploymentIncluded` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DeploymentIncluded { + /// The definition of `DeploymentIncludedAttributes` object. + #[serde(rename = "attributes")] + pub attributes: Option, + /// The `DeploymentIncluded` `id`. + #[serde(rename = "id")] + pub id: Option, + /// The definition of `DeploymentIncludedMeta` object. + #[serde(rename = "meta")] + pub meta: Option, + /// The definition of `DeploymentIncludedType` object. + #[serde(rename = "type")] + pub type_: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DeploymentIncluded { + pub fn new() -> DeploymentIncluded { + DeploymentIncluded { + attributes: None, + id: None, + meta: None, + type_: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes( + mut self, + value: crate::datadogV2::model::DeploymentIncludedAttributes, + ) -> Self { + self.attributes = Some(value); + self + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn meta(mut self, value: crate::datadogV2::model::DeploymentIncludedMeta) -> Self { + self.meta = Some(value); + self + } + + pub fn type_(mut self, value: crate::datadogV2::model::DeploymentIncludedType) -> Self { + self.type_ = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for DeploymentIncluded { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for DeploymentIncluded { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DeploymentIncludedVisitor; + impl<'a> Visitor<'a> for DeploymentIncludedVisitor { + type Value = DeploymentIncluded; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option = + None; + let mut id: Option = None; + let mut meta: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + if v.is_null() { + continue; + } + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "meta" => { + if v.is_null() { + continue; + } + meta = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + if v.is_null() { + continue; + } + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::DeploymentIncludedType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = DeploymentIncluded { + attributes, + id, + meta, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DeploymentIncludedVisitor) + } +} diff --git a/src/datadogV2/model/model_deployment_included_attributes.rs b/src/datadogV2/model/model_deployment_included_attributes.rs new file mode 100644 index 000000000..f4a6d4273 --- /dev/null +++ b/src/datadogV2/model/model_deployment_included_attributes.rs @@ -0,0 +1,106 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DeploymentIncludedAttributes` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DeploymentIncludedAttributes { + /// The `attributes` `app_version_id`. + #[serde(rename = "app_version_id")] + pub app_version_id: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DeploymentIncludedAttributes { + pub fn new() -> DeploymentIncludedAttributes { + DeploymentIncludedAttributes { + app_version_id: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn app_version_id(mut self, value: String) -> Self { + self.app_version_id = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for DeploymentIncludedAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for DeploymentIncludedAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DeploymentIncludedAttributesVisitor; + impl<'a> Visitor<'a> for DeploymentIncludedAttributesVisitor { + type Value = DeploymentIncludedAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut app_version_id: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "app_version_id" => { + if v.is_null() { + continue; + } + app_version_id = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = DeploymentIncludedAttributes { + app_version_id, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DeploymentIncludedAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_deployment_included_meta.rs b/src/datadogV2/model/model_deployment_included_meta.rs new file mode 100644 index 000000000..9161dc392 --- /dev/null +++ b/src/datadogV2/model/model_deployment_included_meta.rs @@ -0,0 +1,156 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DeploymentIncludedMeta` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DeploymentIncludedMeta { + /// The `meta` `created_at`. + #[serde(rename = "created_at")] + pub created_at: Option, + /// The `meta` `user_id`. + #[serde(rename = "user_id")] + pub user_id: Option, + /// The `meta` `user_name`. + #[serde(rename = "user_name")] + pub user_name: Option, + /// The `meta` `user_uuid`. + #[serde(rename = "user_uuid")] + pub user_uuid: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DeploymentIncludedMeta { + pub fn new() -> DeploymentIncludedMeta { + DeploymentIncludedMeta { + created_at: None, + user_id: None, + user_name: None, + user_uuid: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn created_at(mut self, value: String) -> Self { + self.created_at = Some(value); + self + } + + pub fn user_id(mut self, value: i64) -> Self { + self.user_id = Some(value); + self + } + + pub fn user_name(mut self, value: String) -> Self { + self.user_name = Some(value); + self + } + + pub fn user_uuid(mut self, value: String) -> Self { + self.user_uuid = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for DeploymentIncludedMeta { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for DeploymentIncludedMeta { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DeploymentIncludedMetaVisitor; + impl<'a> Visitor<'a> for DeploymentIncludedMetaVisitor { + type Value = DeploymentIncludedMeta; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut created_at: Option = None; + let mut user_id: Option = None; + let mut user_name: Option = None; + let mut user_uuid: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "created_at" => { + if v.is_null() { + continue; + } + created_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "user_id" => { + if v.is_null() { + continue; + } + user_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "user_name" => { + if v.is_null() { + continue; + } + user_name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "user_uuid" => { + if v.is_null() { + continue; + } + user_uuid = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = DeploymentIncludedMeta { + created_at, + user_id, + user_name, + user_uuid, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DeploymentIncludedMetaVisitor) + } +} diff --git a/src/datadogV2/model/model_deployment_included_type.rs b/src/datadogV2/model/model_deployment_included_type.rs new file mode 100644 index 000000000..37b7cc1e7 --- /dev/null +++ b/src/datadogV2/model/model_deployment_included_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum DeploymentIncludedType { + DEPLOYMENT, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for DeploymentIncludedType { + fn to_string(&self) -> String { + match self { + Self::DEPLOYMENT => String::from("deployment"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for DeploymentIncludedType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for DeploymentIncludedType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "deployment" => Self::DEPLOYMENT, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_deployment_meta.rs b/src/datadogV2/model/model_deployment_meta.rs new file mode 100644 index 000000000..126810396 --- /dev/null +++ b/src/datadogV2/model/model_deployment_meta.rs @@ -0,0 +1,156 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DeploymentMeta` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DeploymentMeta { + /// The `DeploymentMeta` `created_at`. + #[serde(rename = "created_at")] + pub created_at: Option, + /// The `DeploymentMeta` `user_id`. + #[serde(rename = "user_id")] + pub user_id: Option, + /// The `DeploymentMeta` `user_name`. + #[serde(rename = "user_name")] + pub user_name: Option, + /// The `DeploymentMeta` `user_uuid`. + #[serde(rename = "user_uuid")] + pub user_uuid: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DeploymentMeta { + pub fn new() -> DeploymentMeta { + DeploymentMeta { + created_at: None, + user_id: None, + user_name: None, + user_uuid: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn created_at(mut self, value: String) -> Self { + self.created_at = Some(value); + self + } + + pub fn user_id(mut self, value: i64) -> Self { + self.user_id = Some(value); + self + } + + pub fn user_name(mut self, value: String) -> Self { + self.user_name = Some(value); + self + } + + pub fn user_uuid(mut self, value: String) -> Self { + self.user_uuid = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for DeploymentMeta { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for DeploymentMeta { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DeploymentMetaVisitor; + impl<'a> Visitor<'a> for DeploymentMetaVisitor { + type Value = DeploymentMeta; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut created_at: Option = None; + let mut user_id: Option = None; + let mut user_name: Option = None; + let mut user_uuid: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "created_at" => { + if v.is_null() { + continue; + } + created_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "user_id" => { + if v.is_null() { + continue; + } + user_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "user_name" => { + if v.is_null() { + continue; + } + user_name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "user_uuid" => { + if v.is_null() { + continue; + } + user_uuid = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = DeploymentMeta { + created_at, + user_id, + user_name, + user_uuid, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DeploymentMetaVisitor) + } +} diff --git a/src/datadogV2/model/model_deployment_relationship.rs b/src/datadogV2/model/model_deployment_relationship.rs new file mode 100644 index 000000000..c1734804c --- /dev/null +++ b/src/datadogV2/model/model_deployment_relationship.rs @@ -0,0 +1,122 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DeploymentRelationship` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DeploymentRelationship { + /// The definition of `DeploymentRelationshipData` object. + #[serde(rename = "data")] + pub data: Option, + /// The definition of `DeploymentRelationshipMeta` object. + #[serde(rename = "meta")] + pub meta: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DeploymentRelationship { + pub fn new() -> DeploymentRelationship { + DeploymentRelationship { + data: None, + meta: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: crate::datadogV2::model::DeploymentRelationshipData) -> Self { + self.data = Some(value); + self + } + + pub fn meta(mut self, value: crate::datadogV2::model::DeploymentRelationshipMeta) -> Self { + self.meta = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for DeploymentRelationship { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for DeploymentRelationship { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DeploymentRelationshipVisitor; + impl<'a> Visitor<'a> for DeploymentRelationshipVisitor { + type Value = DeploymentRelationship; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut meta: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "meta" => { + if v.is_null() { + continue; + } + meta = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = DeploymentRelationship { + data, + meta, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DeploymentRelationshipVisitor) + } +} diff --git a/src/datadogV2/model/model_deployment_relationship_data.rs b/src/datadogV2/model/model_deployment_relationship_data.rs new file mode 100644 index 000000000..547f23282 --- /dev/null +++ b/src/datadogV2/model/model_deployment_relationship_data.rs @@ -0,0 +1,131 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DeploymentRelationshipData` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DeploymentRelationshipData { + /// The `data` `id`. + #[serde(rename = "id")] + pub id: Option, + /// The definition of `DeploymentRelationshipDataType` object. + #[serde(rename = "type")] + pub type_: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DeploymentRelationshipData { + pub fn new() -> DeploymentRelationshipData { + DeploymentRelationshipData { + id: None, + type_: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn type_(mut self, value: crate::datadogV2::model::DeploymentRelationshipDataType) -> Self { + self.type_ = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for DeploymentRelationshipData { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for DeploymentRelationshipData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DeploymentRelationshipDataVisitor; + impl<'a> Visitor<'a> for DeploymentRelationshipDataVisitor { + type Value = DeploymentRelationshipData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut id: Option = None; + let mut type_: Option = + None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + if v.is_null() { + continue; + } + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::DeploymentRelationshipDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = DeploymentRelationshipData { + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DeploymentRelationshipDataVisitor) + } +} diff --git a/src/datadogV2/model/model_deployment_relationship_data_type.rs b/src/datadogV2/model/model_deployment_relationship_data_type.rs new file mode 100644 index 000000000..83a68b220 --- /dev/null +++ b/src/datadogV2/model/model_deployment_relationship_data_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum DeploymentRelationshipDataType { + DEPLOYMENT, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for DeploymentRelationshipDataType { + fn to_string(&self) -> String { + match self { + Self::DEPLOYMENT => String::from("deployment"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for DeploymentRelationshipDataType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for DeploymentRelationshipDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "deployment" => Self::DEPLOYMENT, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_deployment_relationship_meta.rs b/src/datadogV2/model/model_deployment_relationship_meta.rs new file mode 100644 index 000000000..c99b9a1d0 --- /dev/null +++ b/src/datadogV2/model/model_deployment_relationship_meta.rs @@ -0,0 +1,156 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DeploymentRelationshipMeta` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DeploymentRelationshipMeta { + /// The `meta` `created_at`. + #[serde(rename = "created_at")] + pub created_at: Option, + /// The `meta` `user_id`. + #[serde(rename = "user_id")] + pub user_id: Option, + /// The `meta` `user_name`. + #[serde(rename = "user_name")] + pub user_name: Option, + /// The `meta` `user_uuid`. + #[serde(rename = "user_uuid")] + pub user_uuid: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DeploymentRelationshipMeta { + pub fn new() -> DeploymentRelationshipMeta { + DeploymentRelationshipMeta { + created_at: None, + user_id: None, + user_name: None, + user_uuid: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn created_at(mut self, value: String) -> Self { + self.created_at = Some(value); + self + } + + pub fn user_id(mut self, value: i64) -> Self { + self.user_id = Some(value); + self + } + + pub fn user_name(mut self, value: String) -> Self { + self.user_name = Some(value); + self + } + + pub fn user_uuid(mut self, value: String) -> Self { + self.user_uuid = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for DeploymentRelationshipMeta { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for DeploymentRelationshipMeta { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DeploymentRelationshipMetaVisitor; + impl<'a> Visitor<'a> for DeploymentRelationshipMetaVisitor { + type Value = DeploymentRelationshipMeta; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut created_at: Option = None; + let mut user_id: Option = None; + let mut user_name: Option = None; + let mut user_uuid: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "created_at" => { + if v.is_null() { + continue; + } + created_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "user_id" => { + if v.is_null() { + continue; + } + user_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "user_name" => { + if v.is_null() { + continue; + } + user_name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "user_uuid" => { + if v.is_null() { + continue; + } + user_uuid = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = DeploymentRelationshipMeta { + created_at, + user_id, + user_name, + user_uuid, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DeploymentRelationshipMetaVisitor) + } +} diff --git a/src/datadogV2/model/model_disable_app_response.rs b/src/datadogV2/model/model_disable_app_response.rs new file mode 100644 index 000000000..eea85cc6d --- /dev/null +++ b/src/datadogV2/model/model_disable_app_response.rs @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DisableAppResponse` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DisableAppResponse { + /// The definition of `DisableAppResponseData` object. + #[serde(rename = "data")] + pub data: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DisableAppResponse { + pub fn new() -> DisableAppResponse { + DisableAppResponse { + data: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: crate::datadogV2::model::DisableAppResponseData) -> Self { + self.data = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for DisableAppResponse { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for DisableAppResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DisableAppResponseVisitor; + impl<'a> Visitor<'a> for DisableAppResponseVisitor { + type Value = DisableAppResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = DisableAppResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DisableAppResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_disable_app_response_data.rs b/src/datadogV2/model/model_disable_app_response_data.rs new file mode 100644 index 000000000..1d6716873 --- /dev/null +++ b/src/datadogV2/model/model_disable_app_response_data.rs @@ -0,0 +1,169 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DisableAppResponseData` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DisableAppResponseData { + /// The definition of `DisableAppResponseDataAttributes` object. + #[serde(rename = "attributes")] + pub attributes: Option, + /// The `data` `id`. + #[serde(rename = "id")] + pub id: Option, + /// The definition of `DeploymentMeta` object. + #[serde(rename = "meta")] + pub meta: Option, + /// The definition of `DisableAppResponseDataType` object. + #[serde(rename = "type")] + pub type_: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DisableAppResponseData { + pub fn new() -> DisableAppResponseData { + DisableAppResponseData { + attributes: None, + id: None, + meta: None, + type_: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes( + mut self, + value: crate::datadogV2::model::DisableAppResponseDataAttributes, + ) -> Self { + self.attributes = Some(value); + self + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn meta(mut self, value: crate::datadogV2::model::DeploymentMeta) -> Self { + self.meta = Some(value); + self + } + + pub fn type_(mut self, value: crate::datadogV2::model::DisableAppResponseDataType) -> Self { + self.type_ = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for DisableAppResponseData { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for DisableAppResponseData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DisableAppResponseDataVisitor; + impl<'a> Visitor<'a> for DisableAppResponseDataVisitor { + type Value = DisableAppResponseData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::DisableAppResponseDataAttributes, + > = None; + let mut id: Option = None; + let mut meta: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + if v.is_null() { + continue; + } + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "meta" => { + if v.is_null() { + continue; + } + meta = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + if v.is_null() { + continue; + } + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::DisableAppResponseDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = DisableAppResponseData { + attributes, + id, + meta, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DisableAppResponseDataVisitor) + } +} diff --git a/src/datadogV2/model/model_disable_app_response_data_attributes.rs b/src/datadogV2/model/model_disable_app_response_data_attributes.rs new file mode 100644 index 000000000..e7678f884 --- /dev/null +++ b/src/datadogV2/model/model_disable_app_response_data_attributes.rs @@ -0,0 +1,106 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DisableAppResponseDataAttributes` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DisableAppResponseDataAttributes { + /// The `attributes` `app_version_id`. + #[serde(rename = "app_version_id")] + pub app_version_id: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DisableAppResponseDataAttributes { + pub fn new() -> DisableAppResponseDataAttributes { + DisableAppResponseDataAttributes { + app_version_id: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn app_version_id(mut self, value: String) -> Self { + self.app_version_id = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for DisableAppResponseDataAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for DisableAppResponseDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DisableAppResponseDataAttributesVisitor; + impl<'a> Visitor<'a> for DisableAppResponseDataAttributesVisitor { + type Value = DisableAppResponseDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut app_version_id: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "app_version_id" => { + if v.is_null() { + continue; + } + app_version_id = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = DisableAppResponseDataAttributes { + app_version_id, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DisableAppResponseDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_disable_app_response_data_type.rs b/src/datadogV2/model/model_disable_app_response_data_type.rs new file mode 100644 index 000000000..37010fba7 --- /dev/null +++ b/src/datadogV2/model/model_disable_app_response_data_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum DisableAppResponseDataType { + DEPLOYMENT, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for DisableAppResponseDataType { + fn to_string(&self) -> String { + match self { + Self::DEPLOYMENT => String::from("deployment"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for DisableAppResponseDataType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for DisableAppResponseDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "deployment" => Self::DEPLOYMENT, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_get_app_response.rs b/src/datadogV2/model/model_get_app_response.rs new file mode 100644 index 000000000..0c9065bd0 --- /dev/null +++ b/src/datadogV2/model/model_get_app_response.rs @@ -0,0 +1,161 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `GetAppResponse` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GetAppResponse { + /// The definition of `GetAppResponseData` object. + #[serde(rename = "data")] + pub data: Option, + /// The `GetAppResponse` `included`. + #[serde(rename = "included")] + pub included: Option>, + /// The definition of `AppMeta` object. + #[serde(rename = "meta")] + pub meta: Option, + /// The definition of `GetAppResponseRelationship` object. + #[serde(rename = "relationship")] + pub relationship: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GetAppResponse { + pub fn new() -> GetAppResponse { + GetAppResponse { + data: None, + included: None, + meta: None, + relationship: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: crate::datadogV2::model::GetAppResponseData) -> Self { + self.data = Some(value); + self + } + + pub fn included(mut self, value: Vec) -> Self { + self.included = Some(value); + self + } + + pub fn meta(mut self, value: crate::datadogV2::model::AppMeta) -> Self { + self.meta = Some(value); + self + } + + pub fn relationship( + mut self, + value: crate::datadogV2::model::GetAppResponseRelationship, + ) -> Self { + self.relationship = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for GetAppResponse { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for GetAppResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GetAppResponseVisitor; + impl<'a> Visitor<'a> for GetAppResponseVisitor { + type Value = GetAppResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut included: Option> = None; + let mut meta: Option = None; + let mut relationship: Option = + None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "included" => { + if v.is_null() { + continue; + } + included = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "meta" => { + if v.is_null() { + continue; + } + meta = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "relationship" => { + if v.is_null() { + continue; + } + relationship = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = GetAppResponse { + data, + included, + meta, + relationship, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GetAppResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_get_app_response_data.rs b/src/datadogV2/model/model_get_app_response_data.rs new file mode 100644 index 000000000..e6957dc05 --- /dev/null +++ b/src/datadogV2/model/model_get_app_response_data.rs @@ -0,0 +1,125 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `GetAppResponseData` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GetAppResponseData { + /// The definition of `GetAppResponseDataAttributes` object. + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::GetAppResponseDataAttributes, + /// The `data` `id`. + #[serde(rename = "id")] + pub id: String, + /// The definition of `GetAppResponseDataType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::GetAppResponseDataType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GetAppResponseData { + pub fn new( + attributes: crate::datadogV2::model::GetAppResponseDataAttributes, + id: String, + type_: crate::datadogV2::model::GetAppResponseDataType, + ) -> GetAppResponseData { + GetAppResponseData { + attributes, + id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for GetAppResponseData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GetAppResponseDataVisitor; + impl<'a> Visitor<'a> for GetAppResponseDataVisitor { + type Value = GetAppResponseData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option = + None; + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::GetAppResponseDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = GetAppResponseData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GetAppResponseDataVisitor) + } +} diff --git a/src/datadogV2/model/model_get_app_response_data_attributes.rs b/src/datadogV2/model/model_get_app_response_data_attributes.rs new file mode 100644 index 000000000..36144953c --- /dev/null +++ b/src/datadogV2/model/model_get_app_response_data_attributes.rs @@ -0,0 +1,245 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `GetAppResponseDataAttributes` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GetAppResponseDataAttributes { + /// The `attributes` `components`. + #[serde(rename = "components")] + pub components: Option>, + /// The `attributes` `description`. + #[serde(rename = "description")] + pub description: Option, + /// The `attributes` `embeddedQueries`. + #[serde(rename = "embeddedQueries")] + pub embedded_queries: Option>, + /// The `attributes` `favorite`. + #[serde(rename = "favorite")] + pub favorite: Option, + /// The definition of `InputSchema` object. + #[serde(rename = "inputSchema")] + pub input_schema: Option, + /// The `attributes` `name`. + #[serde(rename = "name")] + pub name: Option, + /// The `attributes` `rootInstanceName`. + #[serde(rename = "rootInstanceName")] + pub root_instance_name: Option, + /// The `attributes` `scripts`. + #[serde(rename = "scripts")] + pub scripts: Option>, + /// The `attributes` `tags`. + #[serde(rename = "tags")] + pub tags: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GetAppResponseDataAttributes { + pub fn new() -> GetAppResponseDataAttributes { + GetAppResponseDataAttributes { + components: None, + description: None, + embedded_queries: None, + favorite: None, + input_schema: None, + name: None, + root_instance_name: None, + scripts: None, + tags: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn components(mut self, value: Vec) -> Self { + self.components = Some(value); + self + } + + pub fn description(mut self, value: String) -> Self { + self.description = Some(value); + self + } + + pub fn embedded_queries(mut self, value: Vec) -> Self { + self.embedded_queries = Some(value); + self + } + + pub fn favorite(mut self, value: bool) -> Self { + self.favorite = Some(value); + self + } + + pub fn input_schema(mut self, value: crate::datadogV2::model::InputSchema) -> Self { + self.input_schema = Some(value); + self + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn root_instance_name(mut self, value: String) -> Self { + self.root_instance_name = Some(value); + self + } + + pub fn scripts(mut self, value: Vec) -> Self { + self.scripts = Some(value); + self + } + + pub fn tags(mut self, value: Vec) -> Self { + self.tags = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for GetAppResponseDataAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for GetAppResponseDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GetAppResponseDataAttributesVisitor; + impl<'a> Visitor<'a> for GetAppResponseDataAttributesVisitor { + type Value = GetAppResponseDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut components: Option> = None; + let mut description: Option = None; + let mut embedded_queries: Option> = None; + let mut favorite: Option = None; + let mut input_schema: Option = None; + let mut name: Option = None; + let mut root_instance_name: Option = None; + let mut scripts: Option> = None; + let mut tags: Option> = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "components" => { + if v.is_null() { + continue; + } + components = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "description" => { + if v.is_null() { + continue; + } + description = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "embeddedQueries" => { + if v.is_null() { + continue; + } + embedded_queries = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "favorite" => { + if v.is_null() { + continue; + } + favorite = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "inputSchema" => { + if v.is_null() { + continue; + } + input_schema = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "rootInstanceName" => { + if v.is_null() { + continue; + } + root_instance_name = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "scripts" => { + if v.is_null() { + continue; + } + scripts = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "tags" => { + if v.is_null() { + continue; + } + tags = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = GetAppResponseDataAttributes { + components, + description, + embedded_queries, + favorite, + input_schema, + name, + root_instance_name, + scripts, + tags, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GetAppResponseDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_get_app_response_data_type.rs b/src/datadogV2/model/model_get_app_response_data_type.rs new file mode 100644 index 000000000..7f98d2bc2 --- /dev/null +++ b/src/datadogV2/model/model_get_app_response_data_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum GetAppResponseDataType { + APPDEFINITIONS, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for GetAppResponseDataType { + fn to_string(&self) -> String { + match self { + Self::APPDEFINITIONS => String::from("appDefinitions"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for GetAppResponseDataType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for GetAppResponseDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "appDefinitions" => Self::APPDEFINITIONS, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_get_app_response_relationship.rs b/src/datadogV2/model/model_get_app_response_relationship.rs new file mode 100644 index 000000000..dd4991bcf --- /dev/null +++ b/src/datadogV2/model/model_get_app_response_relationship.rs @@ -0,0 +1,123 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `GetAppResponseRelationship` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GetAppResponseRelationship { + /// The `relationship` `connections`. + #[serde(rename = "connections")] + pub connections: Option>, + /// The definition of `DeploymentRelationship` object. + #[serde(rename = "deployment")] + pub deployment: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GetAppResponseRelationship { + pub fn new() -> GetAppResponseRelationship { + GetAppResponseRelationship { + connections: None, + deployment: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn connections(mut self, value: Vec) -> Self { + self.connections = Some(value); + self + } + + pub fn deployment(mut self, value: crate::datadogV2::model::DeploymentRelationship) -> Self { + self.deployment = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for GetAppResponseRelationship { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for GetAppResponseRelationship { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GetAppResponseRelationshipVisitor; + impl<'a> Visitor<'a> for GetAppResponseRelationshipVisitor { + type Value = GetAppResponseRelationship; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut connections: Option> = None; + let mut deployment: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "connections" => { + if v.is_null() { + continue; + } + connections = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "deployment" => { + if v.is_null() { + continue; + } + deployment = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = GetAppResponseRelationship { + connections, + deployment, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GetAppResponseRelationshipVisitor) + } +} diff --git a/src/datadogV2/model/model_input_schema.rs b/src/datadogV2/model/model_input_schema.rs new file mode 100644 index 000000000..144228b34 --- /dev/null +++ b/src/datadogV2/model/model_input_schema.rs @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `InputSchema` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct InputSchema { + /// The definition of `InputSchemaData` object. + #[serde(rename = "data")] + pub data: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl InputSchema { + pub fn new() -> InputSchema { + InputSchema { + data: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: crate::datadogV2::model::InputSchemaData) -> Self { + self.data = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for InputSchema { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for InputSchema { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct InputSchemaVisitor; + impl<'a> Visitor<'a> for InputSchemaVisitor { + type Value = InputSchema; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = InputSchema { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(InputSchemaVisitor) + } +} diff --git a/src/datadogV2/model/model_input_schema_data.rs b/src/datadogV2/model/model_input_schema_data.rs new file mode 100644 index 000000000..6f161649d --- /dev/null +++ b/src/datadogV2/model/model_input_schema_data.rs @@ -0,0 +1,148 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `InputSchemaData` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct InputSchemaData { + /// The definition of `InputSchemaDataAttributes` object. + #[serde(rename = "attributes")] + pub attributes: Option, + /// The `data` `id`. + #[serde(rename = "id")] + pub id: Option, + /// The definition of `InputSchemaDataType` object. + #[serde(rename = "type")] + pub type_: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl InputSchemaData { + pub fn new() -> InputSchemaData { + InputSchemaData { + attributes: None, + id: None, + type_: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes(mut self, value: crate::datadogV2::model::InputSchemaDataAttributes) -> Self { + self.attributes = Some(value); + self + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn type_(mut self, value: crate::datadogV2::model::InputSchemaDataType) -> Self { + self.type_ = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for InputSchemaData { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for InputSchemaData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct InputSchemaDataVisitor; + impl<'a> Visitor<'a> for InputSchemaDataVisitor { + type Value = InputSchemaData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option = + None; + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + if v.is_null() { + continue; + } + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + if v.is_null() { + continue; + } + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::InputSchemaDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = InputSchemaData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(InputSchemaDataVisitor) + } +} diff --git a/src/datadogV2/model/model_input_schema_data_attributes.rs b/src/datadogV2/model/model_input_schema_data_attributes.rs new file mode 100644 index 000000000..6202839f0 --- /dev/null +++ b/src/datadogV2/model/model_input_schema_data_attributes.rs @@ -0,0 +1,110 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `InputSchemaDataAttributes` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct InputSchemaDataAttributes { + /// The `attributes` `parameters`. + #[serde(rename = "parameters")] + pub parameters: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl InputSchemaDataAttributes { + pub fn new() -> InputSchemaDataAttributes { + InputSchemaDataAttributes { + parameters: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn parameters( + mut self, + value: Vec, + ) -> Self { + self.parameters = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for InputSchemaDataAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for InputSchemaDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct InputSchemaDataAttributesVisitor; + impl<'a> Visitor<'a> for InputSchemaDataAttributesVisitor { + type Value = InputSchemaDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut parameters: Option< + Vec, + > = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "parameters" => { + if v.is_null() { + continue; + } + parameters = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = InputSchemaDataAttributes { + parameters, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(InputSchemaDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_input_schema_data_attributes_parameters_items.rs b/src/datadogV2/model/model_input_schema_data_attributes_parameters_items.rs new file mode 100644 index 000000000..6dffaebc7 --- /dev/null +++ b/src/datadogV2/model/model_input_schema_data_attributes_parameters_items.rs @@ -0,0 +1,110 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `InputSchemaDataAttributesParametersItems` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct InputSchemaDataAttributesParametersItems { + /// The definition of `InputSchemaDataAttributesParametersItemsData` object. + #[serde(rename = "data")] + pub data: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl InputSchemaDataAttributesParametersItems { + pub fn new() -> InputSchemaDataAttributesParametersItems { + InputSchemaDataAttributesParametersItems { + data: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data( + mut self, + value: crate::datadogV2::model::InputSchemaDataAttributesParametersItemsData, + ) -> Self { + self.data = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for InputSchemaDataAttributesParametersItems { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for InputSchemaDataAttributesParametersItems { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct InputSchemaDataAttributesParametersItemsVisitor; + impl<'a> Visitor<'a> for InputSchemaDataAttributesParametersItemsVisitor { + type Value = InputSchemaDataAttributesParametersItems; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option< + crate::datadogV2::model::InputSchemaDataAttributesParametersItemsData, + > = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = InputSchemaDataAttributesParametersItems { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(InputSchemaDataAttributesParametersItemsVisitor) + } +} diff --git a/src/datadogV2/model/model_input_schema_data_attributes_parameters_items_data.rs b/src/datadogV2/model/model_input_schema_data_attributes_parameters_items_data.rs new file mode 100644 index 000000000..dd194c22f --- /dev/null +++ b/src/datadogV2/model/model_input_schema_data_attributes_parameters_items_data.rs @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `InputSchemaDataAttributesParametersItemsData` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct InputSchemaDataAttributesParametersItemsData { + /// The definition of `InputSchemaDataAttributesParametersItemsDataAttributes` object. + #[serde(rename = "attributes")] + pub attributes: + Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl InputSchemaDataAttributesParametersItemsData { + pub fn new() -> InputSchemaDataAttributesParametersItemsData { + InputSchemaDataAttributesParametersItemsData { + attributes: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes( + mut self, + value: crate::datadogV2::model::InputSchemaDataAttributesParametersItemsDataAttributes, + ) -> Self { + self.attributes = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for InputSchemaDataAttributesParametersItemsData { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for InputSchemaDataAttributesParametersItemsData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct InputSchemaDataAttributesParametersItemsDataVisitor; + impl<'a> Visitor<'a> for InputSchemaDataAttributesParametersItemsDataVisitor { + type Value = InputSchemaDataAttributesParametersItemsData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::InputSchemaDataAttributesParametersItemsDataAttributes, + > = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + if v.is_null() { + continue; + } + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = InputSchemaDataAttributesParametersItemsData { + attributes, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(InputSchemaDataAttributesParametersItemsDataVisitor) + } +} diff --git a/src/datadogV2/model/model_input_schema_data_attributes_parameters_items_data_attributes.rs b/src/datadogV2/model/model_input_schema_data_attributes_parameters_items_data_attributes.rs new file mode 100644 index 000000000..0d6349e35 --- /dev/null +++ b/src/datadogV2/model/model_input_schema_data_attributes_parameters_items_data_attributes.rs @@ -0,0 +1,192 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `InputSchemaDataAttributesParametersItemsDataAttributes` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct InputSchemaDataAttributesParametersItemsDataAttributes { + /// The `attributes` `defaultValue`. + #[serde(rename = "defaultValue")] + pub default_value: Option, + /// The `attributes` `description`. + #[serde(rename = "description")] + pub description: Option, + /// The `attributes` `enum`. + #[serde(rename = "enum")] + pub enum_: Option>, + /// The `attributes` `label`. + #[serde(rename = "label")] + pub label: Option, + /// The `attributes` `name`. + #[serde(rename = "name")] + pub name: Option, + /// The `attributes` `type`. + #[serde(rename = "type")] + pub type_: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl InputSchemaDataAttributesParametersItemsDataAttributes { + pub fn new() -> InputSchemaDataAttributesParametersItemsDataAttributes { + InputSchemaDataAttributesParametersItemsDataAttributes { + default_value: None, + description: None, + enum_: None, + label: None, + name: None, + type_: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn default_value(mut self, value: serde_json::Value) -> Self { + self.default_value = Some(value); + self + } + + pub fn description(mut self, value: String) -> Self { + self.description = Some(value); + self + } + + pub fn enum_(mut self, value: Vec) -> Self { + self.enum_ = Some(value); + self + } + + pub fn label(mut self, value: String) -> Self { + self.label = Some(value); + self + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn type_(mut self, value: String) -> Self { + self.type_ = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for InputSchemaDataAttributesParametersItemsDataAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for InputSchemaDataAttributesParametersItemsDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct InputSchemaDataAttributesParametersItemsDataAttributesVisitor; + impl<'a> Visitor<'a> for InputSchemaDataAttributesParametersItemsDataAttributesVisitor { + type Value = InputSchemaDataAttributesParametersItemsDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut default_value: Option = None; + let mut description: Option = None; + let mut enum_: Option> = None; + let mut label: Option = None; + let mut name: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "defaultValue" => { + if v.is_null() { + continue; + } + default_value = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "description" => { + if v.is_null() { + continue; + } + description = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "enum" => { + if v.is_null() { + continue; + } + enum_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "label" => { + if v.is_null() { + continue; + } + label = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + if v.is_null() { + continue; + } + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = InputSchemaDataAttributesParametersItemsDataAttributes { + default_value, + description, + enum_, + label, + name, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(InputSchemaDataAttributesParametersItemsDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_input_schema_data_type.rs b/src/datadogV2/model/model_input_schema_data_type.rs new file mode 100644 index 000000000..758399682 --- /dev/null +++ b/src/datadogV2/model/model_input_schema_data_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum InputSchemaDataType { + INPUTSCHEMA, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for InputSchemaDataType { + fn to_string(&self) -> String { + match self { + Self::INPUTSCHEMA => String::from("inputSchema"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for InputSchemaDataType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for InputSchemaDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "inputSchema" => Self::INPUTSCHEMA, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_list_apps_response.rs b/src/datadogV2/model/model_list_apps_response.rs new file mode 100644 index 000000000..3bf0b219e --- /dev/null +++ b/src/datadogV2/model/model_list_apps_response.rs @@ -0,0 +1,140 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `ListAppsResponse` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ListAppsResponse { + /// The `ListAppsResponse` `data`. + #[serde(rename = "data")] + pub data: Option>, + /// The `ListAppsResponse` `included`. + #[serde(rename = "included")] + pub included: Option>, + /// The definition of `ListAppsResponseMeta` object. + #[serde(rename = "meta")] + pub meta: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ListAppsResponse { + pub fn new() -> ListAppsResponse { + ListAppsResponse { + data: None, + included: None, + meta: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: Vec) -> Self { + self.data = Some(value); + self + } + + pub fn included(mut self, value: Vec) -> Self { + self.included = Some(value); + self + } + + pub fn meta(mut self, value: crate::datadogV2::model::ListAppsResponseMeta) -> Self { + self.meta = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for ListAppsResponse { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for ListAppsResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ListAppsResponseVisitor; + impl<'a> Visitor<'a> for ListAppsResponseVisitor { + type Value = ListAppsResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option> = + None; + let mut included: Option> = None; + let mut meta: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "included" => { + if v.is_null() { + continue; + } + included = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "meta" => { + if v.is_null() { + continue; + } + meta = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = ListAppsResponse { + data, + included, + meta, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ListAppsResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_list_apps_response_data_items.rs b/src/datadogV2/model/model_list_apps_response_data_items.rs new file mode 100644 index 000000000..482216951 --- /dev/null +++ b/src/datadogV2/model/model_list_apps_response_data_items.rs @@ -0,0 +1,167 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `ListAppsResponseDataItems` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ListAppsResponseDataItems { + /// The definition of `ListAppsResponseDataItemsAttributes` object. + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::ListAppsResponseDataItemsAttributes, + /// The `items` `id`. + #[serde(rename = "id")] + pub id: String, + /// The definition of `AppMeta` object. + #[serde(rename = "meta")] + pub meta: Option, + /// The definition of `ListAppsResponseDataItemsRelationships` object. + #[serde(rename = "relationships")] + pub relationships: Option, + /// The definition of `ListAppsResponseDataItemsType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::ListAppsResponseDataItemsType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ListAppsResponseDataItems { + pub fn new( + attributes: crate::datadogV2::model::ListAppsResponseDataItemsAttributes, + id: String, + type_: crate::datadogV2::model::ListAppsResponseDataItemsType, + ) -> ListAppsResponseDataItems { + ListAppsResponseDataItems { + attributes, + id, + meta: None, + relationships: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn meta(mut self, value: crate::datadogV2::model::AppMeta) -> Self { + self.meta = Some(value); + self + } + + pub fn relationships( + mut self, + value: crate::datadogV2::model::ListAppsResponseDataItemsRelationships, + ) -> Self { + self.relationships = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for ListAppsResponseDataItems { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ListAppsResponseDataItemsVisitor; + impl<'a> Visitor<'a> for ListAppsResponseDataItemsVisitor { + type Value = ListAppsResponseDataItems; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::ListAppsResponseDataItemsAttributes, + > = None; + let mut id: Option = None; + let mut meta: Option = None; + let mut relationships: Option< + crate::datadogV2::model::ListAppsResponseDataItemsRelationships, + > = None; + let mut type_: Option = + None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "meta" => { + if v.is_null() { + continue; + } + meta = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "relationships" => { + if v.is_null() { + continue; + } + relationships = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::ListAppsResponseDataItemsType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = ListAppsResponseDataItems { + attributes, + id, + meta, + relationships, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ListAppsResponseDataItemsVisitor) + } +} diff --git a/src/datadogV2/model/model_list_apps_response_data_items_attributes.rs b/src/datadogV2/model/model_list_apps_response_data_items_attributes.rs new file mode 100644 index 000000000..6826be218 --- /dev/null +++ b/src/datadogV2/model/model_list_apps_response_data_items_attributes.rs @@ -0,0 +1,175 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `ListAppsResponseDataItemsAttributes` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ListAppsResponseDataItemsAttributes { + /// The `attributes` `description`. + #[serde(rename = "description")] + pub description: Option, + /// The `attributes` `favorite`. + #[serde(rename = "favorite")] + pub favorite: Option, + /// The `attributes` `name`. + #[serde(rename = "name")] + pub name: Option, + /// The `attributes` `selfService`. + #[serde(rename = "selfService")] + pub self_service: Option, + /// The `attributes` `tags`. + #[serde(rename = "tags")] + pub tags: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ListAppsResponseDataItemsAttributes { + pub fn new() -> ListAppsResponseDataItemsAttributes { + ListAppsResponseDataItemsAttributes { + description: None, + favorite: None, + name: None, + self_service: None, + tags: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn description(mut self, value: String) -> Self { + self.description = Some(value); + self + } + + pub fn favorite(mut self, value: bool) -> Self { + self.favorite = Some(value); + self + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn self_service(mut self, value: bool) -> Self { + self.self_service = Some(value); + self + } + + pub fn tags(mut self, value: Vec) -> Self { + self.tags = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for ListAppsResponseDataItemsAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for ListAppsResponseDataItemsAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ListAppsResponseDataItemsAttributesVisitor; + impl<'a> Visitor<'a> for ListAppsResponseDataItemsAttributesVisitor { + type Value = ListAppsResponseDataItemsAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut description: Option = None; + let mut favorite: Option = None; + let mut name: Option = None; + let mut self_service: Option = None; + let mut tags: Option> = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "description" => { + if v.is_null() { + continue; + } + description = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "favorite" => { + if v.is_null() { + continue; + } + favorite = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "selfService" => { + if v.is_null() { + continue; + } + self_service = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "tags" => { + if v.is_null() { + continue; + } + tags = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = ListAppsResponseDataItemsAttributes { + description, + favorite, + name, + self_service, + tags, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ListAppsResponseDataItemsAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_list_apps_response_data_items_relationships.rs b/src/datadogV2/model/model_list_apps_response_data_items_relationships.rs new file mode 100644 index 000000000..d434b06ee --- /dev/null +++ b/src/datadogV2/model/model_list_apps_response_data_items_relationships.rs @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `ListAppsResponseDataItemsRelationships` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ListAppsResponseDataItemsRelationships { + /// The definition of `DeploymentRelationship` object. + #[serde(rename = "deployment")] + pub deployment: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ListAppsResponseDataItemsRelationships { + pub fn new() -> ListAppsResponseDataItemsRelationships { + ListAppsResponseDataItemsRelationships { + deployment: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn deployment(mut self, value: crate::datadogV2::model::DeploymentRelationship) -> Self { + self.deployment = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for ListAppsResponseDataItemsRelationships { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for ListAppsResponseDataItemsRelationships { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ListAppsResponseDataItemsRelationshipsVisitor; + impl<'a> Visitor<'a> for ListAppsResponseDataItemsRelationshipsVisitor { + type Value = ListAppsResponseDataItemsRelationships; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut deployment: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "deployment" => { + if v.is_null() { + continue; + } + deployment = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = ListAppsResponseDataItemsRelationships { + deployment, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ListAppsResponseDataItemsRelationshipsVisitor) + } +} diff --git a/src/datadogV2/model/model_list_apps_response_data_items_type.rs b/src/datadogV2/model/model_list_apps_response_data_items_type.rs new file mode 100644 index 000000000..cc83fe004 --- /dev/null +++ b/src/datadogV2/model/model_list_apps_response_data_items_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum ListAppsResponseDataItemsType { + APPDEFINITIONS, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for ListAppsResponseDataItemsType { + fn to_string(&self) -> String { + match self { + Self::APPDEFINITIONS => String::from("appDefinitions"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for ListAppsResponseDataItemsType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for ListAppsResponseDataItemsType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "appDefinitions" => Self::APPDEFINITIONS, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_list_apps_response_meta.rs b/src/datadogV2/model/model_list_apps_response_meta.rs new file mode 100644 index 000000000..a54bedf47 --- /dev/null +++ b/src/datadogV2/model/model_list_apps_response_meta.rs @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `ListAppsResponseMeta` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ListAppsResponseMeta { + /// The definition of `ListAppsResponseMetaPage` object. + #[serde(rename = "page")] + pub page: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ListAppsResponseMeta { + pub fn new() -> ListAppsResponseMeta { + ListAppsResponseMeta { + page: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn page(mut self, value: crate::datadogV2::model::ListAppsResponseMetaPage) -> Self { + self.page = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for ListAppsResponseMeta { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for ListAppsResponseMeta { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ListAppsResponseMetaVisitor; + impl<'a> Visitor<'a> for ListAppsResponseMetaVisitor { + type Value = ListAppsResponseMeta; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut page: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "page" => { + if v.is_null() { + continue; + } + page = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = ListAppsResponseMeta { + page, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ListAppsResponseMetaVisitor) + } +} diff --git a/src/datadogV2/model/model_list_apps_response_meta_page.rs b/src/datadogV2/model/model_list_apps_response_meta_page.rs new file mode 100644 index 000000000..b1408b5f2 --- /dev/null +++ b/src/datadogV2/model/model_list_apps_response_meta_page.rs @@ -0,0 +1,124 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `ListAppsResponseMetaPage` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ListAppsResponseMetaPage { + /// The `page` `totalCount`. + #[serde(rename = "totalCount")] + pub total_count: Option, + /// The `page` `totalFilteredCount`. + #[serde(rename = "totalFilteredCount")] + pub total_filtered_count: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ListAppsResponseMetaPage { + pub fn new() -> ListAppsResponseMetaPage { + ListAppsResponseMetaPage { + total_count: None, + total_filtered_count: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn total_count(mut self, value: i64) -> Self { + self.total_count = Some(value); + self + } + + pub fn total_filtered_count(mut self, value: i64) -> Self { + self.total_filtered_count = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for ListAppsResponseMetaPage { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for ListAppsResponseMetaPage { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ListAppsResponseMetaPageVisitor; + impl<'a> Visitor<'a> for ListAppsResponseMetaPageVisitor { + type Value = ListAppsResponseMetaPage; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut total_count: Option = None; + let mut total_filtered_count: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "totalCount" => { + if v.is_null() { + continue; + } + total_count = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "totalFilteredCount" => { + if v.is_null() { + continue; + } + total_filtered_count = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = ListAppsResponseMetaPage { + total_count, + total_filtered_count, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ListAppsResponseMetaPageVisitor) + } +} diff --git a/src/datadogV2/model/model_query.rs b/src/datadogV2/model/model_query.rs new file mode 100644 index 000000000..e90511857 --- /dev/null +++ b/src/datadogV2/model/model_query.rs @@ -0,0 +1,154 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `Query` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct Query { + /// The `Query` `events`. + #[serde(rename = "events")] + pub events: Option>, + /// The `Query` `id`. + #[serde(rename = "id")] + pub id: String, + /// The `Query` `name`. + #[serde(rename = "name")] + pub name: String, + /// The `Query` `properties`. + #[serde(rename = "properties")] + pub properties: Option, + /// The definition of `QueryType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::QueryType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl Query { + pub fn new(id: String, name: String, type_: crate::datadogV2::model::QueryType) -> Query { + Query { + events: None, + id, + name, + properties: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn events(mut self, value: Vec) -> Self { + self.events = Some(value); + self + } + + pub fn properties(mut self, value: serde_json::Value) -> Self { + self.properties = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for Query { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct QueryVisitor; + impl<'a> Visitor<'a> for QueryVisitor { + type Value = Query; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut events: Option> = None; + let mut id: Option = None; + let mut name: Option = None; + let mut properties: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "events" => { + if v.is_null() { + continue; + } + events = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "properties" => { + if v.is_null() { + continue; + } + properties = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::QueryType::UnparsedObject(_type_) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let name = name.ok_or_else(|| M::Error::missing_field("name"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = Query { + events, + id, + name, + properties, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(QueryVisitor) + } +} diff --git a/src/datadogV2/model/model_query_type.rs b/src/datadogV2/model/model_query_type.rs new file mode 100644 index 000000000..b0f11af15 --- /dev/null +++ b/src/datadogV2/model/model_query_type.rs @@ -0,0 +1,54 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum QueryType { + ACTION, + STATEVARIABLE, + DATATRANSFORM, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for QueryType { + fn to_string(&self) -> String { + match self { + Self::ACTION => String::from("action"), + Self::STATEVARIABLE => String::from("stateVariable"), + Self::DATATRANSFORM => String::from("dataTransform"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for QueryType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for QueryType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "action" => Self::ACTION, + "stateVariable" => Self::STATEVARIABLE, + "dataTransform" => Self::DATATRANSFORM, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_script.rs b/src/datadogV2/model/model_script.rs new file mode 100644 index 000000000..af656f432 --- /dev/null +++ b/src/datadogV2/model/model_script.rs @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `Script` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct Script { + /// The definition of `ScriptData` object. + #[serde(rename = "data")] + pub data: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl Script { + pub fn new() -> Script { + Script { + data: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: crate::datadogV2::model::ScriptData) -> Self { + self.data = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for Script { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for Script { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ScriptVisitor; + impl<'a> Visitor<'a> for ScriptVisitor { + type Value = Script; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = Script { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ScriptVisitor) + } +} diff --git a/src/datadogV2/model/model_script_data.rs b/src/datadogV2/model/model_script_data.rs new file mode 100644 index 000000000..587926c66 --- /dev/null +++ b/src/datadogV2/model/model_script_data.rs @@ -0,0 +1,149 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `ScriptData` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ScriptData { + /// The definition of `ScriptDataAttributes` object. + #[serde(rename = "attributes")] + pub attributes: Option, + /// The `data` `id`. + #[serde(rename = "id")] + pub id: Option, + /// The definition of `ScriptDataType` object. + #[serde(rename = "type")] + pub type_: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ScriptData { + pub fn new() -> ScriptData { + ScriptData { + attributes: None, + id: None, + type_: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes(mut self, value: crate::datadogV2::model::ScriptDataAttributes) -> Self { + self.attributes = Some(value); + self + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn type_(mut self, value: crate::datadogV2::model::ScriptDataType) -> Self { + self.type_ = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for ScriptData { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for ScriptData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ScriptDataVisitor; + impl<'a> Visitor<'a> for ScriptDataVisitor { + type Value = ScriptData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option = None; + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + if v.is_null() { + continue; + } + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + if v.is_null() { + continue; + } + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::ScriptDataType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = ScriptData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ScriptDataVisitor) + } +} diff --git a/src/datadogV2/model/model_script_data_attributes.rs b/src/datadogV2/model/model_script_data_attributes.rs new file mode 100644 index 000000000..4181b8383 --- /dev/null +++ b/src/datadogV2/model/model_script_data_attributes.rs @@ -0,0 +1,139 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `ScriptDataAttributes` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ScriptDataAttributes { + /// The `attributes` `name`. + #[serde(rename = "name")] + pub name: Option, + /// The `attributes` `src`. + #[serde(rename = "src")] + pub src: Option, + /// The `attributes` `type`. + #[serde(rename = "type")] + pub type_: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ScriptDataAttributes { + pub fn new() -> ScriptDataAttributes { + ScriptDataAttributes { + name: None, + src: None, + type_: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn src(mut self, value: String) -> Self { + self.src = Some(value); + self + } + + pub fn type_(mut self, value: String) -> Self { + self.type_ = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for ScriptDataAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for ScriptDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ScriptDataAttributesVisitor; + impl<'a> Visitor<'a> for ScriptDataAttributesVisitor { + type Value = ScriptDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut name: Option = None; + let mut src: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "src" => { + if v.is_null() { + continue; + } + src = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + if v.is_null() { + continue; + } + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = ScriptDataAttributes { + name, + src, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ScriptDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_script_data_type.rs b/src/datadogV2/model/model_script_data_type.rs new file mode 100644 index 000000000..53ab43d20 --- /dev/null +++ b/src/datadogV2/model/model_script_data_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum ScriptDataType { + SCRIPTS, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for ScriptDataType { + fn to_string(&self) -> String { + match self { + Self::SCRIPTS => String::from("scripts"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for ScriptDataType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for ScriptDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "scripts" => Self::SCRIPTS, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_update_app_request.rs b/src/datadogV2/model/model_update_app_request.rs new file mode 100644 index 000000000..4103d111a --- /dev/null +++ b/src/datadogV2/model/model_update_app_request.rs @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `UpdateAppRequest` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct UpdateAppRequest { + /// The definition of `UpdateAppRequestData` object. + #[serde(rename = "data")] + pub data: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl UpdateAppRequest { + pub fn new() -> UpdateAppRequest { + UpdateAppRequest { + data: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: crate::datadogV2::model::UpdateAppRequestData) -> Self { + self.data = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for UpdateAppRequest { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for UpdateAppRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct UpdateAppRequestVisitor; + impl<'a> Visitor<'a> for UpdateAppRequestVisitor { + type Value = UpdateAppRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = UpdateAppRequest { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(UpdateAppRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_update_app_request_data.rs b/src/datadogV2/model/model_update_app_request_data.rs new file mode 100644 index 000000000..b58b70629 --- /dev/null +++ b/src/datadogV2/model/model_update_app_request_data.rs @@ -0,0 +1,139 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `UpdateAppRequestData` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct UpdateAppRequestData { + /// The definition of `UpdateAppRequestDataAttributes` object. + #[serde(rename = "attributes")] + pub attributes: Option, + /// The `data` `id`. + #[serde(rename = "id")] + pub id: Option, + /// The definition of `UpdateAppRequestDataType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::UpdateAppRequestDataType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl UpdateAppRequestData { + pub fn new(type_: crate::datadogV2::model::UpdateAppRequestDataType) -> UpdateAppRequestData { + UpdateAppRequestData { + attributes: None, + id: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes( + mut self, + value: crate::datadogV2::model::UpdateAppRequestDataAttributes, + ) -> Self { + self.attributes = Some(value); + self + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for UpdateAppRequestData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct UpdateAppRequestDataVisitor; + impl<'a> Visitor<'a> for UpdateAppRequestDataVisitor { + type Value = UpdateAppRequestData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::UpdateAppRequestDataAttributes, + > = None; + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + if v.is_null() { + continue; + } + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::UpdateAppRequestDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = UpdateAppRequestData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(UpdateAppRequestDataVisitor) + } +} diff --git a/src/datadogV2/model/model_update_app_request_data_attributes.rs b/src/datadogV2/model/model_update_app_request_data_attributes.rs new file mode 100644 index 000000000..28d184fb4 --- /dev/null +++ b/src/datadogV2/model/model_update_app_request_data_attributes.rs @@ -0,0 +1,228 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `UpdateAppRequestDataAttributes` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct UpdateAppRequestDataAttributes { + /// The `attributes` `components`. + #[serde(rename = "components")] + pub components: Option>, + /// The `attributes` `description`. + #[serde(rename = "description")] + pub description: Option, + /// The `attributes` `embeddedQueries`. + #[serde(rename = "embeddedQueries")] + pub embedded_queries: Option>, + /// The definition of `InputSchema` object. + #[serde(rename = "inputSchema")] + pub input_schema: Option, + /// The `attributes` `name`. + #[serde(rename = "name")] + pub name: Option, + /// The `attributes` `rootInstanceName`. + #[serde(rename = "rootInstanceName")] + pub root_instance_name: Option, + /// The `attributes` `scripts`. + #[serde(rename = "scripts")] + pub scripts: Option>, + /// The `attributes` `tags`. + #[serde(rename = "tags")] + pub tags: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl UpdateAppRequestDataAttributes { + pub fn new() -> UpdateAppRequestDataAttributes { + UpdateAppRequestDataAttributes { + components: None, + description: None, + embedded_queries: None, + input_schema: None, + name: None, + root_instance_name: None, + scripts: None, + tags: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn components(mut self, value: Vec) -> Self { + self.components = Some(value); + self + } + + pub fn description(mut self, value: String) -> Self { + self.description = Some(value); + self + } + + pub fn embedded_queries(mut self, value: Vec) -> Self { + self.embedded_queries = Some(value); + self + } + + pub fn input_schema(mut self, value: crate::datadogV2::model::InputSchema) -> Self { + self.input_schema = Some(value); + self + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn root_instance_name(mut self, value: String) -> Self { + self.root_instance_name = Some(value); + self + } + + pub fn scripts(mut self, value: Vec) -> Self { + self.scripts = Some(value); + self + } + + pub fn tags(mut self, value: Vec) -> Self { + self.tags = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for UpdateAppRequestDataAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for UpdateAppRequestDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct UpdateAppRequestDataAttributesVisitor; + impl<'a> Visitor<'a> for UpdateAppRequestDataAttributesVisitor { + type Value = UpdateAppRequestDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut components: Option> = None; + let mut description: Option = None; + let mut embedded_queries: Option> = None; + let mut input_schema: Option = None; + let mut name: Option = None; + let mut root_instance_name: Option = None; + let mut scripts: Option> = None; + let mut tags: Option> = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "components" => { + if v.is_null() { + continue; + } + components = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "description" => { + if v.is_null() { + continue; + } + description = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "embeddedQueries" => { + if v.is_null() { + continue; + } + embedded_queries = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "inputSchema" => { + if v.is_null() { + continue; + } + input_schema = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "rootInstanceName" => { + if v.is_null() { + continue; + } + root_instance_name = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "scripts" => { + if v.is_null() { + continue; + } + scripts = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "tags" => { + if v.is_null() { + continue; + } + tags = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = UpdateAppRequestDataAttributes { + components, + description, + embedded_queries, + input_schema, + name, + root_instance_name, + scripts, + tags, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(UpdateAppRequestDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_update_app_request_data_type.rs b/src/datadogV2/model/model_update_app_request_data_type.rs new file mode 100644 index 000000000..6d9021318 --- /dev/null +++ b/src/datadogV2/model/model_update_app_request_data_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum UpdateAppRequestDataType { + APPDEFINITIONS, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for UpdateAppRequestDataType { + fn to_string(&self) -> String { + match self { + Self::APPDEFINITIONS => String::from("appDefinitions"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for UpdateAppRequestDataType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for UpdateAppRequestDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "appDefinitions" => Self::APPDEFINITIONS, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_update_app_response.rs b/src/datadogV2/model/model_update_app_response.rs new file mode 100644 index 000000000..91f40efc6 --- /dev/null +++ b/src/datadogV2/model/model_update_app_response.rs @@ -0,0 +1,162 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `UpdateAppResponse` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct UpdateAppResponse { + /// The definition of `UpdateAppResponseData` object. + #[serde(rename = "data")] + pub data: Option, + /// The `UpdateAppResponse` `included`. + #[serde(rename = "included")] + pub included: Option>, + /// The definition of `AppMeta` object. + #[serde(rename = "meta")] + pub meta: Option, + /// The definition of `UpdateAppResponseRelationship` object. + #[serde(rename = "relationship")] + pub relationship: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl UpdateAppResponse { + pub fn new() -> UpdateAppResponse { + UpdateAppResponse { + data: None, + included: None, + meta: None, + relationship: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: crate::datadogV2::model::UpdateAppResponseData) -> Self { + self.data = Some(value); + self + } + + pub fn included(mut self, value: Vec) -> Self { + self.included = Some(value); + self + } + + pub fn meta(mut self, value: crate::datadogV2::model::AppMeta) -> Self { + self.meta = Some(value); + self + } + + pub fn relationship( + mut self, + value: crate::datadogV2::model::UpdateAppResponseRelationship, + ) -> Self { + self.relationship = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for UpdateAppResponse { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for UpdateAppResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct UpdateAppResponseVisitor; + impl<'a> Visitor<'a> for UpdateAppResponseVisitor { + type Value = UpdateAppResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut included: Option> = None; + let mut meta: Option = None; + let mut relationship: Option< + crate::datadogV2::model::UpdateAppResponseRelationship, + > = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "included" => { + if v.is_null() { + continue; + } + included = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "meta" => { + if v.is_null() { + continue; + } + meta = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "relationship" => { + if v.is_null() { + continue; + } + relationship = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = UpdateAppResponse { + data, + included, + meta, + relationship, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(UpdateAppResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_update_app_response_data.rs b/src/datadogV2/model/model_update_app_response_data.rs new file mode 100644 index 000000000..849552d4c --- /dev/null +++ b/src/datadogV2/model/model_update_app_response_data.rs @@ -0,0 +1,126 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `UpdateAppResponseData` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct UpdateAppResponseData { + /// The definition of `UpdateAppResponseDataAttributes` object. + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::UpdateAppResponseDataAttributes, + /// The `data` `id`. + #[serde(rename = "id")] + pub id: String, + /// The definition of `UpdateAppResponseDataType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::UpdateAppResponseDataType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl UpdateAppResponseData { + pub fn new( + attributes: crate::datadogV2::model::UpdateAppResponseDataAttributes, + id: String, + type_: crate::datadogV2::model::UpdateAppResponseDataType, + ) -> UpdateAppResponseData { + UpdateAppResponseData { + attributes, + id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for UpdateAppResponseData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct UpdateAppResponseDataVisitor; + impl<'a> Visitor<'a> for UpdateAppResponseDataVisitor { + type Value = UpdateAppResponseData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::UpdateAppResponseDataAttributes, + > = None; + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::UpdateAppResponseDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = UpdateAppResponseData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(UpdateAppResponseDataVisitor) + } +} diff --git a/src/datadogV2/model/model_update_app_response_data_attributes.rs b/src/datadogV2/model/model_update_app_response_data_attributes.rs new file mode 100644 index 000000000..4e92f96bc --- /dev/null +++ b/src/datadogV2/model/model_update_app_response_data_attributes.rs @@ -0,0 +1,245 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `UpdateAppResponseDataAttributes` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct UpdateAppResponseDataAttributes { + /// The `attributes` `components`. + #[serde(rename = "components")] + pub components: Option>, + /// The `attributes` `description`. + #[serde(rename = "description")] + pub description: Option, + /// The `attributes` `embeddedQueries`. + #[serde(rename = "embeddedQueries")] + pub embedded_queries: Option>, + /// The `attributes` `favorite`. + #[serde(rename = "favorite")] + pub favorite: Option, + /// The definition of `InputSchema` object. + #[serde(rename = "inputSchema")] + pub input_schema: Option, + /// The `attributes` `name`. + #[serde(rename = "name")] + pub name: Option, + /// The `attributes` `rootInstanceName`. + #[serde(rename = "rootInstanceName")] + pub root_instance_name: Option, + /// The `attributes` `scripts`. + #[serde(rename = "scripts")] + pub scripts: Option>, + /// The `attributes` `tags`. + #[serde(rename = "tags")] + pub tags: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl UpdateAppResponseDataAttributes { + pub fn new() -> UpdateAppResponseDataAttributes { + UpdateAppResponseDataAttributes { + components: None, + description: None, + embedded_queries: None, + favorite: None, + input_schema: None, + name: None, + root_instance_name: None, + scripts: None, + tags: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn components(mut self, value: Vec) -> Self { + self.components = Some(value); + self + } + + pub fn description(mut self, value: String) -> Self { + self.description = Some(value); + self + } + + pub fn embedded_queries(mut self, value: Vec) -> Self { + self.embedded_queries = Some(value); + self + } + + pub fn favorite(mut self, value: bool) -> Self { + self.favorite = Some(value); + self + } + + pub fn input_schema(mut self, value: crate::datadogV2::model::InputSchema) -> Self { + self.input_schema = Some(value); + self + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn root_instance_name(mut self, value: String) -> Self { + self.root_instance_name = Some(value); + self + } + + pub fn scripts(mut self, value: Vec) -> Self { + self.scripts = Some(value); + self + } + + pub fn tags(mut self, value: Vec) -> Self { + self.tags = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for UpdateAppResponseDataAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for UpdateAppResponseDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct UpdateAppResponseDataAttributesVisitor; + impl<'a> Visitor<'a> for UpdateAppResponseDataAttributesVisitor { + type Value = UpdateAppResponseDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut components: Option> = None; + let mut description: Option = None; + let mut embedded_queries: Option> = None; + let mut favorite: Option = None; + let mut input_schema: Option = None; + let mut name: Option = None; + let mut root_instance_name: Option = None; + let mut scripts: Option> = None; + let mut tags: Option> = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "components" => { + if v.is_null() { + continue; + } + components = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "description" => { + if v.is_null() { + continue; + } + description = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "embeddedQueries" => { + if v.is_null() { + continue; + } + embedded_queries = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "favorite" => { + if v.is_null() { + continue; + } + favorite = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "inputSchema" => { + if v.is_null() { + continue; + } + input_schema = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "rootInstanceName" => { + if v.is_null() { + continue; + } + root_instance_name = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "scripts" => { + if v.is_null() { + continue; + } + scripts = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "tags" => { + if v.is_null() { + continue; + } + tags = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = UpdateAppResponseDataAttributes { + components, + description, + embedded_queries, + favorite, + input_schema, + name, + root_instance_name, + scripts, + tags, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(UpdateAppResponseDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_update_app_response_data_type.rs b/src/datadogV2/model/model_update_app_response_data_type.rs new file mode 100644 index 000000000..e4f6610d0 --- /dev/null +++ b/src/datadogV2/model/model_update_app_response_data_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum UpdateAppResponseDataType { + APPDEFINITIONS, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for UpdateAppResponseDataType { + fn to_string(&self) -> String { + match self { + Self::APPDEFINITIONS => String::from("appDefinitions"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for UpdateAppResponseDataType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for UpdateAppResponseDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "appDefinitions" => Self::APPDEFINITIONS, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_update_app_response_relationship.rs b/src/datadogV2/model/model_update_app_response_relationship.rs new file mode 100644 index 000000000..73cc2083c --- /dev/null +++ b/src/datadogV2/model/model_update_app_response_relationship.rs @@ -0,0 +1,123 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `UpdateAppResponseRelationship` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct UpdateAppResponseRelationship { + /// The `relationship` `connections`. + #[serde(rename = "connections")] + pub connections: Option>, + /// The definition of `DeploymentRelationship` object. + #[serde(rename = "deployment")] + pub deployment: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl UpdateAppResponseRelationship { + pub fn new() -> UpdateAppResponseRelationship { + UpdateAppResponseRelationship { + connections: None, + deployment: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn connections(mut self, value: Vec) -> Self { + self.connections = Some(value); + self + } + + pub fn deployment(mut self, value: crate::datadogV2::model::DeploymentRelationship) -> Self { + self.deployment = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for UpdateAppResponseRelationship { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for UpdateAppResponseRelationship { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct UpdateAppResponseRelationshipVisitor; + impl<'a> Visitor<'a> for UpdateAppResponseRelationshipVisitor { + type Value = UpdateAppResponseRelationship; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut connections: Option> = None; + let mut deployment: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "connections" => { + if v.is_null() { + continue; + } + connections = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "deployment" => { + if v.is_null() { + continue; + } + deployment = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = UpdateAppResponseRelationship { + connections, + deployment, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(UpdateAppResponseRelationshipVisitor) + } +} diff --git a/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Bad-Request-response.frozen b/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Bad-Request-response.frozen new file mode 100644 index 000000000..70eab29e2 --- /dev/null +++ b/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2024-12-10T19:57:35.320Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Bad-Request-response.json b/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Bad-Request-response.json new file mode 100644 index 000000000..3edd87946 --- /dev/null +++ b/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Bad-Request-response.json @@ -0,0 +1,33 @@ +{ + "http_interactions": [ + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/invalid-uuid/deployment" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"detail\":\"invalid path parameter\",\"source\":{\"parameter\":\"appId\"}}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 400, + "message": "Bad Request" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:35 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Created-response.frozen b/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Created-response.frozen new file mode 100644 index 000000000..52661b934 --- /dev/null +++ b/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Created-response.frozen @@ -0,0 +1 @@ +2024-12-10T19:57:35.459Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Created-response.json b/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Created-response.json new file mode 100644 index 000000000..c0667ee5c --- /dev/null +++ b/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Created-response.json @@ -0,0 +1,95 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"components\":[{\"events\":[],\"name\":\"grid0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"gridCell0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"calloutValue0\",\"properties\":{\"isDisabled\":false,\"isLoading\":false,\"isVisible\":true,\"label\":\"CPU Usage\",\"size\":\"sm\",\"style\":\"vivid_yellow\",\"unit\":\"kB\",\"value\":\"42\"},\"type\":\"calloutValue\"}],\"isVisible\":\"true\",\"layout\":{\"default\":{\"height\":8,\"width\":2,\"x\":0,\"y\":0}}},\"type\":\"gridCell\"}]},\"type\":\"grid\"}],\"description\":\"This is a simple example app\",\"embeddedQueries\":[],\"name\":\"Example App\",\"rootInstanceName\":\"grid0\"},\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"f40f3df0-f9e5-46e9-87e4-aba789548b0b\",\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 201, + "message": "Created" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:35 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/f40f3df0-f9e5-46e9-87e4-aba789548b0b/deployment" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"21151cad-2a7c-4b14-b151-ed45916e0ee2\",\"type\":\"deployment\",\"attributes\":{\"app_version_id\":\"d5f91141-ac8f-4da5-a27f-33f1c7f4042f\"},\"meta\":{\"created_at\":\"2024-12-10T19:57:35.83889Z\",\"user_id\":15479137,\"user_uuid\":\"b3f98453-b289-11ef-a4e9-d6d283f92d91\",\"user_name\":\"oliver.li@datadoghq.com\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 201, + "message": "Created" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:35 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/f40f3df0-f9e5-46e9-87e4-aba789548b0b" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"f40f3df0-f9e5-46e9-87e4-aba789548b0b\",\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:35 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Not-Found-response.frozen b/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Not-Found-response.frozen new file mode 100644 index 000000000..c11fe09d7 --- /dev/null +++ b/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2024-12-10T19:57:35.984Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Not-Found-response.json b/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Not-Found-response.json new file mode 100644 index 000000000..973dda706 --- /dev/null +++ b/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Not-Found-response.json @@ -0,0 +1,33 @@ +{ + "http_interactions": [ + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/7addb29b-f935-472c-ae79-d1963979a23e/deployment" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"detail\":\"app not found\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 404, + "message": "Not Found" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:35 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Bad-Request-response.frozen b/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Bad-Request-response.frozen new file mode 100644 index 000000000..bf3af7629 --- /dev/null +++ b/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2024-12-10T19:57:36.091Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Bad-Request-response.json b/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Bad-Request-response.json new file mode 100644 index 000000000..bcf179101 --- /dev/null +++ b/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Bad-Request-response.json @@ -0,0 +1,33 @@ +{ + "http_interactions": [ + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/invalid-uuid/deployment" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"detail\":\"invalid path parameter\",\"source\":{\"parameter\":\"appId\"}}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 400, + "message": "Bad Request" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:36 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Not-Found-response.frozen b/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Not-Found-response.frozen new file mode 100644 index 000000000..8dc6b57d7 --- /dev/null +++ b/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2024-12-10T19:57:36.179Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Not-Found-response.json b/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Not-Found-response.json new file mode 100644 index 000000000..9f596d72c --- /dev/null +++ b/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Not-Found-response.json @@ -0,0 +1,33 @@ +{ + "http_interactions": [ + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/7addb29b-f935-472c-ae79-d1963979a23e/deployment" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"detail\":\"app not found\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 404, + "message": "Not Found" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:36 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-OK-response.frozen new file mode 100644 index 000000000..433052b1a --- /dev/null +++ b/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-OK-response.frozen @@ -0,0 +1 @@ +2024-12-10T19:57:36.281Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-OK-response.json b/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-OK-response.json new file mode 100644 index 000000000..80669c138 --- /dev/null +++ b/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-OK-response.json @@ -0,0 +1,95 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"components\":[{\"events\":[],\"name\":\"grid0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"gridCell0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"calloutValue0\",\"properties\":{\"isDisabled\":false,\"isLoading\":false,\"isVisible\":true,\"label\":\"CPU Usage\",\"size\":\"sm\",\"style\":\"vivid_yellow\",\"unit\":\"kB\",\"value\":\"42\"},\"type\":\"calloutValue\"}],\"isVisible\":\"true\",\"layout\":{\"default\":{\"height\":8,\"width\":2,\"x\":0,\"y\":0}}},\"type\":\"gridCell\"}]},\"type\":\"grid\"}],\"description\":\"This is a simple example app\",\"embeddedQueries\":[],\"name\":\"Example App\",\"rootInstanceName\":\"grid0\"},\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"10fe8156-fe6b-4dbd-b0b6-8dc08e072b1d\",\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 201, + "message": "Created" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:36 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/10fe8156-fe6b-4dbd-b0b6-8dc08e072b1d/deployment" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"1d3fc23b-d099-4646-b5bd-2c8e419f82aa\",\"type\":\"deployment\",\"attributes\":{\"app_version_id\":\"00000000-0000-0000-0000-000000000000\"},\"meta\":{\"created_at\":\"2024-12-10T19:57:36.674239Z\",\"user_id\":15479137,\"user_uuid\":\"b3f98453-b289-11ef-a4e9-d6d283f92d91\",\"user_name\":\"oliver.li@datadoghq.com\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:36 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/10fe8156-fe6b-4dbd-b0b6-8dc08e072b1d" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"10fe8156-fe6b-4dbd-b0b6-8dc08e072b1d\",\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:36 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Create-App-returns-App-Created-response.frozen b/tests/scenarios/cassettes/v2/apps/Create-App-returns-App-Created-response.frozen new file mode 100644 index 000000000..e9cd9f816 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Create-App-returns-App-Created-response.frozen @@ -0,0 +1 @@ +2024-12-10T19:57:09.544Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Create-App-returns-App-Created-response.json b/tests/scenarios/cassettes/v2/apps/Create-App-returns-App-Created-response.json new file mode 100644 index 000000000..2f3b5c9ff --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Create-App-returns-App-Created-response.json @@ -0,0 +1,67 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"components\":[{\"events\":[],\"name\":\"grid0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"gridCell0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"calloutValue0\",\"properties\":{\"isDisabled\":false,\"isLoading\":false,\"isVisible\":true,\"label\":\"CPU Usage\",\"size\":\"sm\",\"style\":\"vivid_yellow\",\"unit\":\"kB\",\"value\":\"42\"},\"type\":\"calloutValue\"}],\"isVisible\":\"true\",\"layout\":{\"default\":{\"height\":8,\"width\":2,\"x\":0,\"y\":0}}},\"type\":\"gridCell\"}]},\"type\":\"grid\"}],\"description\":\"This is a simple example app\",\"embeddedQueries\":[],\"name\":\"Example App\",\"rootInstanceName\":\"grid0\"},\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"7189aab4-a57b-4709-95b2-e5d8dd9937df\",\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 201, + "message": "Created" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:09 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/7189aab4-a57b-4709-95b2-e5d8dd9937df" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"7189aab4-a57b-4709-95b2-e5d8dd9937df\",\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:09 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Create-App-returns-Bad-Request-response.frozen b/tests/scenarios/cassettes/v2/apps/Create-App-returns-Bad-Request-response.frozen new file mode 100644 index 000000000..5912dc344 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Create-App-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2024-12-10T19:57:10.031Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Create-App-returns-Bad-Request-response.json b/tests/scenarios/cassettes/v2/apps/Create-App-returns-Bad-Request-response.json new file mode 100644 index 000000000..e834634c8 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Create-App-returns-Bad-Request-response.json @@ -0,0 +1,39 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"description\":\"This is a bad example app\",\"embeddedQueries\":[],\"rootInstanceName\":\"grid0\"},\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"detail\":\"missing required field\",\"source\":{\"pointer\":\"/data/attributes/name\"}}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 400, + "message": "Bad Request" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:10 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Delete-App-returns-Bad-Request-response.frozen b/tests/scenarios/cassettes/v2/apps/Delete-App-returns-Bad-Request-response.frozen new file mode 100644 index 000000000..3925b1b25 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Delete-App-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2024-12-10T19:57:10.128Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Delete-App-returns-Bad-Request-response.json b/tests/scenarios/cassettes/v2/apps/Delete-App-returns-Bad-Request-response.json new file mode 100644 index 000000000..b94026f89 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Delete-App-returns-Bad-Request-response.json @@ -0,0 +1,33 @@ +{ + "http_interactions": [ + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/bad-app-id" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"detail\":\"invalid path parameter\",\"source\":{\"parameter\":\"appId\"}}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 400, + "message": "Bad Request" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:10 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Delete-App-returns-Not-Found-response.frozen b/tests/scenarios/cassettes/v2/apps/Delete-App-returns-Not-Found-response.frozen new file mode 100644 index 000000000..cfa34bd9b --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Delete-App-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2024-12-10T19:57:10.225Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Delete-App-returns-Not-Found-response.json b/tests/scenarios/cassettes/v2/apps/Delete-App-returns-Not-Found-response.json new file mode 100644 index 000000000..1fa48dc29 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Delete-App-returns-Not-Found-response.json @@ -0,0 +1,33 @@ +{ + "http_interactions": [ + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/7addb29b-f935-472c-ae79-d1963979a23e" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"detail\":\"app not found\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 404, + "message": "Not Found" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:10 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Delete-App-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/apps/Delete-App-returns-OK-response.frozen new file mode 100644 index 000000000..1e1440d65 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Delete-App-returns-OK-response.frozen @@ -0,0 +1 @@ +2024-12-10T19:57:10.331Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Delete-App-returns-OK-response.json b/tests/scenarios/cassettes/v2/apps/Delete-App-returns-OK-response.json new file mode 100644 index 000000000..7ccbbe915 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Delete-App-returns-OK-response.json @@ -0,0 +1,95 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"components\":[{\"events\":[],\"name\":\"grid0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"gridCell0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"calloutValue0\",\"properties\":{\"isDisabled\":false,\"isLoading\":false,\"isVisible\":true,\"label\":\"CPU Usage\",\"size\":\"sm\",\"style\":\"vivid_yellow\",\"unit\":\"kB\",\"value\":\"42\"},\"type\":\"calloutValue\"}],\"isVisible\":\"true\",\"layout\":{\"default\":{\"height\":8,\"width\":2,\"x\":0,\"y\":0}}},\"type\":\"gridCell\"}]},\"type\":\"grid\"}],\"description\":\"This is a simple example app\",\"embeddedQueries\":[],\"name\":\"Example App\",\"rootInstanceName\":\"grid0\"},\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"31966edc-cbbc-4f12-91c1-c179a1d6f7bd\",\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 201, + "message": "Created" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:10 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/31966edc-cbbc-4f12-91c1-c179a1d6f7bd" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"31966edc-cbbc-4f12-91c1-c179a1d6f7bd\",\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:10 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/31966edc-cbbc-4f12-91c1-c179a1d6f7bd" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"detail\":\"app not found\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 404, + "message": "Not Found" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:10 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Bad-Request-response.frozen b/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Bad-Request-response.frozen new file mode 100644 index 000000000..47c84b21b --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2024-12-10T19:57:10.845Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Bad-Request-response.json b/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Bad-Request-response.json new file mode 100644 index 000000000..f92a0f7b4 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Bad-Request-response.json @@ -0,0 +1,39 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":[{\"id\":\"71c0d358-eac5-41e3-892d-a7467571b9b\",\"type\":\"appDefinitions\"},{\"id\":\"71c0d358-eac5-41e3-892d-a7467571b9b0\",\"type\":\"appDefinitions\"},{\"id\":\"98e7e44d-1562-474a-90f7-3a94e739c006\",\"type\":\"appDefinitions\"}]}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"status\":\"400\",\"title\":\"Bad Request\",\"detail\":\"invalid UUID length: 35\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 400, + "message": "Bad Request" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:10 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Not-Found-response.frozen b/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Not-Found-response.frozen new file mode 100644 index 000000000..0fbfbe769 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2024-12-10T19:57:10.942Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Not-Found-response.json b/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Not-Found-response.json new file mode 100644 index 000000000..0264cf115 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Not-Found-response.json @@ -0,0 +1,39 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":[{\"id\":\"29494ddd-ac13-46a7-8558-b05b050ee755\",\"type\":\"appDefinitions\"},{\"id\":\"71c0d358-eac5-41e3-892d-a7467571b9b0\",\"type\":\"appDefinitions\"},{\"id\":\"98e7e44d-1562-474a-90f7-3a94e739c006\",\"type\":\"appDefinitions\"}]}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"detail\":\"one or more apps not found\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 404, + "message": "Not Found" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:10 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-OK-response.frozen new file mode 100644 index 000000000..d002ad3b4 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-OK-response.frozen @@ -0,0 +1 @@ +2024-12-10T19:57:11.041Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-OK-response.json b/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-OK-response.json new file mode 100644 index 000000000..ad3f10729 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-OK-response.json @@ -0,0 +1,101 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"components\":[{\"events\":[],\"name\":\"grid0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"gridCell0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"calloutValue0\",\"properties\":{\"isDisabled\":false,\"isLoading\":false,\"isVisible\":true,\"label\":\"CPU Usage\",\"size\":\"sm\",\"style\":\"vivid_yellow\",\"unit\":\"kB\",\"value\":\"42\"},\"type\":\"calloutValue\"}],\"isVisible\":\"true\",\"layout\":{\"default\":{\"height\":8,\"width\":2,\"x\":0,\"y\":0}}},\"type\":\"gridCell\"}]},\"type\":\"grid\"}],\"description\":\"This is a simple example app\",\"embeddedQueries\":[],\"name\":\"Example App\",\"rootInstanceName\":\"grid0\"},\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"c582f723-26c4-4b98-9a4e-cb14e756450e\",\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 201, + "message": "Created" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:11 GMT" + }, + { + "request": { + "body": { + "string": "{\"data\":[{\"id\":\"c582f723-26c4-4b98-9a4e-cb14e756450e\",\"type\":\"appDefinitions\"}]}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" + }, + "response": { + "body": { + "string": "{\"data\":[{\"id\":\"c582f723-26c4-4b98-9a4e-cb14e756450e\",\"type\":\"appDefinitions\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:11 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/c582f723-26c4-4b98-9a4e-cb14e756450e" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"detail\":\"app not found\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 404, + "message": "Not Found" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:11 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Get-App-returns-Bad-Request-response.frozen b/tests/scenarios/cassettes/v2/apps/Get-App-returns-Bad-Request-response.frozen new file mode 100644 index 000000000..9a1b4493f --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Get-App-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2024-12-10T19:57:11.519Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Get-App-returns-Bad-Request-response.json b/tests/scenarios/cassettes/v2/apps/Get-App-returns-Bad-Request-response.json new file mode 100644 index 000000000..4d47e8159 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Get-App-returns-Bad-Request-response.json @@ -0,0 +1,33 @@ +{ + "http_interactions": [ + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "get", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/invalid-uuid" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"detail\":\"invalid path parameter\",\"source\":{\"parameter\":\"appId\"}}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 400, + "message": "Bad Request" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:11 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Get-App-returns-Not-Found-response.frozen b/tests/scenarios/cassettes/v2/apps/Get-App-returns-Not-Found-response.frozen new file mode 100644 index 000000000..0d42c7607 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Get-App-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2024-12-10T19:57:11.612Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Get-App-returns-Not-Found-response.json b/tests/scenarios/cassettes/v2/apps/Get-App-returns-Not-Found-response.json new file mode 100644 index 000000000..a83cb8847 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Get-App-returns-Not-Found-response.json @@ -0,0 +1,33 @@ +{ + "http_interactions": [ + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "get", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/7addb29b-f935-472c-ae79-d1963979a23e" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"detail\":\"app not found\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 404, + "message": "Not Found" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:11 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Get-App-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/apps/Get-App-returns-OK-response.frozen new file mode 100644 index 000000000..285af0bd6 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Get-App-returns-OK-response.frozen @@ -0,0 +1 @@ +2024-12-10T19:57:11.740Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Get-App-returns-OK-response.json b/tests/scenarios/cassettes/v2/apps/Get-App-returns-OK-response.json new file mode 100644 index 000000000..368071ef7 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Get-App-returns-OK-response.json @@ -0,0 +1,95 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"components\":[{\"events\":[],\"name\":\"grid0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"gridCell0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"calloutValue0\",\"properties\":{\"isDisabled\":false,\"isLoading\":false,\"isVisible\":true,\"label\":\"CPU Usage\",\"size\":\"sm\",\"style\":\"vivid_yellow\",\"unit\":\"kB\",\"value\":\"42\"},\"type\":\"calloutValue\"}],\"isVisible\":\"true\",\"layout\":{\"default\":{\"height\":8,\"width\":2,\"x\":0,\"y\":0}}},\"type\":\"gridCell\"}]},\"type\":\"grid\"}],\"description\":\"This is a simple example app\",\"embeddedQueries\":[],\"name\":\"Example App\",\"rootInstanceName\":\"grid0\"},\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"810bb071-15a9-40bd-a7ff-d3811f171610\",\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 201, + "message": "Created" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:11 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "get", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/810bb071-15a9-40bd-a7ff-d3811f171610" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"810bb071-15a9-40bd-a7ff-d3811f171610\",\"type\":\"appDefinitions\",\"attributes\":{\"components\":[{\"events\":[],\"name\":\"grid0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"gridCell0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"calloutValue0\",\"properties\":{\"isDisabled\":false,\"isLoading\":false,\"isVisible\":true,\"label\":\"CPU Usage\",\"size\":\"sm\",\"style\":\"vivid_yellow\",\"unit\":\"kB\",\"value\":\"42\"},\"type\":\"calloutValue\"}],\"isVisible\":\"true\",\"layout\":{\"default\":{\"height\":8,\"width\":2,\"x\":0,\"y\":0}}},\"type\":\"gridCell\"}]},\"type\":\"grid\"}],\"description\":\"This is a simple example app\",\"embeddedQueries\":[],\"favorite\":false,\"name\":\"Example App\",\"rootInstanceName\":\"grid0\",\"selfService\":false,\"tags\":[]},\"meta\":{\"org_id\":1107852,\"user_id\":15479137,\"user_uuid\":\"b3f98453-b289-11ef-a4e9-d6d283f92d91\",\"user_name\":\"oliver.li@datadoghq.com\",\"version\":1,\"updated_since_deployment\":false,\"created_at\":\"2024-12-10T19:57:11.9304Z\",\"updated_at\":\"2024-12-10T19:57:11.9304Z\",\"deleted_at\":\"0001-01-01T00:00:00Z\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:11 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/810bb071-15a9-40bd-a7ff-d3811f171610" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"810bb071-15a9-40bd-a7ff-d3811f171610\",\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:11 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/List-Apps-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/apps/List-Apps-returns-OK-response.frozen new file mode 100644 index 000000000..1cb2468dc --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/List-Apps-returns-OK-response.frozen @@ -0,0 +1 @@ +2024-12-10T19:57:12.227Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/List-Apps-returns-OK-response.json b/tests/scenarios/cassettes/v2/apps/List-Apps-returns-OK-response.json new file mode 100644 index 000000000..ec7b8dc71 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/List-Apps-returns-OK-response.json @@ -0,0 +1,33 @@ +{ + "http_interactions": [ + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "get", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" + }, + "response": { + "body": { + "string": "{\"data\":[{\"id\":\"d595693a-473d-4671-9da3-fce89e3a5c5d\",\"type\":\"appDefinitions\",\"attributes\":{\"description\":\"\",\"favorite\":false,\"name\":\"Max's App Fri, Jul 12, 11:10:35 am\",\"selfService\":false,\"tags\":[]},\"meta\":{\"org_id\":1107852,\"user_id\":7571362,\"user_uuid\":\"3114f3a0-3fc9-11ef-acbe-a6def6551924\",\"user_name\":\"max.gale@datadoghq.com\",\"version\":0,\"updated_since_deployment\":false,\"created_at\":\"2024-07-12T15:10:48.690305Z\",\"updated_at\":\"2024-07-12T15:10:48.690305Z\",\"deleted_at\":\"0001-01-01T00:00:00Z\"}}],\"meta\":{\"page\":{\"totalCount\":1,\"totalFilteredCount\":1}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:12 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Update-App-returns-Bad-Request-response.frozen b/tests/scenarios/cassettes/v2/apps/Update-App-returns-Bad-Request-response.frozen new file mode 100644 index 000000000..8ec69a42f --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Update-App-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2024-12-10T19:57:12.347Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Update-App-returns-Bad-Request-response.json b/tests/scenarios/cassettes/v2/apps/Update-App-returns-Bad-Request-response.json new file mode 100644 index 000000000..05c50e2e8 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Update-App-returns-Bad-Request-response.json @@ -0,0 +1,101 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"components\":[{\"events\":[],\"name\":\"grid0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"gridCell0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"calloutValue0\",\"properties\":{\"isDisabled\":false,\"isLoading\":false,\"isVisible\":true,\"label\":\"CPU Usage\",\"size\":\"sm\",\"style\":\"vivid_yellow\",\"unit\":\"kB\",\"value\":\"42\"},\"type\":\"calloutValue\"}],\"isVisible\":\"true\",\"layout\":{\"default\":{\"height\":8,\"width\":2,\"x\":0,\"y\":0}}},\"type\":\"gridCell\"}]},\"type\":\"grid\"}],\"description\":\"This is a simple example app\",\"embeddedQueries\":[],\"name\":\"Example App\",\"rootInstanceName\":\"grid0\"},\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"cbff0c31-56b6-48f7-9c4f-5a96a2358d6c\",\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 201, + "message": "Created" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:12 GMT" + }, + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"rootInstanceName\":\"\"},\"id\":\"cbff0c31-56b6-48f7-9c4f-5a96a2358d6c\",\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "patch", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/cbff0c31-56b6-48f7-9c4f-5a96a2358d6c" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"detail\":\"missing required field\",\"source\":{\"pointer\":\"/data/attributes/rootInstanceName\"}}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 400, + "message": "Bad Request" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:12 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/cbff0c31-56b6-48f7-9c4f-5a96a2358d6c" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"cbff0c31-56b6-48f7-9c4f-5a96a2358d6c\",\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:12 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Update-App-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/apps/Update-App-returns-OK-response.frozen new file mode 100644 index 000000000..f6a0202ba --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Update-App-returns-OK-response.frozen @@ -0,0 +1 @@ +2024-12-10T19:57:12.823Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Update-App-returns-OK-response.json b/tests/scenarios/cassettes/v2/apps/Update-App-returns-OK-response.json new file mode 100644 index 000000000..0c77d8ea0 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Update-App-returns-OK-response.json @@ -0,0 +1,101 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"components\":[{\"events\":[],\"name\":\"grid0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"gridCell0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"calloutValue0\",\"properties\":{\"isDisabled\":false,\"isLoading\":false,\"isVisible\":true,\"label\":\"CPU Usage\",\"size\":\"sm\",\"style\":\"vivid_yellow\",\"unit\":\"kB\",\"value\":\"42\"},\"type\":\"calloutValue\"}],\"isVisible\":\"true\",\"layout\":{\"default\":{\"height\":8,\"width\":2,\"x\":0,\"y\":0}}},\"type\":\"gridCell\"}]},\"type\":\"grid\"}],\"description\":\"This is a simple example app\",\"embeddedQueries\":[],\"name\":\"Example App\",\"rootInstanceName\":\"grid0\"},\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"291d8084-0383-4e59-b17c-ef0c0d7e6532\",\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 201, + "message": "Created" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:12 GMT" + }, + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"name\":\"Updated Name\",\"rootInstanceName\":\"grid0\"},\"id\":\"291d8084-0383-4e59-b17c-ef0c0d7e6532\",\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "patch", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/291d8084-0383-4e59-b17c-ef0c0d7e6532" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"291d8084-0383-4e59-b17c-ef0c0d7e6532\",\"type\":\"appDefinitions\",\"attributes\":{\"components\":[{\"events\":[],\"name\":\"grid0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"gridCell0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"calloutValue0\",\"properties\":{\"isDisabled\":false,\"isLoading\":false,\"isVisible\":true,\"label\":\"CPU Usage\",\"size\":\"sm\",\"style\":\"vivid_yellow\",\"unit\":\"kB\",\"value\":\"42\"},\"type\":\"calloutValue\"}],\"isVisible\":\"true\",\"layout\":{\"default\":{\"height\":8,\"width\":2,\"x\":0,\"y\":0}}},\"type\":\"gridCell\"}]},\"type\":\"grid\"}],\"description\":\"This is a simple example app\",\"embeddedQueries\":[],\"favorite\":false,\"name\":\"Updated Name\",\"rootInstanceName\":\"grid0\",\"selfService\":false,\"tags\":[]},\"meta\":{\"org_id\":1107852,\"user_id\":15479137,\"user_uuid\":\"b3f98453-b289-11ef-a4e9-d6d283f92d91\",\"user_name\":\"oliver.li@datadoghq.com\",\"version\":2,\"updated_since_deployment\":false,\"created_at\":\"2024-12-10T19:57:13.001527Z\",\"updated_at\":\"2024-12-10T19:57:13.188796Z\",\"deleted_at\":\"0001-01-01T00:00:00Z\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:12 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/291d8084-0383-4e59-b17c-ef0c0d7e6532" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"291d8084-0383-4e59-b17c-ef0c0d7e6532\",\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:12 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/features/v2/app_deployment.feature b/tests/scenarios/features/v2/app_deployment.feature new file mode 100644 index 000000000..f1d486992 --- /dev/null +++ b/tests/scenarios/features/v2/app_deployment.feature @@ -0,0 +1,58 @@ +@endpoint(app-deployment) @endpoint(app-deployment-v2) +Feature: App Deployment + Deploy and disable apps in App Builder. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "AppDeployment" API + + @team:DataDog/app-builder-backend + Scenario: Deploy App returns "Bad Request" response + Given operation "DeployApp" enabled + And new "DeployApp" request + And request contains "app_id" parameter with value "invalid-uuid" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/app-builder-backend + Scenario: Deploy App returns "Created" response + Given operation "DeployApp" enabled + And new "DeployApp" request + And there is a valid "app" in the system + And request contains "app_id" parameter from "app.data.id" + When the request is sent + Then the response status is 201 Created + + @team:DataDog/app-builder-backend + Scenario: Deploy App returns "Not Found" response + Given operation "DeployApp" enabled + And new "DeployApp" request + And request contains "app_id" parameter with value "7addb29b-f935-472c-ae79-d1963979a23e" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/app-builder-backend + Scenario: Disable App returns "Bad Request" response + Given operation "DisableApp" enabled + And new "DisableApp" request + And request contains "app_id" parameter with value "invalid-uuid" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/app-builder-backend + Scenario: Disable App returns "Not Found" response + Given operation "DisableApp" enabled + And new "DisableApp" request + And request contains "app_id" parameter with value "7addb29b-f935-472c-ae79-d1963979a23e" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/app-builder-backend + Scenario: Disable App returns "OK" response + Given operation "DisableApp" enabled + And new "DisableApp" request + And there is a valid "app" in the system + And request contains "app_id" parameter from "app.data.id" + When the request is sent + Then the response status is 200 OK diff --git a/tests/scenarios/features/v2/apps.feature b/tests/scenarios/features/v2/apps.feature new file mode 100644 index 000000000..b306b9959 --- /dev/null +++ b/tests/scenarios/features/v2/apps.feature @@ -0,0 +1,155 @@ +@endpoint(apps) @endpoint(apps-v2) +Feature: Apps + Create, read, update, and delete apps in App Builder. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "Apps" API + + @team:DataDog/app-builder-backend + Scenario: Create App returns "App Created" response + Given operation "CreateApp" enabled + And new "CreateApp" request + And body with value {"data": {"attributes": {"components": [{"events": [], "name": "grid0", "properties": {"children": [{"events": [], "name": "gridCell0", "properties": {"children": [{"events": [], "name": "calloutValue0", "properties": {"isDisabled": false, "isLoading": false, "isVisible": true, "label": "CPU Usage", "size": "sm", "style": "vivid_yellow", "unit": "kB", "value": "42"}, "type": "calloutValue"}], "isVisible": "true", "layout": {"default": {"height": 8, "width": 2, "x": 0, "y": 0}}}, "type": "gridCell"}]}, "type": "grid"}], "description": "This is a simple example app", "embeddedQueries": [], "name": "Example App", "rootInstanceName": "grid0"}, "type": "appDefinitions"}} + When the request is sent + Then the response status is 201 App Created + And the response "data.type" is equal to "appDefinitions" + + @team:DataDog/app-builder-backend + Scenario: Create App returns "Bad Request" response + Given operation "CreateApp" enabled + And new "CreateApp" request + And body with value {"data": {"attributes": {"description": "This is a bad example app", "embeddedQueries": [], "rootInstanceName": "grid0"}, "type": "appDefinitions"}} + When the request is sent + Then the response status is 400 Bad Request + And the response "errors" has length 1 + And the response "errors[0].detail" is equal to "missing required field" + + @team:DataDog/app-builder-backend + Scenario: Delete App returns "Bad Request" response + Given operation "DeleteApp" enabled + And new "DeleteApp" request + And request contains "app_id" parameter with value "bad-app-id" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/app-builder-backend + Scenario: Delete App returns "Gone" response + Given operation "DeleteApp" enabled + And new "DeleteApp" request + And request contains "app_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 410 Gone + + @team:DataDog/app-builder-backend + Scenario: Delete App returns "Not Found" response + Given operation "DeleteApp" enabled + And new "DeleteApp" request + And request contains "app_id" parameter with value "7addb29b-f935-472c-ae79-d1963979a23e" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/app-builder-backend + Scenario: Delete App returns "OK" response + Given operation "DeleteApp" enabled + And there is a valid "app" in the system + And new "DeleteApp" request + And request contains "app_id" parameter from "app.data.id" + When the request is sent + Then the response status is 200 OK + And the response "data.id" has the same value as "app.data.id" + And the response "data.type" is equal to "appDefinitions" + + @team:DataDog/app-builder-backend + Scenario: Delete Multiple Apps returns "Bad Request" response + Given operation "DeleteApps" enabled + And new "DeleteApps" request + And body with value {"data": [{"id": "71c0d358-eac5-41e3-892d-a7467571b9b", "type": "appDefinitions"}, {"id": "71c0d358-eac5-41e3-892d-a7467571b9b0", "type": "appDefinitions"}, {"id": "98e7e44d-1562-474a-90f7-3a94e739c006", "type": "appDefinitions"}]} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/app-builder-backend + Scenario: Delete Multiple Apps returns "Not Found" response + Given operation "DeleteApps" enabled + And new "DeleteApps" request + And body with value {"data": [{"id": "29494ddd-ac13-46a7-8558-b05b050ee755", "type": "appDefinitions"}, {"id": "71c0d358-eac5-41e3-892d-a7467571b9b0", "type": "appDefinitions"}, {"id": "98e7e44d-1562-474a-90f7-3a94e739c006", "type": "appDefinitions"}]} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/app-builder-backend + Scenario: Delete Multiple Apps returns "OK" response + Given operation "DeleteApps" enabled + And new "DeleteApps" request + And there is a valid "app" in the system + And body with value {"data": [{"id": "{{ app.data.id }}", "type": "appDefinitions"}]} + When the request is sent + Then the response status is 200 OK + And the response "data" has length 1 + And the response "data[0].id" has the same value as "app.data.id" + + @team:DataDog/app-builder-backend + Scenario: Get App returns "Bad Request" response + Given operation "GetApp" enabled + And new "GetApp" request + And request contains "app_id" parameter with value "invalid-uuid" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/app-builder-backend + Scenario: Get App returns "Not Found" response + Given operation "GetApp" enabled + And new "GetApp" request + And request contains "app_id" parameter with value "7addb29b-f935-472c-ae79-d1963979a23e" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/app-builder-backend + Scenario: Get App returns "OK" response + Given operation "GetApp" enabled + And new "GetApp" request + And there is a valid "app" in the system + And request contains "app_id" parameter from "app.data.id" + When the request is sent + Then the response status is 200 OK + And the response "data.id" has the same value as "app.data.id" + And the response "data.type" is equal to "appDefinitions" + + @generated @skip @team:DataDog/app-builder-backend + Scenario: List Apps returns "Bad Request, e.g. invalid sort parameter" response + Given operation "ListApps" enabled + And new "ListApps" request + When the request is sent + Then the response status is 400 Bad Request, e.g. invalid sort parameter + + @team:DataDog/app-builder-backend + Scenario: List Apps returns "OK" response + Given operation "ListApps" enabled + And new "ListApps" request + When the request is sent + Then the response status is 200 OK + + @team:DataDog/app-builder-backend + Scenario: Update App returns "Bad Request" response + Given operation "UpdateApp" enabled + And new "UpdateApp" request + And there is a valid "app" in the system + And request contains "app_id" parameter from "app.data.id" + And body with value {"data": {"attributes": {"rootInstanceName": ""}, "id": "{{ app.data.id }}", "type": "appDefinitions"}} + When the request is sent + Then the response status is 400 Bad Request + And the response "errors" has length 1 + And the response "errors[0].detail" is equal to "missing required field" + + @team:DataDog/app-builder-backend + Scenario: Update App returns "OK" response + Given operation "UpdateApp" enabled + And new "UpdateApp" request + And there is a valid "app" in the system + And request contains "app_id" parameter from "app.data.id" + And body with value {"data": {"attributes": {"name": "Updated Name", "rootInstanceName": "grid0"}, "id": "{{ app.data.id }}", "type": "appDefinitions"}} + When the request is sent + Then the response status is 200 OK + And the response "data.id" has the same value as "app.data.id" + And the response "data.type" is equal to "appDefinitions" + And the response "data.attributes.name" is equal to "Updated Name" diff --git a/tests/scenarios/features/v2/given.json b/tests/scenarios/features/v2/given.json index 21d526af2..3c9e42793 100644 --- a/tests/scenarios/features/v2/given.json +++ b/tests/scenarios/features/v2/given.json @@ -47,6 +47,18 @@ "tag": "APM Retention Filters", "operationId": "CreateApmRetentionFilter" }, + { + "parameters": [ + { + "name": "body", + "value": "{\"data\": {\"attributes\": {\"components\": [{\"events\": [], \"name\": \"grid0\", \"properties\": {\"children\": [{\"events\": [], \"name\": \"gridCell0\", \"properties\": {\"children\": [{\"events\": [], \"name\": \"calloutValue0\", \"properties\": {\"isDisabled\": false, \"isLoading\": false, \"isVisible\": true, \"label\": \"CPU Usage\", \"size\": \"sm\", \"style\": \"vivid_yellow\", \"unit\": \"kB\", \"value\": \"42\"}, \"type\": \"calloutValue\"}], \"isVisible\": \"true\", \"layout\": {\"default\": {\"height\": 8, \"width\": 2, \"x\": 0, \"y\": 0}}}, \"type\": \"gridCell\"}]}, \"type\": \"grid\"}], \"description\": \"This is a simple example app\", \"embeddedQueries\": [], \"name\": \"Example App\", \"rootInstanceName\": \"grid0\"}, \"type\": \"appDefinitions\"}}" + } + ], + "step": "there is a valid \"app\" in the system", + "key": "app", + "tag": "Apps", + "operationId": "CreateApp" + }, { "parameters": [ { diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index 9db842c40..7f5663e7d 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -153,6 +153,61 @@ "type": "idempotent" } }, + "DeleteApps": { + "tag": "Apps", + "undo": { + "type": "idempotent" + } + }, + "ListApps": { + "tag": "Apps", + "undo": { + "type": "safe" + } + }, + "CreateApp": { + "tag": "Apps", + "undo": { + "operationId": "DeleteApp", + "parameters": [ + { + "name": "app_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteApp": { + "tag": "Apps", + "undo": { + "type": "idempotent" + } + }, + "GetApp": { + "tag": "Apps", + "undo": { + "type": "safe" + } + }, + "UpdateApp": { + "tag": "Apps", + "undo": { + "type": "idempotent" + } + }, + "DisableApp": { + "tag": "App Deployment", + "undo": { + "type": "idempotent" + } + }, + "DeployApp": { + "tag": "App Deployment", + "undo": { + "type": "idempotent" + } + }, "ListApplicationKeys": { "tag": "Key Management", "undo": { diff --git a/tests/scenarios/function_mappings.rs b/tests/scenarios/function_mappings.rs index be3ebc194..f4e0138c3 100644 --- a/tests/scenarios/function_mappings.rs +++ b/tests/scenarios/function_mappings.rs @@ -54,6 +54,8 @@ pub struct ApiInstances { pub v2_api_spans_metrics: Option, pub v2_api_apm_retention_filters: Option, + pub v2_api_apps: Option, + pub v2_api_app_deployment: Option, pub v2_api_audit: Option, pub v2_api_authn_mappings: Option, pub v2_api_case_management: Option, @@ -475,6 +477,21 @@ pub fn initialize_api_instance(world: &mut DatadogWorld, api: String) { world.http_client.as_ref().unwrap().clone() )); } + "Apps" => { + world.api_instances.v2_api_apps = + Some(datadogV2::api_apps::AppsAPI::with_client_and_config( + world.config.clone(), + world.http_client.as_ref().unwrap().clone(), + )); + } + "AppDeployment" => { + world.api_instances.v2_api_app_deployment = Some( + datadogV2::api_app_deployment::AppDeploymentAPI::with_client_and_config( + world.config.clone(), + world.http_client.as_ref().unwrap().clone(), + ), + ); + } "Audit" => { world.api_instances.v2_api_audit = Some(datadogV2::api_audit::AuditAPI::with_client_and_config( @@ -1713,6 +1730,30 @@ pub fn collect_function_calls(world: &mut DatadogWorld) { "v2.UpdateApmRetentionFilter".into(), test_v2_update_apm_retention_filter, ); + world + .function_mappings + .insert("v2.DeleteApps".into(), test_v2_delete_apps); + world + .function_mappings + .insert("v2.ListApps".into(), test_v2_list_apps); + world + .function_mappings + .insert("v2.CreateApp".into(), test_v2_create_app); + world + .function_mappings + .insert("v2.DeleteApp".into(), test_v2_delete_app); + world + .function_mappings + .insert("v2.GetApp".into(), test_v2_get_app); + world + .function_mappings + .insert("v2.UpdateApp".into(), test_v2_update_app); + world + .function_mappings + .insert("v2.DisableApp".into(), test_v2_disable_app); + world + .function_mappings + .insert("v2.DeployApp".into(), test_v2_deploy_app); world .function_mappings .insert("v2.ListAuditLogs".into(), test_v2_list_audit_logs); @@ -11263,6 +11304,247 @@ fn test_v2_update_apm_retention_filter( world.response.code = response.status.as_u16(); } +fn test_v2_delete_apps(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_apps + .as_ref() + .expect("api instance not found"); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = match block_on(api.delete_apps_with_http_info(body)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_list_apps(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_apps + .as_ref() + .expect("api instance not found"); + let limit = _parameters + .get("limit") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let page = _parameters + .get("page") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let filter_user_name = _parameters + .get("filter[user_name]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let filter_user_uuid = _parameters + .get("filter[user_uuid]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let filter_name = _parameters + .get("filter[name]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let filter_query = _parameters + .get("filter[query]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let filter_deployed = _parameters + .get("filter[deployed]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let filter_tags = _parameters + .get("filter[tags]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let filter_favorite = _parameters + .get("filter[favorite]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let sort = _parameters + .get("sort") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let mut params = datadogV2::api_apps::ListAppsOptionalParams::default(); + params.limit = limit; + params.page = page; + params.filter_user_name = filter_user_name; + params.filter_user_uuid = filter_user_uuid; + params.filter_name = filter_name; + params.filter_query = filter_query; + params.filter_deployed = filter_deployed; + params.filter_tags = filter_tags; + params.filter_favorite = filter_favorite; + params.sort = sort; + let response = match block_on(api.list_apps_with_http_info(params)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_create_app(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_apps + .as_ref() + .expect("api instance not found"); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = match block_on(api.create_app_with_http_info(body)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_delete_app(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_apps + .as_ref() + .expect("api instance not found"); + let app_id = serde_json::from_value(_parameters.get("app_id").unwrap().clone()).unwrap(); + let response = match block_on(api.delete_app_with_http_info(app_id)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_get_app(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_apps + .as_ref() + .expect("api instance not found"); + let app_id = serde_json::from_value(_parameters.get("app_id").unwrap().clone()).unwrap(); + let response = match block_on(api.get_app_with_http_info(app_id)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_update_app(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_apps + .as_ref() + .expect("api instance not found"); + let app_id = serde_json::from_value(_parameters.get("app_id").unwrap().clone()).unwrap(); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = match block_on(api.update_app_with_http_info(app_id, body)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_disable_app(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_app_deployment + .as_ref() + .expect("api instance not found"); + let app_id = serde_json::from_value(_parameters.get("app_id").unwrap().clone()).unwrap(); + let response = match block_on(api.disable_app_with_http_info(app_id)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_deploy_app(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_app_deployment + .as_ref() + .expect("api instance not found"); + let app_id = serde_json::from_value(_parameters.get("app_id").unwrap().clone()).unwrap(); + let response = match block_on(api.deploy_app_with_http_info(app_id)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + fn test_v2_list_audit_logs(world: &mut DatadogWorld, _parameters: &HashMap) { let api = world .api_instances From ea8889b54c343e952480c9c7fe8afa1a610ee325 Mon Sep 17 00:00:00 2001 From: Kevin Zou Date: Thu, 12 Dec 2024 16:18:08 -0500 Subject: [PATCH 2/4] fix undo operations from another tag failing unstable operations checks --- tests/scenarios/fixtures.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tests/scenarios/fixtures.rs b/tests/scenarios/fixtures.rs index 723c63e11..13e6908f6 100644 --- a/tests/scenarios/fixtures.rs +++ b/tests/scenarios/fixtures.rs @@ -855,13 +855,19 @@ fn build_undo( let undo = UNDO_MAP.get(operation_id).unwrap().get("undo").unwrap(); match undo.get("type").unwrap().as_str() { Some("unsafe") => { - let api_name = if let Some(tag) = undo.get("tag") { - let mut api_name = tag.as_str().unwrap().to_string(); - api_name.retain(|c| !c.is_whitespace()); - api_name + let mut api_name = if let Some(tag) = undo.get("tag") { + tag.as_str().unwrap().to_string() } else { - world.api_name.clone().unwrap() + UNDO_MAP + .get(operation_id) + .unwrap() + .get("tag") + .unwrap() + .as_str() + .unwrap() + .to_string() }; + api_name.retain(|c| !c.is_whitespace()); if undo.get("operationId").is_none() { return Ok(None); @@ -887,7 +893,6 @@ fn build_undo( .unwrap() .to_case(Case::Snake) ); - if world.config.is_unstable_operation(&unstable_operation_id) { world .config From 7a7bb5de89b1094db85e970bbd6aef3893aab13f Mon Sep 17 00:00:00 2001 From: Kevin Zou Date: Thu, 12 Dec 2024 16:20:36 -0500 Subject: [PATCH 3/4] Revert "Regenerate client from commit bc9e8733 of spec repo" This reverts commit 6aaa56571d6012dd6a572f09d944501c317a6f51. --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 1691 ----------------- examples/v2_app-deployment_DeployApp.rs | 18 - examples/v2_app-deployment_DisableApp.rs | 18 - examples/v2_apps_CreateApp.rs | 55 - examples/v2_apps_DeleteApp.rs | 18 - examples/v2_apps_DeleteApps.rs | 25 - examples/v2_apps_GetApp.rs | 18 - examples/v2_apps_ListApps.rs | 17 - examples/v2_apps_UpdateApp.rs | 31 - src/datadog/configuration.rs | 8 - src/datadogV2/api/api_app_deployment.rs | 316 --- src/datadogV2/api/api_apps.rs | 1078 ----------- src/datadogV2/api/mod.rs | 2 - src/datadogV2/mod.rs | 2 - src/datadogV2/model/mod.rs | 174 -- .../model/model_app_builder_error.rs | 109 -- .../model_app_builder_error_errors_items.rs | 126 -- ...l_app_builder_error_errors_items_source.rs | 122 -- .../model/model_app_builder_event.rs | 138 -- .../model/model_app_builder_event_name.rs | 75 - .../model/model_app_builder_event_type.rs | 69 - src/datadogV2/model/model_app_meta.rs | 260 --- src/datadogV2/model/model_apps_sort_field.rs | 69 - src/datadogV2/model/model_component.rs | 157 -- src/datadogV2/model/model_component_grid.rs | 160 -- .../model/model_component_grid_properties.rs | 153 -- ...el_component_grid_properties_is_visible.rs | 33 - .../model/model_component_grid_type.rs | 48 - .../model/model_component_properties.rs | 134 -- .../model_component_properties_is_visible.rs | 33 - src/datadogV2/model/model_component_type.rs | 105 - .../model/model_create_app_request.rs | 105 - .../model/model_create_app_request_data.rs | 122 -- ...odel_create_app_request_data_attributes.rs | 228 --- .../model_create_app_request_data_type.rs | 48 - .../model/model_create_app_response.rs | 105 - .../model/model_create_app_response_data.rs | 113 -- .../model_create_app_response_data_type.rs | 48 - .../model/model_custom_connection.rs | 151 -- .../model_custom_connection_attributes.rs | 128 -- ...om_connection_attributes_on_prem_runner.rs | 122 -- .../model/model_custom_connection_type.rs | 48 - .../model/model_delete_app_response.rs | 105 - .../model/model_delete_app_response_data.rs | 113 -- .../model_delete_app_response_data_type.rs | 48 - .../model/model_delete_apps_request.rs | 106 -- .../model_delete_apps_request_data_items.rs | 114 -- ...del_delete_apps_request_data_items_type.rs | 48 - .../model/model_delete_apps_response.rs | 109 -- .../model_delete_apps_response_data_items.rs | 114 -- ...el_delete_apps_response_data_items_type.rs | 48 - .../model/model_deploy_app_response.rs | 105 - .../model/model_deploy_app_response_data.rs | 169 -- ...del_deploy_app_response_data_attributes.rs | 106 -- .../model_deploy_app_response_data_type.rs | 48 - .../model/model_deployment_included.rs | 168 -- .../model_deployment_included_attributes.rs | 106 -- .../model/model_deployment_included_meta.rs | 156 -- .../model/model_deployment_included_type.rs | 48 - src/datadogV2/model/model_deployment_meta.rs | 156 -- .../model/model_deployment_relationship.rs | 122 -- .../model_deployment_relationship_data.rs | 131 -- ...model_deployment_relationship_data_type.rs | 48 - .../model_deployment_relationship_meta.rs | 156 -- .../model/model_disable_app_response.rs | 105 - .../model/model_disable_app_response_data.rs | 169 -- ...el_disable_app_response_data_attributes.rs | 106 -- .../model_disable_app_response_data_type.rs | 48 - src/datadogV2/model/model_get_app_response.rs | 161 -- .../model/model_get_app_response_data.rs | 125 -- .../model_get_app_response_data_attributes.rs | 245 --- .../model/model_get_app_response_data_type.rs | 48 - .../model_get_app_response_relationship.rs | 123 -- src/datadogV2/model/model_input_schema.rs | 105 - .../model/model_input_schema_data.rs | 148 -- .../model_input_schema_data_attributes.rs | 110 -- ...schema_data_attributes_parameters_items.rs | 110 -- ...a_data_attributes_parameters_items_data.rs | 111 -- ...ibutes_parameters_items_data_attributes.rs | 192 -- .../model/model_input_schema_data_type.rs | 48 - .../model/model_list_apps_response.rs | 140 -- .../model_list_apps_response_data_items.rs | 167 -- ...ist_apps_response_data_items_attributes.rs | 175 -- ..._apps_response_data_items_relationships.rs | 105 - ...odel_list_apps_response_data_items_type.rs | 48 - .../model/model_list_apps_response_meta.rs | 105 - .../model_list_apps_response_meta_page.rs | 124 -- src/datadogV2/model/model_query.rs | 154 -- src/datadogV2/model/model_query_type.rs | 54 - src/datadogV2/model/model_script.rs | 105 - src/datadogV2/model/model_script_data.rs | 149 -- .../model/model_script_data_attributes.rs | 139 -- src/datadogV2/model/model_script_data_type.rs | 48 - .../model/model_update_app_request.rs | 105 - .../model/model_update_app_request_data.rs | 139 -- ...odel_update_app_request_data_attributes.rs | 228 --- .../model_update_app_request_data_type.rs | 48 - .../model/model_update_app_response.rs | 162 -- .../model/model_update_app_response_data.rs | 126 -- ...del_update_app_response_data_attributes.rs | 245 --- .../model_update_app_response_data_type.rs | 48 - .../model_update_app_response_relationship.rs | 123 -- ...oy-App-returns-Bad-Request-response.frozen | 1 - ...ploy-App-returns-Bad-Request-response.json | 33 - ...Deploy-App-returns-Created-response.frozen | 1 - .../Deploy-App-returns-Created-response.json | 95 - ...ploy-App-returns-Not-Found-response.frozen | 1 - ...Deploy-App-returns-Not-Found-response.json | 33 - ...le-App-returns-Bad-Request-response.frozen | 1 - ...able-App-returns-Bad-Request-response.json | 33 - ...able-App-returns-Not-Found-response.frozen | 1 - ...isable-App-returns-Not-Found-response.json | 33 - .../Disable-App-returns-OK-response.frozen | 1 - .../Disable-App-returns-OK-response.json | 95 - ...te-App-returns-App-Created-response.frozen | 1 - ...eate-App-returns-App-Created-response.json | 67 - ...te-App-returns-Bad-Request-response.frozen | 1 - ...eate-App-returns-Bad-Request-response.json | 39 - ...te-App-returns-Bad-Request-response.frozen | 1 - ...lete-App-returns-Bad-Request-response.json | 33 - ...lete-App-returns-Not-Found-response.frozen | 1 - ...Delete-App-returns-Not-Found-response.json | 33 - .../Delete-App-returns-OK-response.frozen | 1 - .../apps/Delete-App-returns-OK-response.json | 95 - ...e-Apps-returns-Bad-Request-response.frozen | 1 - ...ple-Apps-returns-Bad-Request-response.json | 39 - ...ple-Apps-returns-Not-Found-response.frozen | 1 - ...tiple-Apps-returns-Not-Found-response.json | 39 - ...e-Multiple-Apps-returns-OK-response.frozen | 1 - ...ete-Multiple-Apps-returns-OK-response.json | 101 - ...et-App-returns-Bad-Request-response.frozen | 1 - .../Get-App-returns-Bad-Request-response.json | 33 - .../Get-App-returns-Not-Found-response.frozen | 1 - .../Get-App-returns-Not-Found-response.json | 33 - .../apps/Get-App-returns-OK-response.frozen | 1 - .../v2/apps/Get-App-returns-OK-response.json | 95 - .../apps/List-Apps-returns-OK-response.frozen | 1 - .../apps/List-Apps-returns-OK-response.json | 33 - ...te-App-returns-Bad-Request-response.frozen | 1 - ...date-App-returns-Bad-Request-response.json | 101 - .../Update-App-returns-OK-response.frozen | 1 - .../apps/Update-App-returns-OK-response.json | 101 - .../features/v2/app_deployment.feature | 58 - tests/scenarios/features/v2/apps.feature | 155 -- tests/scenarios/features/v2/given.json | 12 - tests/scenarios/features/v2/undo.json | 55 - tests/scenarios/function_mappings.rs | 282 --- 148 files changed, 4 insertions(+), 15245 deletions(-) delete mode 100644 examples/v2_app-deployment_DeployApp.rs delete mode 100644 examples/v2_app-deployment_DisableApp.rs delete mode 100644 examples/v2_apps_CreateApp.rs delete mode 100644 examples/v2_apps_DeleteApp.rs delete mode 100644 examples/v2_apps_DeleteApps.rs delete mode 100644 examples/v2_apps_GetApp.rs delete mode 100644 examples/v2_apps_ListApps.rs delete mode 100644 examples/v2_apps_UpdateApp.rs delete mode 100644 src/datadogV2/api/api_app_deployment.rs delete mode 100644 src/datadogV2/api/api_apps.rs delete mode 100644 src/datadogV2/model/model_app_builder_error.rs delete mode 100644 src/datadogV2/model/model_app_builder_error_errors_items.rs delete mode 100644 src/datadogV2/model/model_app_builder_error_errors_items_source.rs delete mode 100644 src/datadogV2/model/model_app_builder_event.rs delete mode 100644 src/datadogV2/model/model_app_builder_event_name.rs delete mode 100644 src/datadogV2/model/model_app_builder_event_type.rs delete mode 100644 src/datadogV2/model/model_app_meta.rs delete mode 100644 src/datadogV2/model/model_apps_sort_field.rs delete mode 100644 src/datadogV2/model/model_component.rs delete mode 100644 src/datadogV2/model/model_component_grid.rs delete mode 100644 src/datadogV2/model/model_component_grid_properties.rs delete mode 100644 src/datadogV2/model/model_component_grid_properties_is_visible.rs delete mode 100644 src/datadogV2/model/model_component_grid_type.rs delete mode 100644 src/datadogV2/model/model_component_properties.rs delete mode 100644 src/datadogV2/model/model_component_properties_is_visible.rs delete mode 100644 src/datadogV2/model/model_component_type.rs delete mode 100644 src/datadogV2/model/model_create_app_request.rs delete mode 100644 src/datadogV2/model/model_create_app_request_data.rs delete mode 100644 src/datadogV2/model/model_create_app_request_data_attributes.rs delete mode 100644 src/datadogV2/model/model_create_app_request_data_type.rs delete mode 100644 src/datadogV2/model/model_create_app_response.rs delete mode 100644 src/datadogV2/model/model_create_app_response_data.rs delete mode 100644 src/datadogV2/model/model_create_app_response_data_type.rs delete mode 100644 src/datadogV2/model/model_custom_connection.rs delete mode 100644 src/datadogV2/model/model_custom_connection_attributes.rs delete mode 100644 src/datadogV2/model/model_custom_connection_attributes_on_prem_runner.rs delete mode 100644 src/datadogV2/model/model_custom_connection_type.rs delete mode 100644 src/datadogV2/model/model_delete_app_response.rs delete mode 100644 src/datadogV2/model/model_delete_app_response_data.rs delete mode 100644 src/datadogV2/model/model_delete_app_response_data_type.rs delete mode 100644 src/datadogV2/model/model_delete_apps_request.rs delete mode 100644 src/datadogV2/model/model_delete_apps_request_data_items.rs delete mode 100644 src/datadogV2/model/model_delete_apps_request_data_items_type.rs delete mode 100644 src/datadogV2/model/model_delete_apps_response.rs delete mode 100644 src/datadogV2/model/model_delete_apps_response_data_items.rs delete mode 100644 src/datadogV2/model/model_delete_apps_response_data_items_type.rs delete mode 100644 src/datadogV2/model/model_deploy_app_response.rs delete mode 100644 src/datadogV2/model/model_deploy_app_response_data.rs delete mode 100644 src/datadogV2/model/model_deploy_app_response_data_attributes.rs delete mode 100644 src/datadogV2/model/model_deploy_app_response_data_type.rs delete mode 100644 src/datadogV2/model/model_deployment_included.rs delete mode 100644 src/datadogV2/model/model_deployment_included_attributes.rs delete mode 100644 src/datadogV2/model/model_deployment_included_meta.rs delete mode 100644 src/datadogV2/model/model_deployment_included_type.rs delete mode 100644 src/datadogV2/model/model_deployment_meta.rs delete mode 100644 src/datadogV2/model/model_deployment_relationship.rs delete mode 100644 src/datadogV2/model/model_deployment_relationship_data.rs delete mode 100644 src/datadogV2/model/model_deployment_relationship_data_type.rs delete mode 100644 src/datadogV2/model/model_deployment_relationship_meta.rs delete mode 100644 src/datadogV2/model/model_disable_app_response.rs delete mode 100644 src/datadogV2/model/model_disable_app_response_data.rs delete mode 100644 src/datadogV2/model/model_disable_app_response_data_attributes.rs delete mode 100644 src/datadogV2/model/model_disable_app_response_data_type.rs delete mode 100644 src/datadogV2/model/model_get_app_response.rs delete mode 100644 src/datadogV2/model/model_get_app_response_data.rs delete mode 100644 src/datadogV2/model/model_get_app_response_data_attributes.rs delete mode 100644 src/datadogV2/model/model_get_app_response_data_type.rs delete mode 100644 src/datadogV2/model/model_get_app_response_relationship.rs delete mode 100644 src/datadogV2/model/model_input_schema.rs delete mode 100644 src/datadogV2/model/model_input_schema_data.rs delete mode 100644 src/datadogV2/model/model_input_schema_data_attributes.rs delete mode 100644 src/datadogV2/model/model_input_schema_data_attributes_parameters_items.rs delete mode 100644 src/datadogV2/model/model_input_schema_data_attributes_parameters_items_data.rs delete mode 100644 src/datadogV2/model/model_input_schema_data_attributes_parameters_items_data_attributes.rs delete mode 100644 src/datadogV2/model/model_input_schema_data_type.rs delete mode 100644 src/datadogV2/model/model_list_apps_response.rs delete mode 100644 src/datadogV2/model/model_list_apps_response_data_items.rs delete mode 100644 src/datadogV2/model/model_list_apps_response_data_items_attributes.rs delete mode 100644 src/datadogV2/model/model_list_apps_response_data_items_relationships.rs delete mode 100644 src/datadogV2/model/model_list_apps_response_data_items_type.rs delete mode 100644 src/datadogV2/model/model_list_apps_response_meta.rs delete mode 100644 src/datadogV2/model/model_list_apps_response_meta_page.rs delete mode 100644 src/datadogV2/model/model_query.rs delete mode 100644 src/datadogV2/model/model_query_type.rs delete mode 100644 src/datadogV2/model/model_script.rs delete mode 100644 src/datadogV2/model/model_script_data.rs delete mode 100644 src/datadogV2/model/model_script_data_attributes.rs delete mode 100644 src/datadogV2/model/model_script_data_type.rs delete mode 100644 src/datadogV2/model/model_update_app_request.rs delete mode 100644 src/datadogV2/model/model_update_app_request_data.rs delete mode 100644 src/datadogV2/model/model_update_app_request_data_attributes.rs delete mode 100644 src/datadogV2/model/model_update_app_request_data_type.rs delete mode 100644 src/datadogV2/model/model_update_app_response.rs delete mode 100644 src/datadogV2/model/model_update_app_response_data.rs delete mode 100644 src/datadogV2/model/model_update_app_response_data_attributes.rs delete mode 100644 src/datadogV2/model/model_update_app_response_data_type.rs delete mode 100644 src/datadogV2/model/model_update_app_response_relationship.rs delete mode 100644 tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Bad-Request-response.frozen delete mode 100644 tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Bad-Request-response.json delete mode 100644 tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Created-response.frozen delete mode 100644 tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Created-response.json delete mode 100644 tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Not-Found-response.frozen delete mode 100644 tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Not-Found-response.json delete mode 100644 tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Bad-Request-response.frozen delete mode 100644 tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Bad-Request-response.json delete mode 100644 tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Not-Found-response.frozen delete mode 100644 tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Not-Found-response.json delete mode 100644 tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-OK-response.frozen delete mode 100644 tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-OK-response.json delete mode 100644 tests/scenarios/cassettes/v2/apps/Create-App-returns-App-Created-response.frozen delete mode 100644 tests/scenarios/cassettes/v2/apps/Create-App-returns-App-Created-response.json delete mode 100644 tests/scenarios/cassettes/v2/apps/Create-App-returns-Bad-Request-response.frozen delete mode 100644 tests/scenarios/cassettes/v2/apps/Create-App-returns-Bad-Request-response.json delete mode 100644 tests/scenarios/cassettes/v2/apps/Delete-App-returns-Bad-Request-response.frozen delete mode 100644 tests/scenarios/cassettes/v2/apps/Delete-App-returns-Bad-Request-response.json delete mode 100644 tests/scenarios/cassettes/v2/apps/Delete-App-returns-Not-Found-response.frozen delete mode 100644 tests/scenarios/cassettes/v2/apps/Delete-App-returns-Not-Found-response.json delete mode 100644 tests/scenarios/cassettes/v2/apps/Delete-App-returns-OK-response.frozen delete mode 100644 tests/scenarios/cassettes/v2/apps/Delete-App-returns-OK-response.json delete mode 100644 tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Bad-Request-response.frozen delete mode 100644 tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Bad-Request-response.json delete mode 100644 tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Not-Found-response.frozen delete mode 100644 tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Not-Found-response.json delete mode 100644 tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-OK-response.frozen delete mode 100644 tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-OK-response.json delete mode 100644 tests/scenarios/cassettes/v2/apps/Get-App-returns-Bad-Request-response.frozen delete mode 100644 tests/scenarios/cassettes/v2/apps/Get-App-returns-Bad-Request-response.json delete mode 100644 tests/scenarios/cassettes/v2/apps/Get-App-returns-Not-Found-response.frozen delete mode 100644 tests/scenarios/cassettes/v2/apps/Get-App-returns-Not-Found-response.json delete mode 100644 tests/scenarios/cassettes/v2/apps/Get-App-returns-OK-response.frozen delete mode 100644 tests/scenarios/cassettes/v2/apps/Get-App-returns-OK-response.json delete mode 100644 tests/scenarios/cassettes/v2/apps/List-Apps-returns-OK-response.frozen delete mode 100644 tests/scenarios/cassettes/v2/apps/List-Apps-returns-OK-response.json delete mode 100644 tests/scenarios/cassettes/v2/apps/Update-App-returns-Bad-Request-response.frozen delete mode 100644 tests/scenarios/cassettes/v2/apps/Update-App-returns-Bad-Request-response.json delete mode 100644 tests/scenarios/cassettes/v2/apps/Update-App-returns-OK-response.frozen delete mode 100644 tests/scenarios/cassettes/v2/apps/Update-App-returns-OK-response.json delete mode 100644 tests/scenarios/features/v2/app_deployment.feature delete mode 100644 tests/scenarios/features/v2/apps.feature diff --git a/.apigentools-info b/.apigentools-info index f4ddf6c44..2ffdcbbe0 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-12-12 19:15:10.175848", - "spec_repo_commit": "bc9e8733" + "regenerated": "2024-12-12 15:23:50.266080", + "spec_repo_commit": "222e1f81" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-12-12 19:15:10.195036", - "spec_repo_commit": "bc9e8733" + "regenerated": "2024-12-12 15:23:50.285587", + "spec_repo_commit": "222e1f81" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 6689e131b..05e8f325c 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1615,126 +1615,6 @@ components: type: string x-enum-varnames: - apm_retention_filter - AppBuilderError: - description: The definition of `AppBuilderError` object. - properties: - errors: - description: The `AppBuilderError` `errors`. - items: - $ref: '#/components/schemas/AppBuilderErrorErrorsItems' - type: array - type: object - AppBuilderErrorErrorsItems: - description: The definition of `AppBuilderErrorErrorsItems` object. - properties: - detail: - description: The `items` `detail`. - type: string - source: - $ref: '#/components/schemas/AppBuilderErrorErrorsItemsSource' - type: object - AppBuilderErrorErrorsItemsSource: - description: The definition of `AppBuilderErrorErrorsItemsSource` object. - properties: - parameter: - description: The `source` `parameter`. - type: string - pointer: - description: The `source` `pointer`. - type: string - type: object - AppBuilderEvent: - additionalProperties: {} - description: The definition of `AppBuilderEvent` object. - properties: - name: - $ref: '#/components/schemas/AppBuilderEventName' - type: - $ref: '#/components/schemas/AppBuilderEventType' - type: object - AppBuilderEventName: - description: The triggering action for the event. - enum: - - pageChange - - tableRowClick - - _tableRowButtonClick - - change - - submit - - click - - toggleOpen - - close - - open - - executionFinished - type: string - x-enum-varnames: - - PAGECHANGE - - TABLEROWCLICK - - TABLEROWBUTTONCLICK - - CHANGE - - SUBMIT - - CLICK - - TOGGLEOPEN - - CLOSE - - OPEN - - EXECUTIONFINISHED - AppBuilderEventType: - description: The response to the event. - enum: - - custom - - setComponentState - - triggerQuery - - openModal - - closeModal - - openUrl - - downloadFile - - setStateVariableValue - type: string - x-enum-varnames: - - CUSTOM - - SETCOMPONENTSTATE - - TRIGGERQUERY - - OPENMODAL - - CLOSEMODAL - - OPENURL - - DOWNLOADFILE - - SETSTATEVARIABLEVALUE - AppMeta: - description: The definition of `AppMeta` object. - properties: - created_at: - description: The `AppMeta` `created_at`. - type: string - deleted_at: - description: The `AppMeta` `deleted_at`. - type: string - org_id: - description: The `AppMeta` `org_id`. - format: int64 - type: integer - run_as_user: - description: The `AppMeta` `run_as_user`. - type: string - updated_at: - description: The `AppMeta` `updated_at`. - type: string - updated_since_deployment: - description: The `AppMeta` `updated_since_deployment`. - type: boolean - user_id: - description: The `AppMeta` `user_id`. - format: int64 - type: integer - user_name: - description: The `AppMeta` `user_name`. - type: string - user_uuid: - description: The `AppMeta` `user_uuid`. - type: string - version: - description: The `AppMeta` `version`. - format: int64 - type: integer - type: object ApplicationKeyCreateAttributes: description: Attributes used to create an application Key. properties: @@ -1886,27 +1766,6 @@ components: type: string x-enum-varnames: - APPLICATION_KEYS - AppsSortField: - description: The field and direction to sort apps by - enum: - - name - - created_at - - updated_at - - user_name - - -name - - -created_at - - -updated_at - - -user_name - type: string - x-enum-varnames: - - NAME - - CREATED_AT - - UPDATED_AT - - USER_NAME - - NAME_DESC - - CREATED_AT_DESC - - UPDATED_AT_DESC - - USER_NAME_DESC AuditLogsEvent: description: Object description of an Audit Logs event after it is processed and stored by Datadog. @@ -5641,150 +5500,6 @@ components: $ref: '#/components/schemas/CloudflareAccountResponseData' type: array type: object - Component: - description: The definition of `Component` object. - properties: - events: - description: The `Component` `events`. - items: - $ref: '#/components/schemas/AppBuilderEvent' - type: array - id: - description: The `Component` `id`. - nullable: true - type: string - name: - description: The `Component` `name`. - example: '' - type: string - properties: - $ref: '#/components/schemas/ComponentProperties' - type: - $ref: '#/components/schemas/ComponentType' - required: - - name - - type - - properties - type: object - ComponentGrid: - description: The definition of `ComponentGrid` object. - properties: - events: - description: The `ComponentGrid` `events`. - items: - $ref: '#/components/schemas/AppBuilderEvent' - type: array - id: - description: The `ComponentGrid` `id`. - type: string - name: - description: The `ComponentGrid` `name`. - example: '' - type: string - properties: - $ref: '#/components/schemas/ComponentGridProperties' - type: - $ref: '#/components/schemas/ComponentGridType' - required: - - name - - type - - properties - type: object - ComponentGridProperties: - description: The definition of `ComponentGridProperties` object. - properties: - backgroundColor: - default: default - description: The `ComponentGridProperties` `backgroundColor`. - type: string - children: - description: The `ComponentGridProperties` `children`. - items: - $ref: '#/components/schemas/Component' - type: array - isVisible: - $ref: '#/components/schemas/ComponentGridPropertiesIsVisible' - type: object - ComponentGridPropertiesIsVisible: - description: The definition of `ComponentGridPropertiesIsVisible` object. - oneOf: - - type: string - - default: true - type: boolean - ComponentGridType: - description: The definition of `ComponentGridType` object. - enum: - - grid - example: grid - type: string - x-enum-varnames: - - GRID - ComponentProperties: - additionalProperties: {} - description: The definition of `ComponentProperties` object. - properties: - children: - description: The `ComponentProperties` `children`. - items: - $ref: '#/components/schemas/Component' - type: array - isVisible: - $ref: '#/components/schemas/ComponentPropertiesIsVisible' - type: object - ComponentPropertiesIsVisible: - description: The definition of `ComponentPropertiesIsVisible` object. - oneOf: - - type: boolean - - description: If a string, it should be a valid JavaScript expression that - evaluates to a boolean. - example: ${true} - type: string - ComponentType: - description: The definition of `ComponentType` object. - enum: - - table - - textInput - - textArea - - button - - text - - select - - modal - - schemaForm - - checkbox - - tabs - - vegaChart - - radioButtons - - numberInput - - fileInput - - jsonInput - - gridCell - - dateRangePicker - - search - - container - - calloutValue - example: table - type: string - x-enum-varnames: - - TABLE - - TEXTINPUT - - TEXTAREA - - BUTTON - - TEXT - - SELECT - - MODAL - - SCHEMAFORM - - CHECKBOX - - TABS - - VEGACHART - - RADIOBUTTONS - - NUMBERINPUT - - FILEINPUT - - JSONINPUT - - GRIDCELL - - DATERANGEPICKER - - SEARCH - - CONTAINER - - CALLOUTVALUE ConfluentAccountCreateRequest: description: Payload schema when adding a Confluent account. properties: @@ -6786,132 +6501,6 @@ components: type: string x-enum-varnames: - COST_BY_ORG - CreateAppRequest: - description: The definition of `CreateAppRequest` object. - example: - data: - attributes: - components: - - events: [] - name: grid0 - properties: - children: - - events: [] - name: gridCell0 - properties: - children: - - events: [] - name: calloutValue0 - properties: - isDisabled: false - isLoading: false - isVisible: true - label: CPU Usage - size: sm - style: vivid_yellow - unit: kB - value: '42' - type: calloutValue - isVisible: 'true' - layout: - default: - height: 8 - width: 2 - x: 0 - y: 0 - type: gridCell - type: grid - description: This is a simple example app - embeddedQueries: [] - name: Example App - rootInstanceName: grid0 - type: appDefinitions - properties: - data: - $ref: '#/components/schemas/CreateAppRequestData' - type: object - CreateAppRequestData: - description: The definition of `CreateAppRequestData` object. - properties: - attributes: - $ref: '#/components/schemas/CreateAppRequestDataAttributes' - type: - $ref: '#/components/schemas/CreateAppRequestDataType' - required: - - type - type: object - CreateAppRequestDataAttributes: - description: The definition of `CreateAppRequestDataAttributes` object. - properties: - components: - description: The `attributes` `components`. - items: - $ref: '#/components/schemas/ComponentGrid' - type: array - description: - description: The `attributes` `description`. - type: string - embeddedQueries: - description: The `attributes` `embeddedQueries`. - items: - $ref: '#/components/schemas/Query' - type: array - inputSchema: - $ref: '#/components/schemas/InputSchema' - name: - description: The `attributes` `name`. - type: string - rootInstanceName: - description: The `attributes` `rootInstanceName`. - type: string - scripts: - description: The `attributes` `scripts`. - items: - $ref: '#/components/schemas/Script' - type: array - tags: - description: The `attributes` `tags`. - items: - type: string - type: array - type: object - CreateAppRequestDataType: - default: appDefinitions - description: The definition of `CreateAppRequestDataType` object. - enum: - - appDefinitions - example: appDefinitions - type: string - x-enum-varnames: - - APPDEFINITIONS - CreateAppResponse: - description: The definition of `CreateAppResponse` object. - properties: - data: - $ref: '#/components/schemas/CreateAppResponseData' - type: object - CreateAppResponseData: - description: The definition of `CreateAppResponseData` object. - properties: - id: - description: The `data` `id`. - example: '' - type: string - type: - $ref: '#/components/schemas/CreateAppResponseDataType' - required: - - id - - type - type: object - CreateAppResponseDataType: - default: appDefinitions - description: The definition of `CreateAppResponseDataType` object. - enum: - - appDefinitions - example: appDefinitions - type: string - x-enum-varnames: - - APPDEFINITIONS CreateDataDeletionRequestBody: description: Object needed to create a data deletion request. properties: @@ -7041,44 +6630,6 @@ components: nullable: true type: string type: object - CustomConnection: - description: The definition of `CustomConnection` object. - properties: - attributes: - $ref: '#/components/schemas/CustomConnectionAttributes' - id: - description: The `CustomConnection` `id`. - type: string - type: - $ref: '#/components/schemas/CustomConnectionType' - type: object - CustomConnectionAttributes: - description: The definition of `CustomConnectionAttributes` object. - properties: - name: - description: The `attributes` `name`. - type: string - onPremRunner: - $ref: '#/components/schemas/CustomConnectionAttributesOnPremRunner' - type: object - CustomConnectionAttributesOnPremRunner: - description: The definition of `CustomConnectionAttributesOnPremRunner` object. - properties: - id: - description: The `onPremRunner` `id`. - type: string - url: - description: The `onPremRunner` `url`. - type: string - type: object - CustomConnectionType: - default: custom_connections - description: The definition of `CustomConnectionType` object. - enum: - - custom_connections - type: string - x-enum-varnames: - - CUSTOM_CONNECTIONS CustomCostGetResponseMeta: description: Meta for the response from the Get Custom Costs endpoints. properties: @@ -8460,270 +8011,6 @@ components: type: number type: array type: object - DeleteAppResponse: - description: The definition of `DeleteAppResponse` object. - properties: - data: - $ref: '#/components/schemas/DeleteAppResponseData' - type: object - DeleteAppResponseData: - description: The definition of `DeleteAppResponseData` object. - properties: - id: - description: The `data` `id`. - example: '' - type: string - type: - $ref: '#/components/schemas/DeleteAppResponseDataType' - required: - - id - - type - type: object - DeleteAppResponseDataType: - default: appDefinitions - description: The definition of `DeleteAppResponseDataType` object. - enum: - - appDefinitions - example: appDefinitions - type: string - x-enum-varnames: - - APPDEFINITIONS - DeleteAppsRequest: - description: The definition of `DeleteAppsRequest` object. - example: - data: - - id: 29494ddd-ac13-46a7-8558-b05b050ee755 - type: appDefinitions - - id: 71c0d358-eac5-41e3-892d-a7467571b9b0 - type: appDefinitions - - id: 98e7e44d-1562-474a-90f7-3a94e739c006 - type: appDefinitions - properties: - data: - description: The `DeleteAppsRequest` `data`. - items: - $ref: '#/components/schemas/DeleteAppsRequestDataItems' - type: array - type: object - DeleteAppsRequestDataItems: - description: The definition of `DeleteAppsRequestDataItems` object. - properties: - id: - description: The `items` `id`. - example: '' - type: string - type: - $ref: '#/components/schemas/DeleteAppsRequestDataItemsType' - required: - - id - - type - type: object - DeleteAppsRequestDataItemsType: - default: appDefinitions - description: The definition of `DeleteAppsRequestDataItemsType` object. - enum: - - appDefinitions - example: appDefinitions - type: string - x-enum-varnames: - - APPDEFINITIONS - DeleteAppsResponse: - description: The definition of `DeleteAppsResponse` object. - properties: - data: - description: The `DeleteAppsResponse` `data`. - items: - $ref: '#/components/schemas/DeleteAppsResponseDataItems' - type: array - type: object - DeleteAppsResponseDataItems: - description: The definition of `DeleteAppsResponseDataItems` object. - properties: - id: - description: The `items` `id`. - example: '' - type: string - type: - $ref: '#/components/schemas/DeleteAppsResponseDataItemsType' - required: - - id - - type - type: object - DeleteAppsResponseDataItemsType: - default: appDefinitions - description: The definition of `DeleteAppsResponseDataItemsType` object. - enum: - - appDefinitions - example: appDefinitions - type: string - x-enum-varnames: - - APPDEFINITIONS - DeployAppResponse: - description: The definition of `DeployAppResponse` object. - properties: - data: - $ref: '#/components/schemas/DeployAppResponseData' - type: object - DeployAppResponseData: - description: The definition of `DeployAppResponseData` object. - properties: - attributes: - $ref: '#/components/schemas/DeployAppResponseDataAttributes' - id: - description: The `data` `id`. - type: string - meta: - $ref: '#/components/schemas/DeploymentMeta' - type: - $ref: '#/components/schemas/DeployAppResponseDataType' - type: object - DeployAppResponseDataAttributes: - description: The definition of `DeployAppResponseDataAttributes` object. - properties: - app_version_id: - description: The `attributes` `app_version_id`. - type: string - type: object - DeployAppResponseDataType: - default: deployment - description: The definition of `DeployAppResponseDataType` object. - enum: - - deployment - type: string - x-enum-varnames: - - DEPLOYMENT - Deployment: - description: The definition of `Deployment` object. - properties: - attributes: - $ref: '#/components/schemas/DeploymentAttributes' - id: - description: The `Deployment` `id`. - type: string - meta: - $ref: '#/components/schemas/DeploymentMeta' - type: - $ref: '#/components/schemas/DeploymentType' - type: object - DeploymentAttributes: - description: The definition of `DeploymentAttributes` object. - properties: - app_version_id: - description: The `attributes` `app_version_id`. - type: string - type: object - DeploymentIncluded: - description: The definition of `DeploymentIncluded` object. - properties: - attributes: - $ref: '#/components/schemas/DeploymentIncludedAttributes' - id: - description: The `DeploymentIncluded` `id`. - type: string - meta: - $ref: '#/components/schemas/DeploymentIncludedMeta' - type: - $ref: '#/components/schemas/DeploymentIncludedType' - type: object - DeploymentIncludedAttributes: - description: The definition of `DeploymentIncludedAttributes` object. - properties: - app_version_id: - description: The `attributes` `app_version_id`. - type: string - type: object - DeploymentIncludedMeta: - description: The definition of `DeploymentIncludedMeta` object. - properties: - created_at: - description: The `meta` `created_at`. - type: string - user_id: - description: The `meta` `user_id`. - format: int64 - type: integer - user_name: - description: The `meta` `user_name`. - type: string - user_uuid: - description: The `meta` `user_uuid`. - type: string - type: object - DeploymentIncludedType: - default: deployment - description: The definition of `DeploymentIncludedType` object. - enum: - - deployment - type: string - x-enum-varnames: - - DEPLOYMENT - DeploymentMeta: - description: The definition of `DeploymentMeta` object. - properties: - created_at: - description: The `DeploymentMeta` `created_at`. - type: string - user_id: - description: The `DeploymentMeta` `user_id`. - format: int64 - type: integer - user_name: - description: The `DeploymentMeta` `user_name`. - type: string - user_uuid: - description: The `DeploymentMeta` `user_uuid`. - type: string - type: object - DeploymentRelationship: - description: The definition of `DeploymentRelationship` object. - properties: - data: - $ref: '#/components/schemas/DeploymentRelationshipData' - meta: - $ref: '#/components/schemas/DeploymentRelationshipMeta' - type: object - DeploymentRelationshipData: - description: The definition of `DeploymentRelationshipData` object. - properties: - id: - description: The `data` `id`. - type: string - type: - $ref: '#/components/schemas/DeploymentRelationshipDataType' - type: object - DeploymentRelationshipDataType: - default: deployment - description: The definition of `DeploymentRelationshipDataType` object. - enum: - - deployment - type: string - x-enum-varnames: - - DEPLOYMENT - DeploymentRelationshipMeta: - description: The definition of `DeploymentRelationshipMeta` object. - properties: - created_at: - description: The `meta` `created_at`. - type: string - user_id: - description: The `meta` `user_id`. - format: int64 - type: integer - user_name: - description: The `meta` `user_name`. - type: string - user_uuid: - description: The `meta` `user_uuid`. - type: string - type: object - DeploymentType: - default: deployment - description: The definition of `DeploymentType` object. - enum: - - deployment - type: string - x-enum-varnames: - - DEPLOYMENT DetailedFinding: description: A single finding with with message and resource configuration. properties: @@ -8907,40 +8194,6 @@ components: description: The type of the resource. The value should always be device. type: string type: object - DisableAppResponse: - description: The definition of `DisableAppResponse` object. - properties: - data: - $ref: '#/components/schemas/DisableAppResponseData' - type: object - DisableAppResponseData: - description: The definition of `DisableAppResponseData` object. - properties: - attributes: - $ref: '#/components/schemas/DisableAppResponseDataAttributes' - id: - description: The `data` `id`. - type: string - meta: - $ref: '#/components/schemas/DeploymentMeta' - type: - $ref: '#/components/schemas/DisableAppResponseDataType' - type: object - DisableAppResponseDataAttributes: - description: The definition of `DisableAppResponseDataAttributes` object. - properties: - app_version_id: - description: The `attributes` `app_version_id`. - type: string - type: object - DisableAppResponseDataType: - default: deployment - description: The definition of `DisableAppResponseDataType` object. - enum: - - deployment - type: string - x-enum-varnames: - - DEPLOYMENT DomainAllowlist: description: The email domain allowlist for an org. properties: @@ -11721,95 +10974,6 @@ components: type: string x-enum-varnames: - GCP_SERVICE_ACCOUNT - GetAppResponse: - description: The definition of `GetAppResponse` object. - properties: - data: - $ref: '#/components/schemas/GetAppResponseData' - included: - description: The `GetAppResponse` `included`. - items: - $ref: '#/components/schemas/DeploymentIncluded' - type: array - meta: - $ref: '#/components/schemas/AppMeta' - relationship: - $ref: '#/components/schemas/GetAppResponseRelationship' - type: object - GetAppResponseData: - description: The definition of `GetAppResponseData` object. - properties: - attributes: - $ref: '#/components/schemas/GetAppResponseDataAttributes' - id: - description: The `data` `id`. - example: '' - type: string - type: - $ref: '#/components/schemas/GetAppResponseDataType' - required: - - id - - type - - attributes - type: object - GetAppResponseDataAttributes: - description: The definition of `GetAppResponseDataAttributes` object. - properties: - components: - description: The `attributes` `components`. - items: - $ref: '#/components/schemas/ComponentGrid' - type: array - description: - description: The `attributes` `description`. - type: string - embeddedQueries: - description: The `attributes` `embeddedQueries`. - items: - $ref: '#/components/schemas/Query' - type: array - favorite: - description: The `attributes` `favorite`. - type: boolean - inputSchema: - $ref: '#/components/schemas/InputSchema' - name: - description: The `attributes` `name`. - type: string - rootInstanceName: - description: The `attributes` `rootInstanceName`. - type: string - scripts: - description: The `attributes` `scripts`. - items: - $ref: '#/components/schemas/Script' - type: array - tags: - description: The `attributes` `tags`. - items: - type: string - type: array - type: object - GetAppResponseDataType: - default: appDefinitions - description: The definition of `GetAppResponseDataType` object. - enum: - - appDefinitions - example: appDefinitions - type: string - x-enum-varnames: - - APPDEFINITIONS - GetAppResponseRelationship: - description: The definition of `GetAppResponseRelationship` object. - properties: - connections: - description: The `relationship` `connections`. - items: - $ref: '#/components/schemas/CustomConnection' - type: array - deployment: - $ref: '#/components/schemas/DeploymentRelationship' - type: object GetDataDeletionsResponseBody: description: The response from the get data deletion requests endpoint. properties: @@ -14463,77 +13627,6 @@ components: - ONCALL - INCIDENT - RELATION - InputSchema: - description: The definition of `InputSchema` object. - properties: - data: - $ref: '#/components/schemas/InputSchemaData' - type: object - InputSchemaData: - description: The definition of `InputSchemaData` object. - properties: - attributes: - $ref: '#/components/schemas/InputSchemaDataAttributes' - id: - description: The `data` `id`. - type: string - type: - $ref: '#/components/schemas/InputSchemaDataType' - type: object - InputSchemaDataAttributes: - description: The definition of `InputSchemaDataAttributes` object. - properties: - parameters: - description: The `attributes` `parameters`. - items: - $ref: '#/components/schemas/InputSchemaDataAttributesParametersItems' - type: array - type: object - InputSchemaDataAttributesParametersItems: - description: The definition of `InputSchemaDataAttributesParametersItems` object. - properties: - data: - $ref: '#/components/schemas/InputSchemaDataAttributesParametersItemsData' - type: object - InputSchemaDataAttributesParametersItemsData: - description: The definition of `InputSchemaDataAttributesParametersItemsData` - object. - properties: - attributes: - $ref: '#/components/schemas/InputSchemaDataAttributesParametersItemsDataAttributes' - type: object - InputSchemaDataAttributesParametersItemsDataAttributes: - description: The definition of `InputSchemaDataAttributesParametersItemsDataAttributes` - object. - properties: - defaultValue: - description: The `attributes` `defaultValue`. - description: - description: The `attributes` `description`. - type: string - enum: - description: The `attributes` `enum`. - items: - type: string - type: array - label: - description: The `attributes` `label`. - type: string - name: - description: The `attributes` `name`. - type: string - type: - description: The `attributes` `type`. - type: string - type: object - InputSchemaDataType: - default: inputSchema - description: The definition of `InputSchemaDataType` object. - enum: - - inputSchema - type: string - x-enum-varnames: - - INPUTSCHEMA IntakePayloadAccepted: description: The payload accepted for intake. properties: @@ -14919,96 +14012,6 @@ components: meta: $ref: '#/components/schemas/ApplicationKeyResponseMeta' type: object - ListAppsResponse: - description: The definition of `ListAppsResponse` object. - properties: - data: - description: The `ListAppsResponse` `data`. - items: - $ref: '#/components/schemas/ListAppsResponseDataItems' - type: array - included: - description: The `ListAppsResponse` `included`. - items: - $ref: '#/components/schemas/DeploymentIncluded' - type: array - meta: - $ref: '#/components/schemas/ListAppsResponseMeta' - type: object - ListAppsResponseDataItems: - description: The definition of `ListAppsResponseDataItems` object. - properties: - attributes: - $ref: '#/components/schemas/ListAppsResponseDataItemsAttributes' - id: - description: The `items` `id`. - example: '' - type: string - meta: - $ref: '#/components/schemas/AppMeta' - relationships: - $ref: '#/components/schemas/ListAppsResponseDataItemsRelationships' - type: - $ref: '#/components/schemas/ListAppsResponseDataItemsType' - required: - - id - - type - - attributes - type: object - ListAppsResponseDataItemsAttributes: - description: The definition of `ListAppsResponseDataItemsAttributes` object. - properties: - description: - description: The `attributes` `description`. - type: string - favorite: - description: The `attributes` `favorite`. - type: boolean - name: - description: The `attributes` `name`. - type: string - selfService: - description: The `attributes` `selfService`. - type: boolean - tags: - description: The `attributes` `tags`. - items: - type: string - type: array - type: object - ListAppsResponseDataItemsRelationships: - description: The definition of `ListAppsResponseDataItemsRelationships` object. - properties: - deployment: - $ref: '#/components/schemas/DeploymentRelationship' - type: object - ListAppsResponseDataItemsType: - default: appDefinitions - description: The definition of `ListAppsResponseDataItemsType` object. - enum: - - appDefinitions - example: appDefinitions - type: string - x-enum-varnames: - - APPDEFINITIONS - ListAppsResponseMeta: - description: The definition of `ListAppsResponseMeta` object. - properties: - page: - $ref: '#/components/schemas/ListAppsResponseMetaPage' - type: object - ListAppsResponseMetaPage: - description: The definition of `ListAppsResponseMetaPage` object. - properties: - totalCount: - description: The `page` `totalCount`. - format: int64 - type: integer - totalFilteredCount: - description: The `page` `totalFilteredCount`. - format: int64 - type: integer - type: object ListDevicesResponse: description: List devices response. properties: @@ -19777,31 +18780,6 @@ components: $ref: '#/components/schemas/Project' type: array type: object - Query: - description: The definition of `Query` object. - properties: - events: - description: The `Query` `events`. - items: - $ref: '#/components/schemas/AppBuilderEvent' - type: array - id: - description: The `Query` `id`. - example: '' - type: string - name: - description: The `Query` `name`. - example: '' - type: string - properties: - description: The `Query` `properties`. - type: - $ref: '#/components/schemas/QueryType' - required: - - id - - name - - type - type: object QueryFormula: description: A formula for calculation based on one or more queries. properties: @@ -19825,18 +18803,6 @@ components: x-enum-varnames: - ASC - DESC - QueryType: - description: The definition of `QueryType` object. - enum: - - action - - stateVariable - - dataTransform - example: action - type: string - x-enum-varnames: - - ACTION - - STATEVARIABLE - - DATATRANSFORM RUMAggregateBucketValue: description: A bucket value, can be either a timeseries or a single value. oneOf: @@ -22371,44 +21337,6 @@ components: type: string x-enum-varnames: - SCORECARD - Script: - description: The definition of `Script` object. - properties: - data: - $ref: '#/components/schemas/ScriptData' - type: object - ScriptData: - description: The definition of `ScriptData` object. - properties: - attributes: - $ref: '#/components/schemas/ScriptDataAttributes' - id: - description: The `data` `id`. - type: string - type: - $ref: '#/components/schemas/ScriptDataType' - type: object - ScriptDataAttributes: - description: The definition of `ScriptDataAttributes` object. - properties: - name: - description: The `attributes` `name`. - type: string - src: - description: The `attributes` `src`. - type: string - type: - description: The `attributes` `type`. - type: string - type: object - ScriptDataType: - default: scripts - description: The definition of `ScriptDataType` object. - enum: - - scripts - type: string - x-enum-varnames: - - SCRIPTS SecurityFilter: description: The security filter's properties. properties: @@ -28002,197 +26930,6 @@ components: example: min type: string type: object - UpdateAppRequest: - description: The definition of `UpdateAppRequest` object. - example: - data: - attributes: - components: - - events: [] - name: grid0 - properties: - children: - - events: [] - name: gridCell0 - properties: - children: - - events: [] - name: calloutValue0 - properties: - isDisabled: false - isLoading: false - isVisible: true - label: CPU Usage - size: sm - style: vivid_yellow - unit: kB - value: '42' - type: calloutValue - isVisible: 'true' - layout: - default: - height: 8 - width: 2 - x: 0 - y: 0 - type: gridCell - type: grid - description: This is a simple example app - embeddedQueries: [] - name: Example App - rootInstanceName: grid0 - id: 9e20cbaf-68da-45a6-9ccf-54193ac29fa5 - type: appDefinitions - properties: - data: - $ref: '#/components/schemas/UpdateAppRequestData' - type: object - UpdateAppRequestData: - description: The definition of `UpdateAppRequestData` object. - properties: - attributes: - $ref: '#/components/schemas/UpdateAppRequestDataAttributes' - id: - description: The `data` `id`. - type: string - type: - $ref: '#/components/schemas/UpdateAppRequestDataType' - required: - - type - type: object - UpdateAppRequestDataAttributes: - description: The definition of `UpdateAppRequestDataAttributes` object. - properties: - components: - description: The `attributes` `components`. - items: - $ref: '#/components/schemas/ComponentGrid' - type: array - description: - description: The `attributes` `description`. - type: string - embeddedQueries: - description: The `attributes` `embeddedQueries`. - items: - $ref: '#/components/schemas/Query' - type: array - inputSchema: - $ref: '#/components/schemas/InputSchema' - name: - description: The `attributes` `name`. - type: string - rootInstanceName: - description: The `attributes` `rootInstanceName`. - type: string - scripts: - description: The `attributes` `scripts`. - items: - $ref: '#/components/schemas/Script' - type: array - tags: - description: The `attributes` `tags`. - items: - type: string - type: array - type: object - UpdateAppRequestDataType: - default: appDefinitions - description: The definition of `UpdateAppRequestDataType` object. - enum: - - appDefinitions - example: appDefinitions - type: string - x-enum-varnames: - - APPDEFINITIONS - UpdateAppResponse: - description: The definition of `UpdateAppResponse` object. - properties: - data: - $ref: '#/components/schemas/UpdateAppResponseData' - included: - description: The `UpdateAppResponse` `included`. - items: - $ref: '#/components/schemas/DeploymentIncluded' - type: array - meta: - $ref: '#/components/schemas/AppMeta' - relationship: - $ref: '#/components/schemas/UpdateAppResponseRelationship' - type: object - UpdateAppResponseData: - description: The definition of `UpdateAppResponseData` object. - properties: - attributes: - $ref: '#/components/schemas/UpdateAppResponseDataAttributes' - id: - description: The `data` `id`. - example: '' - type: string - type: - $ref: '#/components/schemas/UpdateAppResponseDataType' - required: - - id - - type - - attributes - type: object - UpdateAppResponseDataAttributes: - description: The definition of `UpdateAppResponseDataAttributes` object. - properties: - components: - description: The `attributes` `components`. - items: - $ref: '#/components/schemas/ComponentGrid' - type: array - description: - description: The `attributes` `description`. - type: string - embeddedQueries: - description: The `attributes` `embeddedQueries`. - items: - $ref: '#/components/schemas/Query' - type: array - favorite: - description: The `attributes` `favorite`. - type: boolean - inputSchema: - $ref: '#/components/schemas/InputSchema' - name: - description: The `attributes` `name`. - type: string - rootInstanceName: - description: The `attributes` `rootInstanceName`. - type: string - scripts: - description: The `attributes` `scripts`. - items: - $ref: '#/components/schemas/Script' - type: array - tags: - description: The `attributes` `tags`. - items: - type: string - type: array - type: object - UpdateAppResponseDataType: - default: appDefinitions - description: The definition of `UpdateAppResponseDataType` object. - enum: - - appDefinitions - example: appDefinitions - type: string - x-enum-varnames: - - APPDEFINITIONS - UpdateAppResponseRelationship: - description: The definition of `UpdateAppResponseRelationship` object. - properties: - connections: - description: The `relationship` `connections`. - items: - $ref: '#/components/schemas/CustomConnection' - type: array - deployment: - $ref: '#/components/schemas/DeploymentRelationship' - type: object UpdateOpenAPIResponse: description: Response for `UpdateOpenAPI`. properties: @@ -29951,430 +28688,6 @@ paths: permissions: - apm_retention_filter_write - apm_pipelines_write - /api/v2/app-builder/apps: - delete: - description: Delete multiple apps by ID - operationId: DeleteApps - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/DeleteAppsRequest' - required: true - responses: - '200': - content: - application/json: - schema: - $ref: '#/components/schemas/DeleteAppsResponse' - description: OK - '400': - content: - application/json: - schema: - $ref: '#/components/schemas/AppBuilderError' - description: Bad Request - '403': - content: - application/json: - schema: - $ref: '#/components/schemas/AppBuilderError' - description: Forbidden, e.g. missing permissions to delete one or more apps - '404': - content: - application/json: - schema: - $ref: '#/components/schemas/AppBuilderError' - description: Not Found - '429': - $ref: '#/components/responses/TooManyRequestsResponse' - summary: Delete Multiple Apps - tags: - - Apps - x-permission: - operator: OR - permissions: - - apps_write - x-unstable: '**Note**: App Builder API endpoints are still under active development - and may change at any time.' - get: - description: List all apps, with optional filters and sorting - operationId: ListApps - parameters: - - description: The number of apps to return per page - in: query - name: limit - required: false - schema: - format: int64 - type: integer - - description: The page number to return - in: query - name: page - required: false - schema: - format: int64 - type: integer - - description: The `AppsFilter` `user_name`. - in: query - name: filter[user_name] - required: false - schema: - type: string - - description: The `AppsFilter` `user_uuid`. - in: query - name: filter[user_uuid] - required: false - schema: - type: string - - description: The `AppsFilter` `name`. - in: query - name: filter[name] - required: false - schema: - type: string - - description: The `AppsFilter` `query`. - in: query - name: filter[query] - required: false - schema: - type: string - - description: The `AppsFilter` `deployed`. - in: query - name: filter[deployed] - required: false - schema: - type: boolean - - description: The `AppsFilter` `tags`. - in: query - name: filter[tags] - required: false - schema: - type: string - - description: The `AppsFilter` `favorite`. - in: query - name: filter[favorite] - required: false - schema: - type: boolean - - explode: false - in: query - name: sort - required: false - schema: - items: - $ref: '#/components/schemas/AppsSortField' - type: array - style: form - responses: - '200': - content: - application/json: - schema: - $ref: '#/components/schemas/ListAppsResponse' - description: OK - '400': - content: - application/json: - schema: - $ref: '#/components/schemas/AppBuilderError' - description: Bad Request, e.g. invalid sort parameter - '403': - content: - application/json: - schema: - $ref: '#/components/schemas/AppBuilderError' - description: Forbidden - '429': - $ref: '#/components/responses/TooManyRequestsResponse' - summary: List Apps - tags: - - Apps - x-permission: - operator: OR - permissions: - - apps_run - x-unstable: '**Note**: App Builder API endpoints are still under active development - and may change at any time.' - post: - description: Create a new app, returning the app ID - operationId: CreateApp - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/CreateAppRequest' - required: true - responses: - '201': - content: - application/json: - schema: - $ref: '#/components/schemas/CreateAppResponse' - description: App Created - '400': - content: - application/json: - schema: - $ref: '#/components/schemas/AppBuilderError' - description: Bad Request - '403': - content: - application/json: - schema: - $ref: '#/components/schemas/AppBuilderError' - description: Forbidden, e.g. missing required permissions to a connection - or workflow used in the app - '429': - $ref: '#/components/responses/TooManyRequestsResponse' - summary: Create App - tags: - - Apps - x-permission: - operator: AND - permissions: - - apps_write - - connections_resolve - - workflows_run - x-unstable: '**Note**: App Builder API endpoints are still under active development - and may change at any time.' - /api/v2/app-builder/apps/{app_id}: - delete: - description: Delete an app by ID - operationId: DeleteApp - parameters: - - in: path - name: app_id - required: true - schema: - type: string - responses: - '200': - content: - application/json: - schema: - $ref: '#/components/schemas/DeleteAppResponse' - description: OK - '400': - content: - application/json: - schema: - $ref: '#/components/schemas/AppBuilderError' - description: Bad Request - '403': - content: - application/json: - schema: - $ref: '#/components/schemas/AppBuilderError' - description: Forbidden - '404': - content: - application/json: - schema: - $ref: '#/components/schemas/AppBuilderError' - description: Not Found - '410': - content: - application/json: - schema: - $ref: '#/components/schemas/AppBuilderError' - description: Gone - '429': - $ref: '#/components/responses/TooManyRequestsResponse' - summary: Delete App - tags: - - Apps - x-permission: - operator: OR - permissions: - - apps_write - x-unstable: '**Note**: App Builder API endpoints are still under active development - and may change at any time.' - get: - description: Get the full definition of an app by ID - operationId: GetApp - parameters: - - in: path - name: app_id - required: true - schema: - type: string - responses: - '200': - content: - application/json: - schema: - $ref: '#/components/schemas/GetAppResponse' - description: OK - '400': - content: - application/json: - schema: - $ref: '#/components/schemas/AppBuilderError' - description: Bad Request - '403': - content: - application/json: - schema: - $ref: '#/components/schemas/AppBuilderError' - description: Forbidden - '404': - content: - application/json: - schema: - $ref: '#/components/schemas/AppBuilderError' - description: Not Found - '429': - $ref: '#/components/responses/TooManyRequestsResponse' - summary: Get App - tags: - - Apps - x-permission: - operator: AND - permissions: - - apps_run - - connections_read - x-unstable: '**Note**: App Builder API endpoints are still under active development - and may change at any time.' - patch: - description: Update an existing app by ID. Creates a new version of the app - operationId: UpdateApp - parameters: - - in: path - name: app_id - required: true - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/UpdateAppRequest' - required: true - responses: - '200': - content: - application/json: - schema: - $ref: '#/components/schemas/UpdateAppResponse' - description: OK - '400': - content: - application/json: - schema: - $ref: '#/components/schemas/AppBuilderError' - description: Bad Request - '403': - content: - application/json: - schema: - $ref: '#/components/schemas/AppBuilderError' - description: Forbidden, e.g. missing required permissions to a connection - or workflow used in the app - '429': - $ref: '#/components/responses/TooManyRequestsResponse' - summary: Update App - tags: - - Apps - x-permission: - operator: AND - permissions: - - apps_write - - connections_resolve - - workflows_run - x-unstable: '**Note**: App Builder API endpoints are still under active development - and may change at any time.' - /api/v2/app-builder/apps/{app_id}/deployment: - delete: - description: Disable an app by ID - operationId: DisableApp - parameters: - - in: path - name: app_id - required: true - schema: - type: string - responses: - '200': - content: - application/json: - schema: - $ref: '#/components/schemas/DisableAppResponse' - description: OK - '400': - content: - application/json: - schema: - $ref: '#/components/schemas/AppBuilderError' - description: Bad Request - '403': - content: - application/json: - schema: - $ref: '#/components/schemas/AppBuilderError' - description: Forbidden - '404': - content: - application/json: - schema: - $ref: '#/components/schemas/AppBuilderError' - description: Not Found - '429': - $ref: '#/components/responses/TooManyRequestsResponse' - summary: Disable App - tags: - - App Deployment - x-permission: - operator: OR - permissions: - - apps_write - x-unstable: '**Note**: App Builder API endpoints are still under active development - and may change at any time.' - post: - description: Deploy (publish) an app by ID - operationId: DeployApp - parameters: - - in: path - name: app_id - required: true - schema: - type: string - responses: - '201': - content: - application/json: - schema: - $ref: '#/components/schemas/DeployAppResponse' - description: Created - '400': - content: - application/json: - schema: - $ref: '#/components/schemas/AppBuilderError' - description: Bad Request - '403': - content: - application/json: - schema: - $ref: '#/components/schemas/AppBuilderError' - description: Forbidden - '404': - content: - application/json: - schema: - $ref: '#/components/schemas/AppBuilderError' - description: Not Found - '429': - $ref: '#/components/responses/TooManyRequestsResponse' - summary: Deploy App - tags: - - App Deployment - x-permission: - operator: OR - permissions: - - apps_write - x-unstable: '**Note**: App Builder API endpoints are still under active development - and may change at any time.' /api/v2/application_keys: get: description: List all application keys available for your org @@ -46288,10 +44601,6 @@ tags: externalDocs: url: https://docs.datadoghq.com/integrations/amazon_web_services/#log-collection name: AWS Logs Integration -- description: Deploy and disable apps in App Builder. - name: App Deployment -- description: Create, read, update, and delete apps in App Builder. - name: Apps - description: Search your Audit Logs events over HTTP. name: Audit - description: '[The AuthN Mappings API](https://docs.datadoghq.com/account_management/authn_mapping/?tab=example) diff --git a/examples/v2_app-deployment_DeployApp.rs b/examples/v2_app-deployment_DeployApp.rs deleted file mode 100644 index 27dd9dcdd..000000000 --- a/examples/v2_app-deployment_DeployApp.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Deploy App returns "Created" response -use datadog_api_client::datadog; -use datadog_api_client::datadogV2::api_app_deployment::AppDeploymentAPI; - -#[tokio::main] -async fn main() { - // there is a valid "app" in the system - let app_data_id = std::env::var("APP_DATA_ID").unwrap(); - let mut configuration = datadog::Configuration::new(); - configuration.set_unstable_operation_enabled("v2.DeployApp", true); - let api = AppDeploymentAPI::with_config(configuration); - let resp = api.deploy_app(app_data_id.clone()).await; - if let Ok(value) = resp { - println!("{:#?}", value); - } else { - println!("{:#?}", resp.unwrap_err()); - } -} diff --git a/examples/v2_app-deployment_DisableApp.rs b/examples/v2_app-deployment_DisableApp.rs deleted file mode 100644 index d12e7c6c5..000000000 --- a/examples/v2_app-deployment_DisableApp.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Disable App returns "OK" response -use datadog_api_client::datadog; -use datadog_api_client::datadogV2::api_app_deployment::AppDeploymentAPI; - -#[tokio::main] -async fn main() { - // there is a valid "app" in the system - let app_data_id = std::env::var("APP_DATA_ID").unwrap(); - let mut configuration = datadog::Configuration::new(); - configuration.set_unstable_operation_enabled("v2.DisableApp", true); - let api = AppDeploymentAPI::with_config(configuration); - let resp = api.disable_app(app_data_id.clone()).await; - if let Ok(value) = resp { - println!("{:#?}", value); - } else { - println!("{:#?}", resp.unwrap_err()); - } -} diff --git a/examples/v2_apps_CreateApp.rs b/examples/v2_apps_CreateApp.rs deleted file mode 100644 index 8a7eb8516..000000000 --- a/examples/v2_apps_CreateApp.rs +++ /dev/null @@ -1,55 +0,0 @@ -// Create App returns "App Created" response -use datadog_api_client::datadog; -use datadog_api_client::datadogV2::api_apps::AppsAPI; -use datadog_api_client::datadogV2::model::Component; -use datadog_api_client::datadogV2::model::ComponentGrid; -use datadog_api_client::datadogV2::model::ComponentGridProperties; -use datadog_api_client::datadogV2::model::ComponentGridType; -use datadog_api_client::datadogV2::model::ComponentProperties; -use datadog_api_client::datadogV2::model::ComponentPropertiesIsVisible; -use datadog_api_client::datadogV2::model::ComponentType; -use datadog_api_client::datadogV2::model::CreateAppRequest; -use datadog_api_client::datadogV2::model::CreateAppRequestData; -use datadog_api_client::datadogV2::model::CreateAppRequestDataAttributes; -use datadog_api_client::datadogV2::model::CreateAppRequestDataType; - -#[tokio::main] -async fn main() { - let body = CreateAppRequest::new().data( - CreateAppRequestData::new(CreateAppRequestDataType::APPDEFINITIONS).attributes( - CreateAppRequestDataAttributes::new() - .components(vec![ComponentGrid::new( - "grid0".to_string(), - ComponentGridProperties::new().children(vec![Component::new( - "gridCell0".to_string(), - ComponentProperties::new() - .children(vec![Component::new( - "calloutValue0".to_string(), - ComponentProperties::new() - .is_visible(ComponentPropertiesIsVisible::Bool(true)), - ComponentType::CALLOUTVALUE, - ) - .events(vec![])]) - .is_visible(ComponentPropertiesIsVisible::String("true".to_string())), - ComponentType::GRIDCELL, - ) - .events(vec![])]), - ComponentGridType::GRID, - ) - .events(vec![])]) - .description("This is a simple example app".to_string()) - .embedded_queries(vec![]) - .name("Example App".to_string()) - .root_instance_name("grid0".to_string()), - ), - ); - let mut configuration = datadog::Configuration::new(); - configuration.set_unstable_operation_enabled("v2.CreateApp", true); - let api = AppsAPI::with_config(configuration); - let resp = api.create_app(body).await; - if let Ok(value) = resp { - println!("{:#?}", value); - } else { - println!("{:#?}", resp.unwrap_err()); - } -} diff --git a/examples/v2_apps_DeleteApp.rs b/examples/v2_apps_DeleteApp.rs deleted file mode 100644 index 43eb44227..000000000 --- a/examples/v2_apps_DeleteApp.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Delete App returns "OK" response -use datadog_api_client::datadog; -use datadog_api_client::datadogV2::api_apps::AppsAPI; - -#[tokio::main] -async fn main() { - // there is a valid "app" in the system - let app_data_id = std::env::var("APP_DATA_ID").unwrap(); - let mut configuration = datadog::Configuration::new(); - configuration.set_unstable_operation_enabled("v2.DeleteApp", true); - let api = AppsAPI::with_config(configuration); - let resp = api.delete_app(app_data_id.clone()).await; - if let Ok(value) = resp { - println!("{:#?}", value); - } else { - println!("{:#?}", resp.unwrap_err()); - } -} diff --git a/examples/v2_apps_DeleteApps.rs b/examples/v2_apps_DeleteApps.rs deleted file mode 100644 index 59491dd2a..000000000 --- a/examples/v2_apps_DeleteApps.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Delete Multiple Apps returns "OK" response -use datadog_api_client::datadog; -use datadog_api_client::datadogV2::api_apps::AppsAPI; -use datadog_api_client::datadogV2::model::DeleteAppsRequest; -use datadog_api_client::datadogV2::model::DeleteAppsRequestDataItems; -use datadog_api_client::datadogV2::model::DeleteAppsRequestDataItemsType; - -#[tokio::main] -async fn main() { - // there is a valid "app" in the system - let app_data_id = std::env::var("APP_DATA_ID").unwrap(); - let body = DeleteAppsRequest::new().data(vec![DeleteAppsRequestDataItems::new( - app_data_id.clone(), - DeleteAppsRequestDataItemsType::APPDEFINITIONS, - )]); - let mut configuration = datadog::Configuration::new(); - configuration.set_unstable_operation_enabled("v2.DeleteApps", true); - let api = AppsAPI::with_config(configuration); - let resp = api.delete_apps(body).await; - if let Ok(value) = resp { - println!("{:#?}", value); - } else { - println!("{:#?}", resp.unwrap_err()); - } -} diff --git a/examples/v2_apps_GetApp.rs b/examples/v2_apps_GetApp.rs deleted file mode 100644 index 0cd550bf5..000000000 --- a/examples/v2_apps_GetApp.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Get App returns "OK" response -use datadog_api_client::datadog; -use datadog_api_client::datadogV2::api_apps::AppsAPI; - -#[tokio::main] -async fn main() { - // there is a valid "app" in the system - let app_data_id = std::env::var("APP_DATA_ID").unwrap(); - let mut configuration = datadog::Configuration::new(); - configuration.set_unstable_operation_enabled("v2.GetApp", true); - let api = AppsAPI::with_config(configuration); - let resp = api.get_app(app_data_id.clone()).await; - if let Ok(value) = resp { - println!("{:#?}", value); - } else { - println!("{:#?}", resp.unwrap_err()); - } -} diff --git a/examples/v2_apps_ListApps.rs b/examples/v2_apps_ListApps.rs deleted file mode 100644 index 7d6d3bf9d..000000000 --- a/examples/v2_apps_ListApps.rs +++ /dev/null @@ -1,17 +0,0 @@ -// List Apps returns "OK" response -use datadog_api_client::datadog; -use datadog_api_client::datadogV2::api_apps::AppsAPI; -use datadog_api_client::datadogV2::api_apps::ListAppsOptionalParams; - -#[tokio::main] -async fn main() { - let mut configuration = datadog::Configuration::new(); - configuration.set_unstable_operation_enabled("v2.ListApps", true); - let api = AppsAPI::with_config(configuration); - let resp = api.list_apps(ListAppsOptionalParams::default()).await; - if let Ok(value) = resp { - println!("{:#?}", value); - } else { - println!("{:#?}", resp.unwrap_err()); - } -} diff --git a/examples/v2_apps_UpdateApp.rs b/examples/v2_apps_UpdateApp.rs deleted file mode 100644 index b04fc833a..000000000 --- a/examples/v2_apps_UpdateApp.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Update App returns "OK" response -use datadog_api_client::datadog; -use datadog_api_client::datadogV2::api_apps::AppsAPI; -use datadog_api_client::datadogV2::model::UpdateAppRequest; -use datadog_api_client::datadogV2::model::UpdateAppRequestData; -use datadog_api_client::datadogV2::model::UpdateAppRequestDataAttributes; -use datadog_api_client::datadogV2::model::UpdateAppRequestDataType; - -#[tokio::main] -async fn main() { - // there is a valid "app" in the system - let app_data_id = std::env::var("APP_DATA_ID").unwrap(); - let body = UpdateAppRequest::new().data( - UpdateAppRequestData::new(UpdateAppRequestDataType::APPDEFINITIONS) - .attributes( - UpdateAppRequestDataAttributes::new() - .name("Updated Name".to_string()) - .root_instance_name("grid0".to_string()), - ) - .id(app_data_id.clone()), - ); - let mut configuration = datadog::Configuration::new(); - configuration.set_unstable_operation_enabled("v2.UpdateApp", true); - let api = AppsAPI::with_config(configuration); - let resp = api.update_app(app_data_id.clone(), body).await; - if let Ok(value) = resp { - println!("{:#?}", value); - } else { - println!("{:#?}", resp.unwrap_err()); - } -} diff --git a/src/datadog/configuration.rs b/src/datadog/configuration.rs index b50265f50..2672d6143 100644 --- a/src/datadog/configuration.rs +++ b/src/datadog/configuration.rs @@ -134,14 +134,6 @@ impl Default for Configuration { ("v2.get_open_api".to_owned(), false), ("v2.list_apis".to_owned(), false), ("v2.update_open_api".to_owned(), false), - ("v2.create_app".to_owned(), false), - ("v2.delete_app".to_owned(), false), - ("v2.delete_apps".to_owned(), false), - ("v2.get_app".to_owned(), false), - ("v2.list_apps".to_owned(), false), - ("v2.update_app".to_owned(), false), - ("v2.deploy_app".to_owned(), false), - ("v2.disable_app".to_owned(), false), ("v2.get_active_billing_dimensions".to_owned(), false), ("v2.get_billing_dimension_mapping".to_owned(), false), ("v2.get_monthly_cost_attribution".to_owned(), false), diff --git a/src/datadogV2/api/api_app_deployment.rs b/src/datadogV2/api/api_app_deployment.rs deleted file mode 100644 index 8f61c3185..000000000 --- a/src/datadogV2/api/api_app_deployment.rs +++ /dev/null @@ -1,316 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use crate::datadog; -use log::warn; -use reqwest::header::{HeaderMap, HeaderValue}; -use serde::{Deserialize, Serialize}; - -/// DeployAppError is a struct for typed errors of method [`AppDeploymentAPI::deploy_app`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeployAppError { - AppBuilderError(crate::datadogV2::model::AppBuilderError), - APIErrorResponse(crate::datadogV2::model::APIErrorResponse), - UnknownValue(serde_json::Value), -} - -/// DisableAppError is a struct for typed errors of method [`AppDeploymentAPI::disable_app`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DisableAppError { - AppBuilderError(crate::datadogV2::model::AppBuilderError), - APIErrorResponse(crate::datadogV2::model::APIErrorResponse), - UnknownValue(serde_json::Value), -} - -/// Deploy and disable apps in App Builder. -#[derive(Debug, Clone)] -pub struct AppDeploymentAPI { - config: datadog::Configuration, - client: reqwest_middleware::ClientWithMiddleware, -} - -impl Default for AppDeploymentAPI { - fn default() -> Self { - Self::with_config(datadog::Configuration::default()) - } -} - -impl AppDeploymentAPI { - pub fn new() -> Self { - Self::default() - } - pub fn with_config(config: datadog::Configuration) -> Self { - let mut reqwest_client_builder = reqwest::Client::builder(); - - if let Some(proxy_url) = &config.proxy_url { - let proxy = reqwest::Proxy::all(proxy_url).expect("Failed to parse proxy URL"); - reqwest_client_builder = reqwest_client_builder.proxy(proxy); - } - - let mut middleware_client_builder = - reqwest_middleware::ClientBuilder::new(reqwest_client_builder.build().unwrap()); - - if config.enable_retry { - struct RetryableStatus; - impl reqwest_retry::RetryableStrategy for RetryableStatus { - fn handle( - &self, - res: &Result, - ) -> Option { - match res { - Ok(success) => reqwest_retry::default_on_request_success(success), - Err(_) => None, - } - } - } - let backoff_policy = reqwest_retry::policies::ExponentialBackoff::builder() - .build_with_max_retries(config.max_retries); - - let retry_middleware = - reqwest_retry::RetryTransientMiddleware::new_with_policy_and_strategy( - backoff_policy, - RetryableStatus, - ); - - middleware_client_builder = middleware_client_builder.with(retry_middleware); - } - - let client = middleware_client_builder.build(); - - Self { config, client } - } - - pub fn with_client_and_config( - config: datadog::Configuration, - client: reqwest_middleware::ClientWithMiddleware, - ) -> Self { - Self { config, client } - } - - /// Deploy (publish) an app by ID - pub async fn deploy_app( - &self, - app_id: String, - ) -> Result> { - match self.deploy_app_with_http_info(app_id).await { - Ok(response_content) => { - if let Some(e) = response_content.entity { - Ok(e) - } else { - Err(datadog::Error::Serde(serde::de::Error::custom( - "response content was None", - ))) - } - } - Err(err) => Err(err), - } - } - - /// Deploy (publish) an app by ID - pub async fn deploy_app_with_http_info( - &self, - app_id: String, - ) -> Result< - datadog::ResponseContent, - datadog::Error, - > { - let local_configuration = &self.config; - let operation_id = "v2.deploy_app"; - if local_configuration.is_unstable_operation_enabled(operation_id) { - warn!("Using unstable operation {operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.deploy_app' is not enabled".to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } - - let local_client = &self.client; - - let local_uri_str = format!( - "{}/api/v2/app-builder/apps/{app_id}/deployment", - local_configuration.get_operation_host(operation_id), - app_id = datadog::urlencode(app_id) - ); - let mut local_req_builder = - local_client.request(reqwest::Method::POST, local_uri_str.as_str()); - - // build headers - let mut headers = HeaderMap::new(); - headers.insert("Accept", HeaderValue::from_static("application/json")); - - // build user agent - match HeaderValue::from_str(local_configuration.user_agent.as_str()) { - Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), - Err(e) => { - log::warn!("Failed to parse user agent header: {e}, falling back to default"); - headers.insert( - reqwest::header::USER_AGENT, - HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), - ) - } - }; - - // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; - - local_req_builder = local_req_builder.headers(headers); - let local_req = local_req_builder.build()?; - log::debug!("request content: {:?}", local_req.body()); - let local_resp = local_client.execute(local_req).await?; - - let local_status = local_resp.status(); - let local_content = local_resp.text().await?; - log::debug!("response content: {}", local_content); - - if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::(&local_content) - { - Ok(e) => { - return Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: Some(e), - }) - } - Err(e) => return Err(datadog::Error::Serde(e)), - }; - } else { - let local_entity: Option = serde_json::from_str(&local_content).ok(); - let local_error = datadog::ResponseContent { - status: local_status, - content: local_content, - entity: local_entity, - }; - Err(datadog::Error::ResponseError(local_error)) - } - } - - /// Disable an app by ID - pub async fn disable_app( - &self, - app_id: String, - ) -> Result> { - match self.disable_app_with_http_info(app_id).await { - Ok(response_content) => { - if let Some(e) = response_content.entity { - Ok(e) - } else { - Err(datadog::Error::Serde(serde::de::Error::custom( - "response content was None", - ))) - } - } - Err(err) => Err(err), - } - } - - /// Disable an app by ID - pub async fn disable_app_with_http_info( - &self, - app_id: String, - ) -> Result< - datadog::ResponseContent, - datadog::Error, - > { - let local_configuration = &self.config; - let operation_id = "v2.disable_app"; - if local_configuration.is_unstable_operation_enabled(operation_id) { - warn!("Using unstable operation {operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.disable_app' is not enabled".to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } - - let local_client = &self.client; - - let local_uri_str = format!( - "{}/api/v2/app-builder/apps/{app_id}/deployment", - local_configuration.get_operation_host(operation_id), - app_id = datadog::urlencode(app_id) - ); - let mut local_req_builder = - local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); - - // build headers - let mut headers = HeaderMap::new(); - headers.insert("Accept", HeaderValue::from_static("application/json")); - - // build user agent - match HeaderValue::from_str(local_configuration.user_agent.as_str()) { - Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), - Err(e) => { - log::warn!("Failed to parse user agent header: {e}, falling back to default"); - headers.insert( - reqwest::header::USER_AGENT, - HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), - ) - } - }; - - // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; - - local_req_builder = local_req_builder.headers(headers); - let local_req = local_req_builder.build()?; - log::debug!("request content: {:?}", local_req.body()); - let local_resp = local_client.execute(local_req).await?; - - let local_status = local_resp.status(); - let local_content = local_resp.text().await?; - log::debug!("response content: {}", local_content); - - if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { - Ok(e) => { - return Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: Some(e), - }) - } - Err(e) => return Err(datadog::Error::Serde(e)), - }; - } else { - let local_entity: Option = serde_json::from_str(&local_content).ok(); - let local_error = datadog::ResponseContent { - status: local_status, - content: local_content, - entity: local_entity, - }; - Err(datadog::Error::ResponseError(local_error)) - } - } -} diff --git a/src/datadogV2/api/api_apps.rs b/src/datadogV2/api/api_apps.rs deleted file mode 100644 index 3b2eac039..000000000 --- a/src/datadogV2/api/api_apps.rs +++ /dev/null @@ -1,1078 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use crate::datadog; -use flate2::{ - write::{GzEncoder, ZlibEncoder}, - Compression, -}; -use log::warn; -use reqwest::header::{HeaderMap, HeaderValue}; -use serde::{Deserialize, Serialize}; -use std::io::Write; - -/// ListAppsOptionalParams is a struct for passing parameters to the method [`AppsAPI::list_apps`] -#[non_exhaustive] -#[derive(Clone, Default, Debug)] -pub struct ListAppsOptionalParams { - /// The number of apps to return per page - pub limit: Option, - /// The page number to return - pub page: Option, - /// The `AppsFilter` `user_name`. - pub filter_user_name: Option, - /// The `AppsFilter` `user_uuid`. - pub filter_user_uuid: Option, - /// The `AppsFilter` `name`. - pub filter_name: Option, - /// The `AppsFilter` `query`. - pub filter_query: Option, - /// The `AppsFilter` `deployed`. - pub filter_deployed: Option, - /// The `AppsFilter` `tags`. - pub filter_tags: Option, - /// The `AppsFilter` `favorite`. - pub filter_favorite: Option, - pub sort: Option>, -} - -impl ListAppsOptionalParams { - /// The number of apps to return per page - pub fn limit(mut self, value: i64) -> Self { - self.limit = Some(value); - self - } - /// The page number to return - pub fn page(mut self, value: i64) -> Self { - self.page = Some(value); - self - } - /// The `AppsFilter` `user_name`. - pub fn filter_user_name(mut self, value: String) -> Self { - self.filter_user_name = Some(value); - self - } - /// The `AppsFilter` `user_uuid`. - pub fn filter_user_uuid(mut self, value: String) -> Self { - self.filter_user_uuid = Some(value); - self - } - /// The `AppsFilter` `name`. - pub fn filter_name(mut self, value: String) -> Self { - self.filter_name = Some(value); - self - } - /// The `AppsFilter` `query`. - pub fn filter_query(mut self, value: String) -> Self { - self.filter_query = Some(value); - self - } - /// The `AppsFilter` `deployed`. - pub fn filter_deployed(mut self, value: bool) -> Self { - self.filter_deployed = Some(value); - self - } - /// The `AppsFilter` `tags`. - pub fn filter_tags(mut self, value: String) -> Self { - self.filter_tags = Some(value); - self - } - /// The `AppsFilter` `favorite`. - pub fn filter_favorite(mut self, value: bool) -> Self { - self.filter_favorite = Some(value); - self - } - pub fn sort(mut self, value: Vec) -> Self { - self.sort = Some(value); - self - } -} - -/// CreateAppError is a struct for typed errors of method [`AppsAPI::create_app`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateAppError { - AppBuilderError(crate::datadogV2::model::AppBuilderError), - APIErrorResponse(crate::datadogV2::model::APIErrorResponse), - UnknownValue(serde_json::Value), -} - -/// DeleteAppError is a struct for typed errors of method [`AppsAPI::delete_app`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteAppError { - AppBuilderError(crate::datadogV2::model::AppBuilderError), - APIErrorResponse(crate::datadogV2::model::APIErrorResponse), - UnknownValue(serde_json::Value), -} - -/// DeleteAppsError is a struct for typed errors of method [`AppsAPI::delete_apps`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteAppsError { - AppBuilderError(crate::datadogV2::model::AppBuilderError), - APIErrorResponse(crate::datadogV2::model::APIErrorResponse), - UnknownValue(serde_json::Value), -} - -/// GetAppError is a struct for typed errors of method [`AppsAPI::get_app`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetAppError { - AppBuilderError(crate::datadogV2::model::AppBuilderError), - APIErrorResponse(crate::datadogV2::model::APIErrorResponse), - UnknownValue(serde_json::Value), -} - -/// ListAppsError is a struct for typed errors of method [`AppsAPI::list_apps`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListAppsError { - AppBuilderError(crate::datadogV2::model::AppBuilderError), - APIErrorResponse(crate::datadogV2::model::APIErrorResponse), - UnknownValue(serde_json::Value), -} - -/// UpdateAppError is a struct for typed errors of method [`AppsAPI::update_app`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum UpdateAppError { - AppBuilderError(crate::datadogV2::model::AppBuilderError), - APIErrorResponse(crate::datadogV2::model::APIErrorResponse), - UnknownValue(serde_json::Value), -} - -/// Create, read, update, and delete apps in App Builder. -#[derive(Debug, Clone)] -pub struct AppsAPI { - config: datadog::Configuration, - client: reqwest_middleware::ClientWithMiddleware, -} - -impl Default for AppsAPI { - fn default() -> Self { - Self::with_config(datadog::Configuration::default()) - } -} - -impl AppsAPI { - pub fn new() -> Self { - Self::default() - } - pub fn with_config(config: datadog::Configuration) -> Self { - let mut reqwest_client_builder = reqwest::Client::builder(); - - if let Some(proxy_url) = &config.proxy_url { - let proxy = reqwest::Proxy::all(proxy_url).expect("Failed to parse proxy URL"); - reqwest_client_builder = reqwest_client_builder.proxy(proxy); - } - - let mut middleware_client_builder = - reqwest_middleware::ClientBuilder::new(reqwest_client_builder.build().unwrap()); - - if config.enable_retry { - struct RetryableStatus; - impl reqwest_retry::RetryableStrategy for RetryableStatus { - fn handle( - &self, - res: &Result, - ) -> Option { - match res { - Ok(success) => reqwest_retry::default_on_request_success(success), - Err(_) => None, - } - } - } - let backoff_policy = reqwest_retry::policies::ExponentialBackoff::builder() - .build_with_max_retries(config.max_retries); - - let retry_middleware = - reqwest_retry::RetryTransientMiddleware::new_with_policy_and_strategy( - backoff_policy, - RetryableStatus, - ); - - middleware_client_builder = middleware_client_builder.with(retry_middleware); - } - - let client = middleware_client_builder.build(); - - Self { config, client } - } - - pub fn with_client_and_config( - config: datadog::Configuration, - client: reqwest_middleware::ClientWithMiddleware, - ) -> Self { - Self { config, client } - } - - /// Create a new app, returning the app ID - pub async fn create_app( - &self, - body: crate::datadogV2::model::CreateAppRequest, - ) -> Result> { - match self.create_app_with_http_info(body).await { - Ok(response_content) => { - if let Some(e) = response_content.entity { - Ok(e) - } else { - Err(datadog::Error::Serde(serde::de::Error::custom( - "response content was None", - ))) - } - } - Err(err) => Err(err), - } - } - - /// Create a new app, returning the app ID - pub async fn create_app_with_http_info( - &self, - body: crate::datadogV2::model::CreateAppRequest, - ) -> Result< - datadog::ResponseContent, - datadog::Error, - > { - let local_configuration = &self.config; - let operation_id = "v2.create_app"; - if local_configuration.is_unstable_operation_enabled(operation_id) { - warn!("Using unstable operation {operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.create_app' is not enabled".to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } - - let local_client = &self.client; - - let local_uri_str = format!( - "{}/api/v2/app-builder/apps", - local_configuration.get_operation_host(operation_id) - ); - let mut local_req_builder = - local_client.request(reqwest::Method::POST, local_uri_str.as_str()); - - // build headers - let mut headers = HeaderMap::new(); - headers.insert("Content-Type", HeaderValue::from_static("application/json")); - headers.insert("Accept", HeaderValue::from_static("application/json")); - - // build user agent - match HeaderValue::from_str(local_configuration.user_agent.as_str()) { - Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), - Err(e) => { - log::warn!("Failed to parse user agent header: {e}, falling back to default"); - headers.insert( - reqwest::header::USER_AGENT, - HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), - ) - } - }; - - // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; - - // build body parameters - let output = Vec::new(); - let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); - if body.serialize(&mut ser).is_ok() { - if let Some(content_encoding) = headers.get("Content-Encoding") { - match content_encoding.to_str().unwrap_or_default() { - "gzip" => { - let mut enc = GzEncoder::new(Vec::new(), Compression::default()); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - "deflate" => { - let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - "zstd1" => { - let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - _ => { - local_req_builder = local_req_builder.body(ser.into_inner()); - } - } - } else { - local_req_builder = local_req_builder.body(ser.into_inner()); - } - } - - local_req_builder = local_req_builder.headers(headers); - let local_req = local_req_builder.build()?; - log::debug!("request content: {:?}", local_req.body()); - let local_resp = local_client.execute(local_req).await?; - - let local_status = local_resp.status(); - let local_content = local_resp.text().await?; - log::debug!("response content: {}", local_content); - - if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::(&local_content) - { - Ok(e) => { - return Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: Some(e), - }) - } - Err(e) => return Err(datadog::Error::Serde(e)), - }; - } else { - let local_entity: Option = serde_json::from_str(&local_content).ok(); - let local_error = datadog::ResponseContent { - status: local_status, - content: local_content, - entity: local_entity, - }; - Err(datadog::Error::ResponseError(local_error)) - } - } - - /// Delete an app by ID - pub async fn delete_app( - &self, - app_id: String, - ) -> Result> { - match self.delete_app_with_http_info(app_id).await { - Ok(response_content) => { - if let Some(e) = response_content.entity { - Ok(e) - } else { - Err(datadog::Error::Serde(serde::de::Error::custom( - "response content was None", - ))) - } - } - Err(err) => Err(err), - } - } - - /// Delete an app by ID - pub async fn delete_app_with_http_info( - &self, - app_id: String, - ) -> Result< - datadog::ResponseContent, - datadog::Error, - > { - let local_configuration = &self.config; - let operation_id = "v2.delete_app"; - if local_configuration.is_unstable_operation_enabled(operation_id) { - warn!("Using unstable operation {operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.delete_app' is not enabled".to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } - - let local_client = &self.client; - - let local_uri_str = format!( - "{}/api/v2/app-builder/apps/{app_id}", - local_configuration.get_operation_host(operation_id), - app_id = datadog::urlencode(app_id) - ); - let mut local_req_builder = - local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); - - // build headers - let mut headers = HeaderMap::new(); - headers.insert("Accept", HeaderValue::from_static("application/json")); - - // build user agent - match HeaderValue::from_str(local_configuration.user_agent.as_str()) { - Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), - Err(e) => { - log::warn!("Failed to parse user agent header: {e}, falling back to default"); - headers.insert( - reqwest::header::USER_AGENT, - HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), - ) - } - }; - - // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; - - local_req_builder = local_req_builder.headers(headers); - let local_req = local_req_builder.build()?; - log::debug!("request content: {:?}", local_req.body()); - let local_resp = local_client.execute(local_req).await?; - - let local_status = local_resp.status(); - let local_content = local_resp.text().await?; - log::debug!("response content: {}", local_content); - - if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::(&local_content) - { - Ok(e) => { - return Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: Some(e), - }) - } - Err(e) => return Err(datadog::Error::Serde(e)), - }; - } else { - let local_entity: Option = serde_json::from_str(&local_content).ok(); - let local_error = datadog::ResponseContent { - status: local_status, - content: local_content, - entity: local_entity, - }; - Err(datadog::Error::ResponseError(local_error)) - } - } - - /// Delete multiple apps by ID - pub async fn delete_apps( - &self, - body: crate::datadogV2::model::DeleteAppsRequest, - ) -> Result> { - match self.delete_apps_with_http_info(body).await { - Ok(response_content) => { - if let Some(e) = response_content.entity { - Ok(e) - } else { - Err(datadog::Error::Serde(serde::de::Error::custom( - "response content was None", - ))) - } - } - Err(err) => Err(err), - } - } - - /// Delete multiple apps by ID - pub async fn delete_apps_with_http_info( - &self, - body: crate::datadogV2::model::DeleteAppsRequest, - ) -> Result< - datadog::ResponseContent, - datadog::Error, - > { - let local_configuration = &self.config; - let operation_id = "v2.delete_apps"; - if local_configuration.is_unstable_operation_enabled(operation_id) { - warn!("Using unstable operation {operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.delete_apps' is not enabled".to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } - - let local_client = &self.client; - - let local_uri_str = format!( - "{}/api/v2/app-builder/apps", - local_configuration.get_operation_host(operation_id) - ); - let mut local_req_builder = - local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); - - // build headers - let mut headers = HeaderMap::new(); - headers.insert("Content-Type", HeaderValue::from_static("application/json")); - headers.insert("Accept", HeaderValue::from_static("application/json")); - - // build user agent - match HeaderValue::from_str(local_configuration.user_agent.as_str()) { - Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), - Err(e) => { - log::warn!("Failed to parse user agent header: {e}, falling back to default"); - headers.insert( - reqwest::header::USER_AGENT, - HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), - ) - } - }; - - // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; - - // build body parameters - let output = Vec::new(); - let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); - if body.serialize(&mut ser).is_ok() { - if let Some(content_encoding) = headers.get("Content-Encoding") { - match content_encoding.to_str().unwrap_or_default() { - "gzip" => { - let mut enc = GzEncoder::new(Vec::new(), Compression::default()); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - "deflate" => { - let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - "zstd1" => { - let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - _ => { - local_req_builder = local_req_builder.body(ser.into_inner()); - } - } - } else { - local_req_builder = local_req_builder.body(ser.into_inner()); - } - } - - local_req_builder = local_req_builder.headers(headers); - let local_req = local_req_builder.build()?; - log::debug!("request content: {:?}", local_req.body()); - let local_resp = local_client.execute(local_req).await?; - - let local_status = local_resp.status(); - let local_content = local_resp.text().await?; - log::debug!("response content: {}", local_content); - - if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { - Ok(e) => { - return Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: Some(e), - }) - } - Err(e) => return Err(datadog::Error::Serde(e)), - }; - } else { - let local_entity: Option = serde_json::from_str(&local_content).ok(); - let local_error = datadog::ResponseContent { - status: local_status, - content: local_content, - entity: local_entity, - }; - Err(datadog::Error::ResponseError(local_error)) - } - } - - /// Get the full definition of an app by ID - pub async fn get_app( - &self, - app_id: String, - ) -> Result> { - match self.get_app_with_http_info(app_id).await { - Ok(response_content) => { - if let Some(e) = response_content.entity { - Ok(e) - } else { - Err(datadog::Error::Serde(serde::de::Error::custom( - "response content was None", - ))) - } - } - Err(err) => Err(err), - } - } - - /// Get the full definition of an app by ID - pub async fn get_app_with_http_info( - &self, - app_id: String, - ) -> Result< - datadog::ResponseContent, - datadog::Error, - > { - let local_configuration = &self.config; - let operation_id = "v2.get_app"; - if local_configuration.is_unstable_operation_enabled(operation_id) { - warn!("Using unstable operation {operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.get_app' is not enabled".to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } - - let local_client = &self.client; - - let local_uri_str = format!( - "{}/api/v2/app-builder/apps/{app_id}", - local_configuration.get_operation_host(operation_id), - app_id = datadog::urlencode(app_id) - ); - let mut local_req_builder = - local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - - // build headers - let mut headers = HeaderMap::new(); - headers.insert("Accept", HeaderValue::from_static("application/json")); - - // build user agent - match HeaderValue::from_str(local_configuration.user_agent.as_str()) { - Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), - Err(e) => { - log::warn!("Failed to parse user agent header: {e}, falling back to default"); - headers.insert( - reqwest::header::USER_AGENT, - HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), - ) - } - }; - - // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; - - local_req_builder = local_req_builder.headers(headers); - let local_req = local_req_builder.build()?; - log::debug!("request content: {:?}", local_req.body()); - let local_resp = local_client.execute(local_req).await?; - - let local_status = local_resp.status(); - let local_content = local_resp.text().await?; - log::debug!("response content: {}", local_content); - - if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::(&local_content) { - Ok(e) => { - return Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: Some(e), - }) - } - Err(e) => return Err(datadog::Error::Serde(e)), - }; - } else { - let local_entity: Option = serde_json::from_str(&local_content).ok(); - let local_error = datadog::ResponseContent { - status: local_status, - content: local_content, - entity: local_entity, - }; - Err(datadog::Error::ResponseError(local_error)) - } - } - - /// List all apps, with optional filters and sorting - pub async fn list_apps( - &self, - params: ListAppsOptionalParams, - ) -> Result> { - match self.list_apps_with_http_info(params).await { - Ok(response_content) => { - if let Some(e) = response_content.entity { - Ok(e) - } else { - Err(datadog::Error::Serde(serde::de::Error::custom( - "response content was None", - ))) - } - } - Err(err) => Err(err), - } - } - - /// List all apps, with optional filters and sorting - pub async fn list_apps_with_http_info( - &self, - params: ListAppsOptionalParams, - ) -> Result< - datadog::ResponseContent, - datadog::Error, - > { - let local_configuration = &self.config; - let operation_id = "v2.list_apps"; - if local_configuration.is_unstable_operation_enabled(operation_id) { - warn!("Using unstable operation {operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.list_apps' is not enabled".to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } - - // unbox and build optional parameters - let limit = params.limit; - let page = params.page; - let filter_user_name = params.filter_user_name; - let filter_user_uuid = params.filter_user_uuid; - let filter_name = params.filter_name; - let filter_query = params.filter_query; - let filter_deployed = params.filter_deployed; - let filter_tags = params.filter_tags; - let filter_favorite = params.filter_favorite; - let sort = params.sort; - - let local_client = &self.client; - - let local_uri_str = format!( - "{}/api/v2/app-builder/apps", - local_configuration.get_operation_host(operation_id) - ); - let mut local_req_builder = - local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - - if let Some(ref local_query_param) = limit { - local_req_builder = - local_req_builder.query(&[("limit", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = page { - local_req_builder = - local_req_builder.query(&[("page", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_user_name { - local_req_builder = - local_req_builder.query(&[("filter[user_name]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_user_uuid { - local_req_builder = - local_req_builder.query(&[("filter[user_uuid]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_name { - local_req_builder = - local_req_builder.query(&[("filter[name]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_query { - local_req_builder = - local_req_builder.query(&[("filter[query]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_deployed { - local_req_builder = - local_req_builder.query(&[("filter[deployed]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_tags { - local_req_builder = - local_req_builder.query(&[("filter[tags]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_favorite { - local_req_builder = - local_req_builder.query(&[("filter[favorite]", &local_query_param.to_string())]); - }; - if let Some(ref local) = sort { - local_req_builder = local_req_builder.query(&[( - "sort", - &local - .iter() - .map(|p| p.to_string()) - .collect::>() - .join(",") - .to_string(), - )]); - }; - - // build headers - let mut headers = HeaderMap::new(); - headers.insert("Accept", HeaderValue::from_static("application/json")); - - // build user agent - match HeaderValue::from_str(local_configuration.user_agent.as_str()) { - Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), - Err(e) => { - log::warn!("Failed to parse user agent header: {e}, falling back to default"); - headers.insert( - reqwest::header::USER_AGENT, - HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), - ) - } - }; - - // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; - - local_req_builder = local_req_builder.headers(headers); - let local_req = local_req_builder.build()?; - log::debug!("request content: {:?}", local_req.body()); - let local_resp = local_client.execute(local_req).await?; - - let local_status = local_resp.status(); - let local_content = local_resp.text().await?; - log::debug!("response content: {}", local_content); - - if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::(&local_content) - { - Ok(e) => { - return Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: Some(e), - }) - } - Err(e) => return Err(datadog::Error::Serde(e)), - }; - } else { - let local_entity: Option = serde_json::from_str(&local_content).ok(); - let local_error = datadog::ResponseContent { - status: local_status, - content: local_content, - entity: local_entity, - }; - Err(datadog::Error::ResponseError(local_error)) - } - } - - /// Update an existing app by ID. Creates a new version of the app - pub async fn update_app( - &self, - app_id: String, - body: crate::datadogV2::model::UpdateAppRequest, - ) -> Result> { - match self.update_app_with_http_info(app_id, body).await { - Ok(response_content) => { - if let Some(e) = response_content.entity { - Ok(e) - } else { - Err(datadog::Error::Serde(serde::de::Error::custom( - "response content was None", - ))) - } - } - Err(err) => Err(err), - } - } - - /// Update an existing app by ID. Creates a new version of the app - pub async fn update_app_with_http_info( - &self, - app_id: String, - body: crate::datadogV2::model::UpdateAppRequest, - ) -> Result< - datadog::ResponseContent, - datadog::Error, - > { - let local_configuration = &self.config; - let operation_id = "v2.update_app"; - if local_configuration.is_unstable_operation_enabled(operation_id) { - warn!("Using unstable operation {operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.update_app' is not enabled".to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } - - let local_client = &self.client; - - let local_uri_str = format!( - "{}/api/v2/app-builder/apps/{app_id}", - local_configuration.get_operation_host(operation_id), - app_id = datadog::urlencode(app_id) - ); - let mut local_req_builder = - local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); - - // build headers - let mut headers = HeaderMap::new(); - headers.insert("Content-Type", HeaderValue::from_static("application/json")); - headers.insert("Accept", HeaderValue::from_static("application/json")); - - // build user agent - match HeaderValue::from_str(local_configuration.user_agent.as_str()) { - Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), - Err(e) => { - log::warn!("Failed to parse user agent header: {e}, falling back to default"); - headers.insert( - reqwest::header::USER_AGENT, - HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), - ) - } - }; - - // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; - - // build body parameters - let output = Vec::new(); - let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); - if body.serialize(&mut ser).is_ok() { - if let Some(content_encoding) = headers.get("Content-Encoding") { - match content_encoding.to_str().unwrap_or_default() { - "gzip" => { - let mut enc = GzEncoder::new(Vec::new(), Compression::default()); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - "deflate" => { - let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - "zstd1" => { - let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - _ => { - local_req_builder = local_req_builder.body(ser.into_inner()); - } - } - } else { - local_req_builder = local_req_builder.body(ser.into_inner()); - } - } - - local_req_builder = local_req_builder.headers(headers); - let local_req = local_req_builder.build()?; - log::debug!("request content: {:?}", local_req.body()); - let local_resp = local_client.execute(local_req).await?; - - let local_status = local_resp.status(); - let local_content = local_resp.text().await?; - log::debug!("response content: {}", local_content); - - if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::(&local_content) - { - Ok(e) => { - return Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: Some(e), - }) - } - Err(e) => return Err(datadog::Error::Serde(e)), - }; - } else { - let local_entity: Option = serde_json::from_str(&local_content).ok(); - let local_error = datadog::ResponseContent { - status: local_status, - content: local_content, - entity: local_entity, - }; - Err(datadog::Error::ResponseError(local_error)) - } - } -} diff --git a/src/datadogV2/api/mod.rs b/src/datadogV2/api/mod.rs index 678a9caeb..2eab40719 100644 --- a/src/datadogV2/api/mod.rs +++ b/src/datadogV2/api/mod.rs @@ -4,8 +4,6 @@ pub mod api_api_management; pub mod api_apm_retention_filters; -pub mod api_app_deployment; -pub mod api_apps; pub mod api_audit; pub mod api_authn_mappings; pub mod api_aws_integration; diff --git a/src/datadogV2/mod.rs b/src/datadogV2/mod.rs index 014b5cd84..f57d3d8da 100644 --- a/src/datadogV2/mod.rs +++ b/src/datadogV2/mod.rs @@ -5,8 +5,6 @@ pub mod api; pub use self::api::api_api_management; pub use self::api::api_apm_retention_filters; -pub use self::api::api_app_deployment; -pub use self::api::api_apps; pub use self::api::api_audit; pub use self::api::api_authn_mappings; pub use self::api::api_aws_integration; diff --git a/src/datadogV2/model/mod.rs b/src/datadogV2/model/mod.rs index 8565c579a..238d684b9 100644 --- a/src/datadogV2/model/mod.rs +++ b/src/datadogV2/model/mod.rs @@ -186,180 +186,6 @@ pub mod model_retention_filter_update_data; pub use self::model_retention_filter_update_data::RetentionFilterUpdateData; pub mod model_retention_filter_update_attributes; pub use self::model_retention_filter_update_attributes::RetentionFilterUpdateAttributes; -pub mod model_delete_apps_request; -pub use self::model_delete_apps_request::DeleteAppsRequest; -pub mod model_delete_apps_request_data_items; -pub use self::model_delete_apps_request_data_items::DeleteAppsRequestDataItems; -pub mod model_delete_apps_request_data_items_type; -pub use self::model_delete_apps_request_data_items_type::DeleteAppsRequestDataItemsType; -pub mod model_delete_apps_response; -pub use self::model_delete_apps_response::DeleteAppsResponse; -pub mod model_delete_apps_response_data_items; -pub use self::model_delete_apps_response_data_items::DeleteAppsResponseDataItems; -pub mod model_delete_apps_response_data_items_type; -pub use self::model_delete_apps_response_data_items_type::DeleteAppsResponseDataItemsType; -pub mod model_app_builder_error; -pub use self::model_app_builder_error::AppBuilderError; -pub mod model_app_builder_error_errors_items; -pub use self::model_app_builder_error_errors_items::AppBuilderErrorErrorsItems; -pub mod model_app_builder_error_errors_items_source; -pub use self::model_app_builder_error_errors_items_source::AppBuilderErrorErrorsItemsSource; -pub mod model_apps_sort_field; -pub use self::model_apps_sort_field::AppsSortField; -pub mod model_list_apps_response; -pub use self::model_list_apps_response::ListAppsResponse; -pub mod model_list_apps_response_data_items; -pub use self::model_list_apps_response_data_items::ListAppsResponseDataItems; -pub mod model_list_apps_response_data_items_attributes; -pub use self::model_list_apps_response_data_items_attributes::ListAppsResponseDataItemsAttributes; -pub mod model_app_meta; -pub use self::model_app_meta::AppMeta; -pub mod model_list_apps_response_data_items_relationships; -pub use self::model_list_apps_response_data_items_relationships::ListAppsResponseDataItemsRelationships; -pub mod model_deployment_relationship; -pub use self::model_deployment_relationship::DeploymentRelationship; -pub mod model_deployment_relationship_data; -pub use self::model_deployment_relationship_data::DeploymentRelationshipData; -pub mod model_deployment_relationship_data_type; -pub use self::model_deployment_relationship_data_type::DeploymentRelationshipDataType; -pub mod model_deployment_relationship_meta; -pub use self::model_deployment_relationship_meta::DeploymentRelationshipMeta; -pub mod model_list_apps_response_data_items_type; -pub use self::model_list_apps_response_data_items_type::ListAppsResponseDataItemsType; -pub mod model_deployment_included; -pub use self::model_deployment_included::DeploymentIncluded; -pub mod model_deployment_included_attributes; -pub use self::model_deployment_included_attributes::DeploymentIncludedAttributes; -pub mod model_deployment_included_meta; -pub use self::model_deployment_included_meta::DeploymentIncludedMeta; -pub mod model_deployment_included_type; -pub use self::model_deployment_included_type::DeploymentIncludedType; -pub mod model_list_apps_response_meta; -pub use self::model_list_apps_response_meta::ListAppsResponseMeta; -pub mod model_list_apps_response_meta_page; -pub use self::model_list_apps_response_meta_page::ListAppsResponseMetaPage; -pub mod model_create_app_request; -pub use self::model_create_app_request::CreateAppRequest; -pub mod model_create_app_request_data; -pub use self::model_create_app_request_data::CreateAppRequestData; -pub mod model_create_app_request_data_attributes; -pub use self::model_create_app_request_data_attributes::CreateAppRequestDataAttributes; -pub mod model_component_grid; -pub use self::model_component_grid::ComponentGrid; -pub mod model_app_builder_event; -pub use self::model_app_builder_event::AppBuilderEvent; -pub mod model_app_builder_event_name; -pub use self::model_app_builder_event_name::AppBuilderEventName; -pub mod model_app_builder_event_type; -pub use self::model_app_builder_event_type::AppBuilderEventType; -pub mod model_component_grid_properties; -pub use self::model_component_grid_properties::ComponentGridProperties; -pub mod model_component; -pub use self::model_component::Component; -pub mod model_component_properties; -pub use self::model_component_properties::ComponentProperties; -pub mod model_component_properties_is_visible; -pub use self::model_component_properties_is_visible::ComponentPropertiesIsVisible; -pub mod model_component_type; -pub use self::model_component_type::ComponentType; -pub mod model_component_grid_properties_is_visible; -pub use self::model_component_grid_properties_is_visible::ComponentGridPropertiesIsVisible; -pub mod model_component_grid_type; -pub use self::model_component_grid_type::ComponentGridType; -pub mod model_query; -pub use self::model_query::Query; -pub mod model_query_type; -pub use self::model_query_type::QueryType; -pub mod model_input_schema; -pub use self::model_input_schema::InputSchema; -pub mod model_input_schema_data; -pub use self::model_input_schema_data::InputSchemaData; -pub mod model_input_schema_data_attributes; -pub use self::model_input_schema_data_attributes::InputSchemaDataAttributes; -pub mod model_input_schema_data_attributes_parameters_items; -pub use self::model_input_schema_data_attributes_parameters_items::InputSchemaDataAttributesParametersItems; -pub mod model_input_schema_data_attributes_parameters_items_data; -pub use self::model_input_schema_data_attributes_parameters_items_data::InputSchemaDataAttributesParametersItemsData; -pub mod model_input_schema_data_attributes_parameters_items_data_attributes; -pub use self::model_input_schema_data_attributes_parameters_items_data_attributes::InputSchemaDataAttributesParametersItemsDataAttributes; -pub mod model_input_schema_data_type; -pub use self::model_input_schema_data_type::InputSchemaDataType; -pub mod model_script; -pub use self::model_script::Script; -pub mod model_script_data; -pub use self::model_script_data::ScriptData; -pub mod model_script_data_attributes; -pub use self::model_script_data_attributes::ScriptDataAttributes; -pub mod model_script_data_type; -pub use self::model_script_data_type::ScriptDataType; -pub mod model_create_app_request_data_type; -pub use self::model_create_app_request_data_type::CreateAppRequestDataType; -pub mod model_create_app_response; -pub use self::model_create_app_response::CreateAppResponse; -pub mod model_create_app_response_data; -pub use self::model_create_app_response_data::CreateAppResponseData; -pub mod model_create_app_response_data_type; -pub use self::model_create_app_response_data_type::CreateAppResponseDataType; -pub mod model_delete_app_response; -pub use self::model_delete_app_response::DeleteAppResponse; -pub mod model_delete_app_response_data; -pub use self::model_delete_app_response_data::DeleteAppResponseData; -pub mod model_delete_app_response_data_type; -pub use self::model_delete_app_response_data_type::DeleteAppResponseDataType; -pub mod model_get_app_response; -pub use self::model_get_app_response::GetAppResponse; -pub mod model_get_app_response_data; -pub use self::model_get_app_response_data::GetAppResponseData; -pub mod model_get_app_response_data_attributes; -pub use self::model_get_app_response_data_attributes::GetAppResponseDataAttributes; -pub mod model_get_app_response_data_type; -pub use self::model_get_app_response_data_type::GetAppResponseDataType; -pub mod model_get_app_response_relationship; -pub use self::model_get_app_response_relationship::GetAppResponseRelationship; -pub mod model_custom_connection; -pub use self::model_custom_connection::CustomConnection; -pub mod model_custom_connection_attributes; -pub use self::model_custom_connection_attributes::CustomConnectionAttributes; -pub mod model_custom_connection_attributes_on_prem_runner; -pub use self::model_custom_connection_attributes_on_prem_runner::CustomConnectionAttributesOnPremRunner; -pub mod model_custom_connection_type; -pub use self::model_custom_connection_type::CustomConnectionType; -pub mod model_update_app_request; -pub use self::model_update_app_request::UpdateAppRequest; -pub mod model_update_app_request_data; -pub use self::model_update_app_request_data::UpdateAppRequestData; -pub mod model_update_app_request_data_attributes; -pub use self::model_update_app_request_data_attributes::UpdateAppRequestDataAttributes; -pub mod model_update_app_request_data_type; -pub use self::model_update_app_request_data_type::UpdateAppRequestDataType; -pub mod model_update_app_response; -pub use self::model_update_app_response::UpdateAppResponse; -pub mod model_update_app_response_data; -pub use self::model_update_app_response_data::UpdateAppResponseData; -pub mod model_update_app_response_data_attributes; -pub use self::model_update_app_response_data_attributes::UpdateAppResponseDataAttributes; -pub mod model_update_app_response_data_type; -pub use self::model_update_app_response_data_type::UpdateAppResponseDataType; -pub mod model_update_app_response_relationship; -pub use self::model_update_app_response_relationship::UpdateAppResponseRelationship; -pub mod model_disable_app_response; -pub use self::model_disable_app_response::DisableAppResponse; -pub mod model_disable_app_response_data; -pub use self::model_disable_app_response_data::DisableAppResponseData; -pub mod model_disable_app_response_data_attributes; -pub use self::model_disable_app_response_data_attributes::DisableAppResponseDataAttributes; -pub mod model_deployment_meta; -pub use self::model_deployment_meta::DeploymentMeta; -pub mod model_disable_app_response_data_type; -pub use self::model_disable_app_response_data_type::DisableAppResponseDataType; -pub mod model_deploy_app_response; -pub use self::model_deploy_app_response::DeployAppResponse; -pub mod model_deploy_app_response_data; -pub use self::model_deploy_app_response_data::DeployAppResponseData; -pub mod model_deploy_app_response_data_attributes; -pub use self::model_deploy_app_response_data_attributes::DeployAppResponseDataAttributes; -pub mod model_deploy_app_response_data_type; -pub use self::model_deploy_app_response_data_type::DeployAppResponseDataType; pub mod model_application_keys_sort; pub use self::model_application_keys_sort::ApplicationKeysSort; pub mod model_list_application_keys_response; diff --git a/src/datadogV2/model/model_app_builder_error.rs b/src/datadogV2/model/model_app_builder_error.rs deleted file mode 100644 index 8b2154205..000000000 --- a/src/datadogV2/model/model_app_builder_error.rs +++ /dev/null @@ -1,109 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `AppBuilderError` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct AppBuilderError { - /// The `AppBuilderError` `errors`. - #[serde(rename = "errors")] - pub errors: Option>, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl AppBuilderError { - pub fn new() -> AppBuilderError { - AppBuilderError { - errors: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn errors( - mut self, - value: Vec, - ) -> Self { - self.errors = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for AppBuilderError { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for AppBuilderError { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct AppBuilderErrorVisitor; - impl<'a> Visitor<'a> for AppBuilderErrorVisitor { - type Value = AppBuilderError; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut errors: Option> = - None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "errors" => { - if v.is_null() { - continue; - } - errors = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = AppBuilderError { - errors, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(AppBuilderErrorVisitor) - } -} diff --git a/src/datadogV2/model/model_app_builder_error_errors_items.rs b/src/datadogV2/model/model_app_builder_error_errors_items.rs deleted file mode 100644 index bd9285ad5..000000000 --- a/src/datadogV2/model/model_app_builder_error_errors_items.rs +++ /dev/null @@ -1,126 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `AppBuilderErrorErrorsItems` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct AppBuilderErrorErrorsItems { - /// The `items` `detail`. - #[serde(rename = "detail")] - pub detail: Option, - /// The definition of `AppBuilderErrorErrorsItemsSource` object. - #[serde(rename = "source")] - pub source: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl AppBuilderErrorErrorsItems { - pub fn new() -> AppBuilderErrorErrorsItems { - AppBuilderErrorErrorsItems { - detail: None, - source: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn detail(mut self, value: String) -> Self { - self.detail = Some(value); - self - } - - pub fn source( - mut self, - value: crate::datadogV2::model::AppBuilderErrorErrorsItemsSource, - ) -> Self { - self.source = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for AppBuilderErrorErrorsItems { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for AppBuilderErrorErrorsItems { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct AppBuilderErrorErrorsItemsVisitor; - impl<'a> Visitor<'a> for AppBuilderErrorErrorsItemsVisitor { - type Value = AppBuilderErrorErrorsItems; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut detail: Option = None; - let mut source: Option = - None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "detail" => { - if v.is_null() { - continue; - } - detail = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "source" => { - if v.is_null() { - continue; - } - source = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = AppBuilderErrorErrorsItems { - detail, - source, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(AppBuilderErrorErrorsItemsVisitor) - } -} diff --git a/src/datadogV2/model/model_app_builder_error_errors_items_source.rs b/src/datadogV2/model/model_app_builder_error_errors_items_source.rs deleted file mode 100644 index 349e671b2..000000000 --- a/src/datadogV2/model/model_app_builder_error_errors_items_source.rs +++ /dev/null @@ -1,122 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `AppBuilderErrorErrorsItemsSource` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct AppBuilderErrorErrorsItemsSource { - /// The `source` `parameter`. - #[serde(rename = "parameter")] - pub parameter: Option, - /// The `source` `pointer`. - #[serde(rename = "pointer")] - pub pointer: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl AppBuilderErrorErrorsItemsSource { - pub fn new() -> AppBuilderErrorErrorsItemsSource { - AppBuilderErrorErrorsItemsSource { - parameter: None, - pointer: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn parameter(mut self, value: String) -> Self { - self.parameter = Some(value); - self - } - - pub fn pointer(mut self, value: String) -> Self { - self.pointer = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for AppBuilderErrorErrorsItemsSource { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for AppBuilderErrorErrorsItemsSource { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct AppBuilderErrorErrorsItemsSourceVisitor; - impl<'a> Visitor<'a> for AppBuilderErrorErrorsItemsSourceVisitor { - type Value = AppBuilderErrorErrorsItemsSource; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut parameter: Option = None; - let mut pointer: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "parameter" => { - if v.is_null() { - continue; - } - parameter = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "pointer" => { - if v.is_null() { - continue; - } - pointer = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = AppBuilderErrorErrorsItemsSource { - parameter, - pointer, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(AppBuilderErrorErrorsItemsSourceVisitor) - } -} diff --git a/src/datadogV2/model/model_app_builder_event.rs b/src/datadogV2/model/model_app_builder_event.rs deleted file mode 100644 index 8762b3324..000000000 --- a/src/datadogV2/model/model_app_builder_event.rs +++ /dev/null @@ -1,138 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `AppBuilderEvent` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct AppBuilderEvent { - /// The triggering action for the event. - #[serde(rename = "name")] - pub name: Option, - /// The response to the event. - #[serde(rename = "type")] - pub type_: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl AppBuilderEvent { - pub fn new() -> AppBuilderEvent { - AppBuilderEvent { - name: None, - type_: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn name(mut self, value: crate::datadogV2::model::AppBuilderEventName) -> Self { - self.name = Some(value); - self - } - - pub fn type_(mut self, value: crate::datadogV2::model::AppBuilderEventType) -> Self { - self.type_ = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for AppBuilderEvent { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for AppBuilderEvent { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct AppBuilderEventVisitor; - impl<'a> Visitor<'a> for AppBuilderEventVisitor { - type Value = AppBuilderEvent; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut name: Option = None; - let mut type_: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "name" => { - if v.is_null() { - continue; - } - name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - if let Some(ref _name) = name { - match _name { - crate::datadogV2::model::AppBuilderEventName::UnparsedObject(_name) => { - _unparsed = true; - }, - _ => {} - } - } - } - "type" => { - if v.is_null() { - continue; - } - type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - if let Some(ref _type_) = type_ { - match _type_ { - crate::datadogV2::model::AppBuilderEventType::UnparsedObject(_type_) => { - _unparsed = true; - }, - _ => {} - } - } - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = AppBuilderEvent { - name, - type_, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(AppBuilderEventVisitor) - } -} diff --git a/src/datadogV2/model/model_app_builder_event_name.rs b/src/datadogV2/model/model_app_builder_event_name.rs deleted file mode 100644 index 88daca544..000000000 --- a/src/datadogV2/model/model_app_builder_event_name.rs +++ /dev/null @@ -1,75 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -use serde::{Deserialize, Deserializer, Serialize, Serializer}; - -#[non_exhaustive] -#[derive(Clone, Debug, Eq, PartialEq)] -pub enum AppBuilderEventName { - PAGECHANGE, - TABLEROWCLICK, - TABLEROWBUTTONCLICK, - CHANGE, - SUBMIT, - CLICK, - TOGGLEOPEN, - CLOSE, - OPEN, - EXECUTIONFINISHED, - UnparsedObject(crate::datadog::UnparsedObject), -} - -impl ToString for AppBuilderEventName { - fn to_string(&self) -> String { - match self { - Self::PAGECHANGE => String::from("pageChange"), - Self::TABLEROWCLICK => String::from("tableRowClick"), - Self::TABLEROWBUTTONCLICK => String::from("_tableRowButtonClick"), - Self::CHANGE => String::from("change"), - Self::SUBMIT => String::from("submit"), - Self::CLICK => String::from("click"), - Self::TOGGLEOPEN => String::from("toggleOpen"), - Self::CLOSE => String::from("close"), - Self::OPEN => String::from("open"), - Self::EXECUTIONFINISHED => String::from("executionFinished"), - Self::UnparsedObject(v) => v.value.to_string(), - } - } -} - -impl Serialize for AppBuilderEventName { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - match self { - Self::UnparsedObject(v) => v.serialize(serializer), - _ => serializer.serialize_str(self.to_string().as_str()), - } - } -} - -impl<'de> Deserialize<'de> for AppBuilderEventName { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let s: String = String::deserialize(deserializer)?; - Ok(match s.as_str() { - "pageChange" => Self::PAGECHANGE, - "tableRowClick" => Self::TABLEROWCLICK, - "_tableRowButtonClick" => Self::TABLEROWBUTTONCLICK, - "change" => Self::CHANGE, - "submit" => Self::SUBMIT, - "click" => Self::CLICK, - "toggleOpen" => Self::TOGGLEOPEN, - "close" => Self::CLOSE, - "open" => Self::OPEN, - "executionFinished" => Self::EXECUTIONFINISHED, - _ => Self::UnparsedObject(crate::datadog::UnparsedObject { - value: serde_json::Value::String(s.into()), - }), - }) - } -} diff --git a/src/datadogV2/model/model_app_builder_event_type.rs b/src/datadogV2/model/model_app_builder_event_type.rs deleted file mode 100644 index 91c817a54..000000000 --- a/src/datadogV2/model/model_app_builder_event_type.rs +++ /dev/null @@ -1,69 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -use serde::{Deserialize, Deserializer, Serialize, Serializer}; - -#[non_exhaustive] -#[derive(Clone, Debug, Eq, PartialEq)] -pub enum AppBuilderEventType { - CUSTOM, - SETCOMPONENTSTATE, - TRIGGERQUERY, - OPENMODAL, - CLOSEMODAL, - OPENURL, - DOWNLOADFILE, - SETSTATEVARIABLEVALUE, - UnparsedObject(crate::datadog::UnparsedObject), -} - -impl ToString for AppBuilderEventType { - fn to_string(&self) -> String { - match self { - Self::CUSTOM => String::from("custom"), - Self::SETCOMPONENTSTATE => String::from("setComponentState"), - Self::TRIGGERQUERY => String::from("triggerQuery"), - Self::OPENMODAL => String::from("openModal"), - Self::CLOSEMODAL => String::from("closeModal"), - Self::OPENURL => String::from("openUrl"), - Self::DOWNLOADFILE => String::from("downloadFile"), - Self::SETSTATEVARIABLEVALUE => String::from("setStateVariableValue"), - Self::UnparsedObject(v) => v.value.to_string(), - } - } -} - -impl Serialize for AppBuilderEventType { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - match self { - Self::UnparsedObject(v) => v.serialize(serializer), - _ => serializer.serialize_str(self.to_string().as_str()), - } - } -} - -impl<'de> Deserialize<'de> for AppBuilderEventType { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let s: String = String::deserialize(deserializer)?; - Ok(match s.as_str() { - "custom" => Self::CUSTOM, - "setComponentState" => Self::SETCOMPONENTSTATE, - "triggerQuery" => Self::TRIGGERQUERY, - "openModal" => Self::OPENMODAL, - "closeModal" => Self::CLOSEMODAL, - "openUrl" => Self::OPENURL, - "downloadFile" => Self::DOWNLOADFILE, - "setStateVariableValue" => Self::SETSTATEVARIABLEVALUE, - _ => Self::UnparsedObject(crate::datadog::UnparsedObject { - value: serde_json::Value::String(s.into()), - }), - }) - } -} diff --git a/src/datadogV2/model/model_app_meta.rs b/src/datadogV2/model/model_app_meta.rs deleted file mode 100644 index 8a64153c1..000000000 --- a/src/datadogV2/model/model_app_meta.rs +++ /dev/null @@ -1,260 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `AppMeta` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct AppMeta { - /// The `AppMeta` `created_at`. - #[serde(rename = "created_at")] - pub created_at: Option, - /// The `AppMeta` `deleted_at`. - #[serde(rename = "deleted_at")] - pub deleted_at: Option, - /// The `AppMeta` `org_id`. - #[serde(rename = "org_id")] - pub org_id: Option, - /// The `AppMeta` `run_as_user`. - #[serde(rename = "run_as_user")] - pub run_as_user: Option, - /// The `AppMeta` `updated_at`. - #[serde(rename = "updated_at")] - pub updated_at: Option, - /// The `AppMeta` `updated_since_deployment`. - #[serde(rename = "updated_since_deployment")] - pub updated_since_deployment: Option, - /// The `AppMeta` `user_id`. - #[serde(rename = "user_id")] - pub user_id: Option, - /// The `AppMeta` `user_name`. - #[serde(rename = "user_name")] - pub user_name: Option, - /// The `AppMeta` `user_uuid`. - #[serde(rename = "user_uuid")] - pub user_uuid: Option, - /// The `AppMeta` `version`. - #[serde(rename = "version")] - pub version: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl AppMeta { - pub fn new() -> AppMeta { - AppMeta { - created_at: None, - deleted_at: None, - org_id: None, - run_as_user: None, - updated_at: None, - updated_since_deployment: None, - user_id: None, - user_name: None, - user_uuid: None, - version: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn created_at(mut self, value: String) -> Self { - self.created_at = Some(value); - self - } - - pub fn deleted_at(mut self, value: String) -> Self { - self.deleted_at = Some(value); - self - } - - pub fn org_id(mut self, value: i64) -> Self { - self.org_id = Some(value); - self - } - - pub fn run_as_user(mut self, value: String) -> Self { - self.run_as_user = Some(value); - self - } - - pub fn updated_at(mut self, value: String) -> Self { - self.updated_at = Some(value); - self - } - - pub fn updated_since_deployment(mut self, value: bool) -> Self { - self.updated_since_deployment = Some(value); - self - } - - pub fn user_id(mut self, value: i64) -> Self { - self.user_id = Some(value); - self - } - - pub fn user_name(mut self, value: String) -> Self { - self.user_name = Some(value); - self - } - - pub fn user_uuid(mut self, value: String) -> Self { - self.user_uuid = Some(value); - self - } - - pub fn version(mut self, value: i64) -> Self { - self.version = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for AppMeta { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for AppMeta { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct AppMetaVisitor; - impl<'a> Visitor<'a> for AppMetaVisitor { - type Value = AppMeta; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut created_at: Option = None; - let mut deleted_at: Option = None; - let mut org_id: Option = None; - let mut run_as_user: Option = None; - let mut updated_at: Option = None; - let mut updated_since_deployment: Option = None; - let mut user_id: Option = None; - let mut user_name: Option = None; - let mut user_uuid: Option = None; - let mut version: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "created_at" => { - if v.is_null() { - continue; - } - created_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "deleted_at" => { - if v.is_null() { - continue; - } - deleted_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "org_id" => { - if v.is_null() { - continue; - } - org_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "run_as_user" => { - if v.is_null() { - continue; - } - run_as_user = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "updated_at" => { - if v.is_null() { - continue; - } - updated_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "updated_since_deployment" => { - if v.is_null() { - continue; - } - updated_since_deployment = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "user_id" => { - if v.is_null() { - continue; - } - user_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "user_name" => { - if v.is_null() { - continue; - } - user_name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "user_uuid" => { - if v.is_null() { - continue; - } - user_uuid = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "version" => { - if v.is_null() { - continue; - } - version = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = AppMeta { - created_at, - deleted_at, - org_id, - run_as_user, - updated_at, - updated_since_deployment, - user_id, - user_name, - user_uuid, - version, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(AppMetaVisitor) - } -} diff --git a/src/datadogV2/model/model_apps_sort_field.rs b/src/datadogV2/model/model_apps_sort_field.rs deleted file mode 100644 index 11b0f0a15..000000000 --- a/src/datadogV2/model/model_apps_sort_field.rs +++ /dev/null @@ -1,69 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -use serde::{Deserialize, Deserializer, Serialize, Serializer}; - -#[non_exhaustive] -#[derive(Clone, Debug, Eq, PartialEq)] -pub enum AppsSortField { - NAME, - CREATED_AT, - UPDATED_AT, - USER_NAME, - NAME_DESC, - CREATED_AT_DESC, - UPDATED_AT_DESC, - USER_NAME_DESC, - UnparsedObject(crate::datadog::UnparsedObject), -} - -impl ToString for AppsSortField { - fn to_string(&self) -> String { - match self { - Self::NAME => String::from("name"), - Self::CREATED_AT => String::from("created_at"), - Self::UPDATED_AT => String::from("updated_at"), - Self::USER_NAME => String::from("user_name"), - Self::NAME_DESC => String::from("-name"), - Self::CREATED_AT_DESC => String::from("-created_at"), - Self::UPDATED_AT_DESC => String::from("-updated_at"), - Self::USER_NAME_DESC => String::from("-user_name"), - Self::UnparsedObject(v) => v.value.to_string(), - } - } -} - -impl Serialize for AppsSortField { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - match self { - Self::UnparsedObject(v) => v.serialize(serializer), - _ => serializer.serialize_str(self.to_string().as_str()), - } - } -} - -impl<'de> Deserialize<'de> for AppsSortField { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let s: String = String::deserialize(deserializer)?; - Ok(match s.as_str() { - "name" => Self::NAME, - "created_at" => Self::CREATED_AT, - "updated_at" => Self::UPDATED_AT, - "user_name" => Self::USER_NAME, - "-name" => Self::NAME_DESC, - "-created_at" => Self::CREATED_AT_DESC, - "-updated_at" => Self::UPDATED_AT_DESC, - "-user_name" => Self::USER_NAME_DESC, - _ => Self::UnparsedObject(crate::datadog::UnparsedObject { - value: serde_json::Value::String(s.into()), - }), - }) - } -} diff --git a/src/datadogV2/model/model_component.rs b/src/datadogV2/model/model_component.rs deleted file mode 100644 index 67731fcf0..000000000 --- a/src/datadogV2/model/model_component.rs +++ /dev/null @@ -1,157 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `Component` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct Component { - /// The `Component` `events`. - #[serde(rename = "events")] - pub events: Option>, - /// The `Component` `id`. - #[serde(rename = "id", default, with = "::serde_with::rust::double_option")] - pub id: Option>, - /// The `Component` `name`. - #[serde(rename = "name")] - pub name: String, - /// The definition of `ComponentProperties` object. - #[serde(rename = "properties")] - pub properties: crate::datadogV2::model::ComponentProperties, - /// The definition of `ComponentType` object. - #[serde(rename = "type")] - pub type_: crate::datadogV2::model::ComponentType, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl Component { - pub fn new( - name: String, - properties: crate::datadogV2::model::ComponentProperties, - type_: crate::datadogV2::model::ComponentType, - ) -> Component { - Component { - events: None, - id: None, - name, - properties, - type_, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn events(mut self, value: Vec) -> Self { - self.events = Some(value); - self - } - - pub fn id(mut self, value: Option) -> Self { - self.id = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl<'de> Deserialize<'de> for Component { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct ComponentVisitor; - impl<'a> Visitor<'a> for ComponentVisitor { - type Value = Component; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut events: Option> = None; - let mut id: Option> = None; - let mut name: Option = None; - let mut properties: Option = None; - let mut type_: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "events" => { - if v.is_null() { - continue; - } - events = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "id" => { - id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "name" => { - name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "properties" => { - properties = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "type" => { - type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - if let Some(ref _type_) = type_ { - match _type_ { - crate::datadogV2::model::ComponentType::UnparsedObject( - _type_, - ) => { - _unparsed = true; - } - _ => {} - } - } - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - let name = name.ok_or_else(|| M::Error::missing_field("name"))?; - let properties = properties.ok_or_else(|| M::Error::missing_field("properties"))?; - let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; - - let content = Component { - events, - id, - name, - properties, - type_, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(ComponentVisitor) - } -} diff --git a/src/datadogV2/model/model_component_grid.rs b/src/datadogV2/model/model_component_grid.rs deleted file mode 100644 index d06c4a3fc..000000000 --- a/src/datadogV2/model/model_component_grid.rs +++ /dev/null @@ -1,160 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `ComponentGrid` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct ComponentGrid { - /// The `ComponentGrid` `events`. - #[serde(rename = "events")] - pub events: Option>, - /// The `ComponentGrid` `id`. - #[serde(rename = "id")] - pub id: Option, - /// The `ComponentGrid` `name`. - #[serde(rename = "name")] - pub name: String, - /// The definition of `ComponentGridProperties` object. - #[serde(rename = "properties")] - pub properties: crate::datadogV2::model::ComponentGridProperties, - /// The definition of `ComponentGridType` object. - #[serde(rename = "type")] - pub type_: crate::datadogV2::model::ComponentGridType, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl ComponentGrid { - pub fn new( - name: String, - properties: crate::datadogV2::model::ComponentGridProperties, - type_: crate::datadogV2::model::ComponentGridType, - ) -> ComponentGrid { - ComponentGrid { - events: None, - id: None, - name, - properties, - type_, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn events(mut self, value: Vec) -> Self { - self.events = Some(value); - self - } - - pub fn id(mut self, value: String) -> Self { - self.id = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl<'de> Deserialize<'de> for ComponentGrid { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct ComponentGridVisitor; - impl<'a> Visitor<'a> for ComponentGridVisitor { - type Value = ComponentGrid; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut events: Option> = None; - let mut id: Option = None; - let mut name: Option = None; - let mut properties: Option = None; - let mut type_: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "events" => { - if v.is_null() { - continue; - } - events = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "id" => { - if v.is_null() { - continue; - } - id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "name" => { - name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "properties" => { - properties = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "type" => { - type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - if let Some(ref _type_) = type_ { - match _type_ { - crate::datadogV2::model::ComponentGridType::UnparsedObject( - _type_, - ) => { - _unparsed = true; - } - _ => {} - } - } - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - let name = name.ok_or_else(|| M::Error::missing_field("name"))?; - let properties = properties.ok_or_else(|| M::Error::missing_field("properties"))?; - let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; - - let content = ComponentGrid { - events, - id, - name, - properties, - type_, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(ComponentGridVisitor) - } -} diff --git a/src/datadogV2/model/model_component_grid_properties.rs b/src/datadogV2/model/model_component_grid_properties.rs deleted file mode 100644 index 205671655..000000000 --- a/src/datadogV2/model/model_component_grid_properties.rs +++ /dev/null @@ -1,153 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `ComponentGridProperties` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct ComponentGridProperties { - /// The `ComponentGridProperties` `backgroundColor`. - #[serde(rename = "backgroundColor")] - pub background_color: Option, - /// The `ComponentGridProperties` `children`. - #[serde(rename = "children")] - pub children: Option>, - /// The definition of `ComponentGridPropertiesIsVisible` object. - #[serde(rename = "isVisible")] - pub is_visible: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl ComponentGridProperties { - pub fn new() -> ComponentGridProperties { - ComponentGridProperties { - background_color: None, - children: None, - is_visible: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn background_color(mut self, value: String) -> Self { - self.background_color = Some(value); - self - } - - pub fn children(mut self, value: Vec) -> Self { - self.children = Some(value); - self - } - - pub fn is_visible( - mut self, - value: crate::datadogV2::model::ComponentGridPropertiesIsVisible, - ) -> Self { - self.is_visible = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for ComponentGridProperties { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for ComponentGridProperties { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct ComponentGridPropertiesVisitor; - impl<'a> Visitor<'a> for ComponentGridPropertiesVisitor { - type Value = ComponentGridProperties; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut background_color: Option = None; - let mut children: Option> = None; - let mut is_visible: Option< - crate::datadogV2::model::ComponentGridPropertiesIsVisible, - > = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "backgroundColor" => { - if v.is_null() { - continue; - } - background_color = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "children" => { - if v.is_null() { - continue; - } - children = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "isVisible" => { - if v.is_null() { - continue; - } - is_visible = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - if let Some(ref _is_visible) = is_visible { - match _is_visible { - crate::datadogV2::model::ComponentGridPropertiesIsVisible::UnparsedObject(_is_visible) => { - _unparsed = true; - }, - _ => {} - } - } - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = ComponentGridProperties { - background_color, - children, - is_visible, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(ComponentGridPropertiesVisitor) - } -} diff --git a/src/datadogV2/model/model_component_grid_properties_is_visible.rs b/src/datadogV2/model/model_component_grid_properties_is_visible.rs deleted file mode 100644 index fa6e0598e..000000000 --- a/src/datadogV2/model/model_component_grid_properties_is_visible.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::{Deserialize, Deserializer, Serialize}; - -/// The definition of `ComponentGridPropertiesIsVisible` object. -#[non_exhaustive] -#[derive(Clone, Debug, PartialEq, Serialize)] -#[serde(untagged)] -pub enum ComponentGridPropertiesIsVisible { - String(String), - Bool(bool), - UnparsedObject(crate::datadog::UnparsedObject), -} - -impl<'de> Deserialize<'de> for ComponentGridPropertiesIsVisible { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let value: serde_json::Value = Deserialize::deserialize(deserializer)?; - if let Ok(_v) = serde_json::from_value::(value.clone()) { - return Ok(ComponentGridPropertiesIsVisible::String(_v)); - } - if let Ok(_v) = serde_json::from_value::(value.clone()) { - return Ok(ComponentGridPropertiesIsVisible::Bool(_v)); - } - - return Ok(ComponentGridPropertiesIsVisible::UnparsedObject( - crate::datadog::UnparsedObject { value }, - )); - } -} diff --git a/src/datadogV2/model/model_component_grid_type.rs b/src/datadogV2/model/model_component_grid_type.rs deleted file mode 100644 index 59641f31e..000000000 --- a/src/datadogV2/model/model_component_grid_type.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -use serde::{Deserialize, Deserializer, Serialize, Serializer}; - -#[non_exhaustive] -#[derive(Clone, Debug, Eq, PartialEq)] -pub enum ComponentGridType { - GRID, - UnparsedObject(crate::datadog::UnparsedObject), -} - -impl ToString for ComponentGridType { - fn to_string(&self) -> String { - match self { - Self::GRID => String::from("grid"), - Self::UnparsedObject(v) => v.value.to_string(), - } - } -} - -impl Serialize for ComponentGridType { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - match self { - Self::UnparsedObject(v) => v.serialize(serializer), - _ => serializer.serialize_str(self.to_string().as_str()), - } - } -} - -impl<'de> Deserialize<'de> for ComponentGridType { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let s: String = String::deserialize(deserializer)?; - Ok(match s.as_str() { - "grid" => Self::GRID, - _ => Self::UnparsedObject(crate::datadog::UnparsedObject { - value: serde_json::Value::String(s.into()), - }), - }) - } -} diff --git a/src/datadogV2/model/model_component_properties.rs b/src/datadogV2/model/model_component_properties.rs deleted file mode 100644 index 7813dffed..000000000 --- a/src/datadogV2/model/model_component_properties.rs +++ /dev/null @@ -1,134 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `ComponentProperties` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct ComponentProperties { - /// The `ComponentProperties` `children`. - #[serde(rename = "children")] - pub children: Option>, - /// The definition of `ComponentPropertiesIsVisible` object. - #[serde(rename = "isVisible")] - pub is_visible: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl ComponentProperties { - pub fn new() -> ComponentProperties { - ComponentProperties { - children: None, - is_visible: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn children(mut self, value: Vec) -> Self { - self.children = Some(value); - self - } - - pub fn is_visible( - mut self, - value: crate::datadogV2::model::ComponentPropertiesIsVisible, - ) -> Self { - self.is_visible = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for ComponentProperties { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for ComponentProperties { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct ComponentPropertiesVisitor; - impl<'a> Visitor<'a> for ComponentPropertiesVisitor { - type Value = ComponentProperties; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut children: Option> = None; - let mut is_visible: Option = - None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "children" => { - if v.is_null() { - continue; - } - children = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "isVisible" => { - if v.is_null() { - continue; - } - is_visible = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - if let Some(ref _is_visible) = is_visible { - match _is_visible { - crate::datadogV2::model::ComponentPropertiesIsVisible::UnparsedObject(_is_visible) => { - _unparsed = true; - }, - _ => {} - } - } - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = ComponentProperties { - children, - is_visible, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(ComponentPropertiesVisitor) - } -} diff --git a/src/datadogV2/model/model_component_properties_is_visible.rs b/src/datadogV2/model/model_component_properties_is_visible.rs deleted file mode 100644 index b41d7b227..000000000 --- a/src/datadogV2/model/model_component_properties_is_visible.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::{Deserialize, Deserializer, Serialize}; - -/// The definition of `ComponentPropertiesIsVisible` object. -#[non_exhaustive] -#[derive(Clone, Debug, PartialEq, Serialize)] -#[serde(untagged)] -pub enum ComponentPropertiesIsVisible { - Bool(bool), - String(String), - UnparsedObject(crate::datadog::UnparsedObject), -} - -impl<'de> Deserialize<'de> for ComponentPropertiesIsVisible { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let value: serde_json::Value = Deserialize::deserialize(deserializer)?; - if let Ok(_v) = serde_json::from_value::(value.clone()) { - return Ok(ComponentPropertiesIsVisible::Bool(_v)); - } - if let Ok(_v) = serde_json::from_value::(value.clone()) { - return Ok(ComponentPropertiesIsVisible::String(_v)); - } - - return Ok(ComponentPropertiesIsVisible::UnparsedObject( - crate::datadog::UnparsedObject { value }, - )); - } -} diff --git a/src/datadogV2/model/model_component_type.rs b/src/datadogV2/model/model_component_type.rs deleted file mode 100644 index 7d8c554c0..000000000 --- a/src/datadogV2/model/model_component_type.rs +++ /dev/null @@ -1,105 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -use serde::{Deserialize, Deserializer, Serialize, Serializer}; - -#[non_exhaustive] -#[derive(Clone, Debug, Eq, PartialEq)] -pub enum ComponentType { - TABLE, - TEXTINPUT, - TEXTAREA, - BUTTON, - TEXT, - SELECT, - MODAL, - SCHEMAFORM, - CHECKBOX, - TABS, - VEGACHART, - RADIOBUTTONS, - NUMBERINPUT, - FILEINPUT, - JSONINPUT, - GRIDCELL, - DATERANGEPICKER, - SEARCH, - CONTAINER, - CALLOUTVALUE, - UnparsedObject(crate::datadog::UnparsedObject), -} - -impl ToString for ComponentType { - fn to_string(&self) -> String { - match self { - Self::TABLE => String::from("table"), - Self::TEXTINPUT => String::from("textInput"), - Self::TEXTAREA => String::from("textArea"), - Self::BUTTON => String::from("button"), - Self::TEXT => String::from("text"), - Self::SELECT => String::from("select"), - Self::MODAL => String::from("modal"), - Self::SCHEMAFORM => String::from("schemaForm"), - Self::CHECKBOX => String::from("checkbox"), - Self::TABS => String::from("tabs"), - Self::VEGACHART => String::from("vegaChart"), - Self::RADIOBUTTONS => String::from("radioButtons"), - Self::NUMBERINPUT => String::from("numberInput"), - Self::FILEINPUT => String::from("fileInput"), - Self::JSONINPUT => String::from("jsonInput"), - Self::GRIDCELL => String::from("gridCell"), - Self::DATERANGEPICKER => String::from("dateRangePicker"), - Self::SEARCH => String::from("search"), - Self::CONTAINER => String::from("container"), - Self::CALLOUTVALUE => String::from("calloutValue"), - Self::UnparsedObject(v) => v.value.to_string(), - } - } -} - -impl Serialize for ComponentType { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - match self { - Self::UnparsedObject(v) => v.serialize(serializer), - _ => serializer.serialize_str(self.to_string().as_str()), - } - } -} - -impl<'de> Deserialize<'de> for ComponentType { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let s: String = String::deserialize(deserializer)?; - Ok(match s.as_str() { - "table" => Self::TABLE, - "textInput" => Self::TEXTINPUT, - "textArea" => Self::TEXTAREA, - "button" => Self::BUTTON, - "text" => Self::TEXT, - "select" => Self::SELECT, - "modal" => Self::MODAL, - "schemaForm" => Self::SCHEMAFORM, - "checkbox" => Self::CHECKBOX, - "tabs" => Self::TABS, - "vegaChart" => Self::VEGACHART, - "radioButtons" => Self::RADIOBUTTONS, - "numberInput" => Self::NUMBERINPUT, - "fileInput" => Self::FILEINPUT, - "jsonInput" => Self::JSONINPUT, - "gridCell" => Self::GRIDCELL, - "dateRangePicker" => Self::DATERANGEPICKER, - "search" => Self::SEARCH, - "container" => Self::CONTAINER, - "calloutValue" => Self::CALLOUTVALUE, - _ => Self::UnparsedObject(crate::datadog::UnparsedObject { - value: serde_json::Value::String(s.into()), - }), - }) - } -} diff --git a/src/datadogV2/model/model_create_app_request.rs b/src/datadogV2/model/model_create_app_request.rs deleted file mode 100644 index a7d69ddbe..000000000 --- a/src/datadogV2/model/model_create_app_request.rs +++ /dev/null @@ -1,105 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `CreateAppRequest` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct CreateAppRequest { - /// The definition of `CreateAppRequestData` object. - #[serde(rename = "data")] - pub data: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl CreateAppRequest { - pub fn new() -> CreateAppRequest { - CreateAppRequest { - data: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn data(mut self, value: crate::datadogV2::model::CreateAppRequestData) -> Self { - self.data = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for CreateAppRequest { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for CreateAppRequest { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct CreateAppRequestVisitor; - impl<'a> Visitor<'a> for CreateAppRequestVisitor { - type Value = CreateAppRequest; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut data: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "data" => { - if v.is_null() { - continue; - } - data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = CreateAppRequest { - data, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(CreateAppRequestVisitor) - } -} diff --git a/src/datadogV2/model/model_create_app_request_data.rs b/src/datadogV2/model/model_create_app_request_data.rs deleted file mode 100644 index 0573de1e6..000000000 --- a/src/datadogV2/model/model_create_app_request_data.rs +++ /dev/null @@ -1,122 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `CreateAppRequestData` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct CreateAppRequestData { - /// The definition of `CreateAppRequestDataAttributes` object. - #[serde(rename = "attributes")] - pub attributes: Option, - /// The definition of `CreateAppRequestDataType` object. - #[serde(rename = "type")] - pub type_: crate::datadogV2::model::CreateAppRequestDataType, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl CreateAppRequestData { - pub fn new(type_: crate::datadogV2::model::CreateAppRequestDataType) -> CreateAppRequestData { - CreateAppRequestData { - attributes: None, - type_, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn attributes( - mut self, - value: crate::datadogV2::model::CreateAppRequestDataAttributes, - ) -> Self { - self.attributes = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl<'de> Deserialize<'de> for CreateAppRequestData { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct CreateAppRequestDataVisitor; - impl<'a> Visitor<'a> for CreateAppRequestDataVisitor { - type Value = CreateAppRequestData; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut attributes: Option< - crate::datadogV2::model::CreateAppRequestDataAttributes, - > = None; - let mut type_: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "attributes" => { - if v.is_null() { - continue; - } - attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "type" => { - type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - if let Some(ref _type_) = type_ { - match _type_ { - crate::datadogV2::model::CreateAppRequestDataType::UnparsedObject(_type_) => { - _unparsed = true; - }, - _ => {} - } - } - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; - - let content = CreateAppRequestData { - attributes, - type_, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(CreateAppRequestDataVisitor) - } -} diff --git a/src/datadogV2/model/model_create_app_request_data_attributes.rs b/src/datadogV2/model/model_create_app_request_data_attributes.rs deleted file mode 100644 index 9d50c24ed..000000000 --- a/src/datadogV2/model/model_create_app_request_data_attributes.rs +++ /dev/null @@ -1,228 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `CreateAppRequestDataAttributes` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct CreateAppRequestDataAttributes { - /// The `attributes` `components`. - #[serde(rename = "components")] - pub components: Option>, - /// The `attributes` `description`. - #[serde(rename = "description")] - pub description: Option, - /// The `attributes` `embeddedQueries`. - #[serde(rename = "embeddedQueries")] - pub embedded_queries: Option>, - /// The definition of `InputSchema` object. - #[serde(rename = "inputSchema")] - pub input_schema: Option, - /// The `attributes` `name`. - #[serde(rename = "name")] - pub name: Option, - /// The `attributes` `rootInstanceName`. - #[serde(rename = "rootInstanceName")] - pub root_instance_name: Option, - /// The `attributes` `scripts`. - #[serde(rename = "scripts")] - pub scripts: Option>, - /// The `attributes` `tags`. - #[serde(rename = "tags")] - pub tags: Option>, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl CreateAppRequestDataAttributes { - pub fn new() -> CreateAppRequestDataAttributes { - CreateAppRequestDataAttributes { - components: None, - description: None, - embedded_queries: None, - input_schema: None, - name: None, - root_instance_name: None, - scripts: None, - tags: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn components(mut self, value: Vec) -> Self { - self.components = Some(value); - self - } - - pub fn description(mut self, value: String) -> Self { - self.description = Some(value); - self - } - - pub fn embedded_queries(mut self, value: Vec) -> Self { - self.embedded_queries = Some(value); - self - } - - pub fn input_schema(mut self, value: crate::datadogV2::model::InputSchema) -> Self { - self.input_schema = Some(value); - self - } - - pub fn name(mut self, value: String) -> Self { - self.name = Some(value); - self - } - - pub fn root_instance_name(mut self, value: String) -> Self { - self.root_instance_name = Some(value); - self - } - - pub fn scripts(mut self, value: Vec) -> Self { - self.scripts = Some(value); - self - } - - pub fn tags(mut self, value: Vec) -> Self { - self.tags = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for CreateAppRequestDataAttributes { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for CreateAppRequestDataAttributes { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct CreateAppRequestDataAttributesVisitor; - impl<'a> Visitor<'a> for CreateAppRequestDataAttributesVisitor { - type Value = CreateAppRequestDataAttributes; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut components: Option> = None; - let mut description: Option = None; - let mut embedded_queries: Option> = None; - let mut input_schema: Option = None; - let mut name: Option = None; - let mut root_instance_name: Option = None; - let mut scripts: Option> = None; - let mut tags: Option> = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "components" => { - if v.is_null() { - continue; - } - components = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "description" => { - if v.is_null() { - continue; - } - description = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "embeddedQueries" => { - if v.is_null() { - continue; - } - embedded_queries = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "inputSchema" => { - if v.is_null() { - continue; - } - input_schema = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "name" => { - if v.is_null() { - continue; - } - name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "rootInstanceName" => { - if v.is_null() { - continue; - } - root_instance_name = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "scripts" => { - if v.is_null() { - continue; - } - scripts = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "tags" => { - if v.is_null() { - continue; - } - tags = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = CreateAppRequestDataAttributes { - components, - description, - embedded_queries, - input_schema, - name, - root_instance_name, - scripts, - tags, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(CreateAppRequestDataAttributesVisitor) - } -} diff --git a/src/datadogV2/model/model_create_app_request_data_type.rs b/src/datadogV2/model/model_create_app_request_data_type.rs deleted file mode 100644 index b2c40b965..000000000 --- a/src/datadogV2/model/model_create_app_request_data_type.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -use serde::{Deserialize, Deserializer, Serialize, Serializer}; - -#[non_exhaustive] -#[derive(Clone, Debug, Eq, PartialEq)] -pub enum CreateAppRequestDataType { - APPDEFINITIONS, - UnparsedObject(crate::datadog::UnparsedObject), -} - -impl ToString for CreateAppRequestDataType { - fn to_string(&self) -> String { - match self { - Self::APPDEFINITIONS => String::from("appDefinitions"), - Self::UnparsedObject(v) => v.value.to_string(), - } - } -} - -impl Serialize for CreateAppRequestDataType { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - match self { - Self::UnparsedObject(v) => v.serialize(serializer), - _ => serializer.serialize_str(self.to_string().as_str()), - } - } -} - -impl<'de> Deserialize<'de> for CreateAppRequestDataType { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let s: String = String::deserialize(deserializer)?; - Ok(match s.as_str() { - "appDefinitions" => Self::APPDEFINITIONS, - _ => Self::UnparsedObject(crate::datadog::UnparsedObject { - value: serde_json::Value::String(s.into()), - }), - }) - } -} diff --git a/src/datadogV2/model/model_create_app_response.rs b/src/datadogV2/model/model_create_app_response.rs deleted file mode 100644 index 47a75ea42..000000000 --- a/src/datadogV2/model/model_create_app_response.rs +++ /dev/null @@ -1,105 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `CreateAppResponse` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct CreateAppResponse { - /// The definition of `CreateAppResponseData` object. - #[serde(rename = "data")] - pub data: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl CreateAppResponse { - pub fn new() -> CreateAppResponse { - CreateAppResponse { - data: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn data(mut self, value: crate::datadogV2::model::CreateAppResponseData) -> Self { - self.data = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for CreateAppResponse { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for CreateAppResponse { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct CreateAppResponseVisitor; - impl<'a> Visitor<'a> for CreateAppResponseVisitor { - type Value = CreateAppResponse; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut data: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "data" => { - if v.is_null() { - continue; - } - data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = CreateAppResponse { - data, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(CreateAppResponseVisitor) - } -} diff --git a/src/datadogV2/model/model_create_app_response_data.rs b/src/datadogV2/model/model_create_app_response_data.rs deleted file mode 100644 index 34f5847d7..000000000 --- a/src/datadogV2/model/model_create_app_response_data.rs +++ /dev/null @@ -1,113 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `CreateAppResponseData` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct CreateAppResponseData { - /// The `data` `id`. - #[serde(rename = "id")] - pub id: String, - /// The definition of `CreateAppResponseDataType` object. - #[serde(rename = "type")] - pub type_: crate::datadogV2::model::CreateAppResponseDataType, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl CreateAppResponseData { - pub fn new( - id: String, - type_: crate::datadogV2::model::CreateAppResponseDataType, - ) -> CreateAppResponseData { - CreateAppResponseData { - id, - type_, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl<'de> Deserialize<'de> for CreateAppResponseData { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct CreateAppResponseDataVisitor; - impl<'a> Visitor<'a> for CreateAppResponseDataVisitor { - type Value = CreateAppResponseData; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut id: Option = None; - let mut type_: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "id" => { - id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "type" => { - type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - if let Some(ref _type_) = type_ { - match _type_ { - crate::datadogV2::model::CreateAppResponseDataType::UnparsedObject(_type_) => { - _unparsed = true; - }, - _ => {} - } - } - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - let id = id.ok_or_else(|| M::Error::missing_field("id"))?; - let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; - - let content = CreateAppResponseData { - id, - type_, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(CreateAppResponseDataVisitor) - } -} diff --git a/src/datadogV2/model/model_create_app_response_data_type.rs b/src/datadogV2/model/model_create_app_response_data_type.rs deleted file mode 100644 index 25781c3b9..000000000 --- a/src/datadogV2/model/model_create_app_response_data_type.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -use serde::{Deserialize, Deserializer, Serialize, Serializer}; - -#[non_exhaustive] -#[derive(Clone, Debug, Eq, PartialEq)] -pub enum CreateAppResponseDataType { - APPDEFINITIONS, - UnparsedObject(crate::datadog::UnparsedObject), -} - -impl ToString for CreateAppResponseDataType { - fn to_string(&self) -> String { - match self { - Self::APPDEFINITIONS => String::from("appDefinitions"), - Self::UnparsedObject(v) => v.value.to_string(), - } - } -} - -impl Serialize for CreateAppResponseDataType { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - match self { - Self::UnparsedObject(v) => v.serialize(serializer), - _ => serializer.serialize_str(self.to_string().as_str()), - } - } -} - -impl<'de> Deserialize<'de> for CreateAppResponseDataType { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let s: String = String::deserialize(deserializer)?; - Ok(match s.as_str() { - "appDefinitions" => Self::APPDEFINITIONS, - _ => Self::UnparsedObject(crate::datadog::UnparsedObject { - value: serde_json::Value::String(s.into()), - }), - }) - } -} diff --git a/src/datadogV2/model/model_custom_connection.rs b/src/datadogV2/model/model_custom_connection.rs deleted file mode 100644 index 5d64d7ed1..000000000 --- a/src/datadogV2/model/model_custom_connection.rs +++ /dev/null @@ -1,151 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `CustomConnection` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct CustomConnection { - /// The definition of `CustomConnectionAttributes` object. - #[serde(rename = "attributes")] - pub attributes: Option, - /// The `CustomConnection` `id`. - #[serde(rename = "id")] - pub id: Option, - /// The definition of `CustomConnectionType` object. - #[serde(rename = "type")] - pub type_: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl CustomConnection { - pub fn new() -> CustomConnection { - CustomConnection { - attributes: None, - id: None, - type_: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn attributes( - mut self, - value: crate::datadogV2::model::CustomConnectionAttributes, - ) -> Self { - self.attributes = Some(value); - self - } - - pub fn id(mut self, value: String) -> Self { - self.id = Some(value); - self - } - - pub fn type_(mut self, value: crate::datadogV2::model::CustomConnectionType) -> Self { - self.type_ = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for CustomConnection { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for CustomConnection { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct CustomConnectionVisitor; - impl<'a> Visitor<'a> for CustomConnectionVisitor { - type Value = CustomConnection; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut attributes: Option = - None; - let mut id: Option = None; - let mut type_: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "attributes" => { - if v.is_null() { - continue; - } - attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "id" => { - if v.is_null() { - continue; - } - id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "type" => { - if v.is_null() { - continue; - } - type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - if let Some(ref _type_) = type_ { - match _type_ { - crate::datadogV2::model::CustomConnectionType::UnparsedObject(_type_) => { - _unparsed = true; - }, - _ => {} - } - } - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = CustomConnection { - attributes, - id, - type_, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(CustomConnectionVisitor) - } -} diff --git a/src/datadogV2/model/model_custom_connection_attributes.rs b/src/datadogV2/model/model_custom_connection_attributes.rs deleted file mode 100644 index 1cb64459b..000000000 --- a/src/datadogV2/model/model_custom_connection_attributes.rs +++ /dev/null @@ -1,128 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `CustomConnectionAttributes` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct CustomConnectionAttributes { - /// The `attributes` `name`. - #[serde(rename = "name")] - pub name: Option, - /// The definition of `CustomConnectionAttributesOnPremRunner` object. - #[serde(rename = "onPremRunner")] - pub on_prem_runner: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl CustomConnectionAttributes { - pub fn new() -> CustomConnectionAttributes { - CustomConnectionAttributes { - name: None, - on_prem_runner: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn name(mut self, value: String) -> Self { - self.name = Some(value); - self - } - - pub fn on_prem_runner( - mut self, - value: crate::datadogV2::model::CustomConnectionAttributesOnPremRunner, - ) -> Self { - self.on_prem_runner = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for CustomConnectionAttributes { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for CustomConnectionAttributes { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct CustomConnectionAttributesVisitor; - impl<'a> Visitor<'a> for CustomConnectionAttributesVisitor { - type Value = CustomConnectionAttributes; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut name: Option = None; - let mut on_prem_runner: Option< - crate::datadogV2::model::CustomConnectionAttributesOnPremRunner, - > = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "name" => { - if v.is_null() { - continue; - } - name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "onPremRunner" => { - if v.is_null() { - continue; - } - on_prem_runner = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = CustomConnectionAttributes { - name, - on_prem_runner, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(CustomConnectionAttributesVisitor) - } -} diff --git a/src/datadogV2/model/model_custom_connection_attributes_on_prem_runner.rs b/src/datadogV2/model/model_custom_connection_attributes_on_prem_runner.rs deleted file mode 100644 index 5521b174a..000000000 --- a/src/datadogV2/model/model_custom_connection_attributes_on_prem_runner.rs +++ /dev/null @@ -1,122 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `CustomConnectionAttributesOnPremRunner` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct CustomConnectionAttributesOnPremRunner { - /// The `onPremRunner` `id`. - #[serde(rename = "id")] - pub id: Option, - /// The `onPremRunner` `url`. - #[serde(rename = "url")] - pub url: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl CustomConnectionAttributesOnPremRunner { - pub fn new() -> CustomConnectionAttributesOnPremRunner { - CustomConnectionAttributesOnPremRunner { - id: None, - url: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn id(mut self, value: String) -> Self { - self.id = Some(value); - self - } - - pub fn url(mut self, value: String) -> Self { - self.url = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for CustomConnectionAttributesOnPremRunner { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for CustomConnectionAttributesOnPremRunner { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct CustomConnectionAttributesOnPremRunnerVisitor; - impl<'a> Visitor<'a> for CustomConnectionAttributesOnPremRunnerVisitor { - type Value = CustomConnectionAttributesOnPremRunner; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut id: Option = None; - let mut url: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "id" => { - if v.is_null() { - continue; - } - id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "url" => { - if v.is_null() { - continue; - } - url = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = CustomConnectionAttributesOnPremRunner { - id, - url, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(CustomConnectionAttributesOnPremRunnerVisitor) - } -} diff --git a/src/datadogV2/model/model_custom_connection_type.rs b/src/datadogV2/model/model_custom_connection_type.rs deleted file mode 100644 index f344d7f31..000000000 --- a/src/datadogV2/model/model_custom_connection_type.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -use serde::{Deserialize, Deserializer, Serialize, Serializer}; - -#[non_exhaustive] -#[derive(Clone, Debug, Eq, PartialEq)] -pub enum CustomConnectionType { - CUSTOM_CONNECTIONS, - UnparsedObject(crate::datadog::UnparsedObject), -} - -impl ToString for CustomConnectionType { - fn to_string(&self) -> String { - match self { - Self::CUSTOM_CONNECTIONS => String::from("custom_connections"), - Self::UnparsedObject(v) => v.value.to_string(), - } - } -} - -impl Serialize for CustomConnectionType { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - match self { - Self::UnparsedObject(v) => v.serialize(serializer), - _ => serializer.serialize_str(self.to_string().as_str()), - } - } -} - -impl<'de> Deserialize<'de> for CustomConnectionType { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let s: String = String::deserialize(deserializer)?; - Ok(match s.as_str() { - "custom_connections" => Self::CUSTOM_CONNECTIONS, - _ => Self::UnparsedObject(crate::datadog::UnparsedObject { - value: serde_json::Value::String(s.into()), - }), - }) - } -} diff --git a/src/datadogV2/model/model_delete_app_response.rs b/src/datadogV2/model/model_delete_app_response.rs deleted file mode 100644 index b98e07724..000000000 --- a/src/datadogV2/model/model_delete_app_response.rs +++ /dev/null @@ -1,105 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `DeleteAppResponse` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct DeleteAppResponse { - /// The definition of `DeleteAppResponseData` object. - #[serde(rename = "data")] - pub data: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl DeleteAppResponse { - pub fn new() -> DeleteAppResponse { - DeleteAppResponse { - data: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn data(mut self, value: crate::datadogV2::model::DeleteAppResponseData) -> Self { - self.data = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for DeleteAppResponse { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for DeleteAppResponse { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct DeleteAppResponseVisitor; - impl<'a> Visitor<'a> for DeleteAppResponseVisitor { - type Value = DeleteAppResponse; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut data: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "data" => { - if v.is_null() { - continue; - } - data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = DeleteAppResponse { - data, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(DeleteAppResponseVisitor) - } -} diff --git a/src/datadogV2/model/model_delete_app_response_data.rs b/src/datadogV2/model/model_delete_app_response_data.rs deleted file mode 100644 index 100eb7a93..000000000 --- a/src/datadogV2/model/model_delete_app_response_data.rs +++ /dev/null @@ -1,113 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `DeleteAppResponseData` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct DeleteAppResponseData { - /// The `data` `id`. - #[serde(rename = "id")] - pub id: String, - /// The definition of `DeleteAppResponseDataType` object. - #[serde(rename = "type")] - pub type_: crate::datadogV2::model::DeleteAppResponseDataType, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl DeleteAppResponseData { - pub fn new( - id: String, - type_: crate::datadogV2::model::DeleteAppResponseDataType, - ) -> DeleteAppResponseData { - DeleteAppResponseData { - id, - type_, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl<'de> Deserialize<'de> for DeleteAppResponseData { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct DeleteAppResponseDataVisitor; - impl<'a> Visitor<'a> for DeleteAppResponseDataVisitor { - type Value = DeleteAppResponseData; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut id: Option = None; - let mut type_: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "id" => { - id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "type" => { - type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - if let Some(ref _type_) = type_ { - match _type_ { - crate::datadogV2::model::DeleteAppResponseDataType::UnparsedObject(_type_) => { - _unparsed = true; - }, - _ => {} - } - } - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - let id = id.ok_or_else(|| M::Error::missing_field("id"))?; - let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; - - let content = DeleteAppResponseData { - id, - type_, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(DeleteAppResponseDataVisitor) - } -} diff --git a/src/datadogV2/model/model_delete_app_response_data_type.rs b/src/datadogV2/model/model_delete_app_response_data_type.rs deleted file mode 100644 index fd3cff12d..000000000 --- a/src/datadogV2/model/model_delete_app_response_data_type.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -use serde::{Deserialize, Deserializer, Serialize, Serializer}; - -#[non_exhaustive] -#[derive(Clone, Debug, Eq, PartialEq)] -pub enum DeleteAppResponseDataType { - APPDEFINITIONS, - UnparsedObject(crate::datadog::UnparsedObject), -} - -impl ToString for DeleteAppResponseDataType { - fn to_string(&self) -> String { - match self { - Self::APPDEFINITIONS => String::from("appDefinitions"), - Self::UnparsedObject(v) => v.value.to_string(), - } - } -} - -impl Serialize for DeleteAppResponseDataType { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - match self { - Self::UnparsedObject(v) => v.serialize(serializer), - _ => serializer.serialize_str(self.to_string().as_str()), - } - } -} - -impl<'de> Deserialize<'de> for DeleteAppResponseDataType { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let s: String = String::deserialize(deserializer)?; - Ok(match s.as_str() { - "appDefinitions" => Self::APPDEFINITIONS, - _ => Self::UnparsedObject(crate::datadog::UnparsedObject { - value: serde_json::Value::String(s.into()), - }), - }) - } -} diff --git a/src/datadogV2/model/model_delete_apps_request.rs b/src/datadogV2/model/model_delete_apps_request.rs deleted file mode 100644 index e70e28151..000000000 --- a/src/datadogV2/model/model_delete_apps_request.rs +++ /dev/null @@ -1,106 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `DeleteAppsRequest` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct DeleteAppsRequest { - /// The `DeleteAppsRequest` `data`. - #[serde(rename = "data")] - pub data: Option>, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl DeleteAppsRequest { - pub fn new() -> DeleteAppsRequest { - DeleteAppsRequest { - data: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn data(mut self, value: Vec) -> Self { - self.data = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for DeleteAppsRequest { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for DeleteAppsRequest { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct DeleteAppsRequestVisitor; - impl<'a> Visitor<'a> for DeleteAppsRequestVisitor { - type Value = DeleteAppsRequest; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut data: Option> = - None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "data" => { - if v.is_null() { - continue; - } - data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = DeleteAppsRequest { - data, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(DeleteAppsRequestVisitor) - } -} diff --git a/src/datadogV2/model/model_delete_apps_request_data_items.rs b/src/datadogV2/model/model_delete_apps_request_data_items.rs deleted file mode 100644 index 24652ede1..000000000 --- a/src/datadogV2/model/model_delete_apps_request_data_items.rs +++ /dev/null @@ -1,114 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `DeleteAppsRequestDataItems` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct DeleteAppsRequestDataItems { - /// The `items` `id`. - #[serde(rename = "id")] - pub id: String, - /// The definition of `DeleteAppsRequestDataItemsType` object. - #[serde(rename = "type")] - pub type_: crate::datadogV2::model::DeleteAppsRequestDataItemsType, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl DeleteAppsRequestDataItems { - pub fn new( - id: String, - type_: crate::datadogV2::model::DeleteAppsRequestDataItemsType, - ) -> DeleteAppsRequestDataItems { - DeleteAppsRequestDataItems { - id, - type_, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl<'de> Deserialize<'de> for DeleteAppsRequestDataItems { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct DeleteAppsRequestDataItemsVisitor; - impl<'a> Visitor<'a> for DeleteAppsRequestDataItemsVisitor { - type Value = DeleteAppsRequestDataItems; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut id: Option = None; - let mut type_: Option = - None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "id" => { - id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "type" => { - type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - if let Some(ref _type_) = type_ { - match _type_ { - crate::datadogV2::model::DeleteAppsRequestDataItemsType::UnparsedObject(_type_) => { - _unparsed = true; - }, - _ => {} - } - } - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - let id = id.ok_or_else(|| M::Error::missing_field("id"))?; - let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; - - let content = DeleteAppsRequestDataItems { - id, - type_, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(DeleteAppsRequestDataItemsVisitor) - } -} diff --git a/src/datadogV2/model/model_delete_apps_request_data_items_type.rs b/src/datadogV2/model/model_delete_apps_request_data_items_type.rs deleted file mode 100644 index c322ea9a1..000000000 --- a/src/datadogV2/model/model_delete_apps_request_data_items_type.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -use serde::{Deserialize, Deserializer, Serialize, Serializer}; - -#[non_exhaustive] -#[derive(Clone, Debug, Eq, PartialEq)] -pub enum DeleteAppsRequestDataItemsType { - APPDEFINITIONS, - UnparsedObject(crate::datadog::UnparsedObject), -} - -impl ToString for DeleteAppsRequestDataItemsType { - fn to_string(&self) -> String { - match self { - Self::APPDEFINITIONS => String::from("appDefinitions"), - Self::UnparsedObject(v) => v.value.to_string(), - } - } -} - -impl Serialize for DeleteAppsRequestDataItemsType { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - match self { - Self::UnparsedObject(v) => v.serialize(serializer), - _ => serializer.serialize_str(self.to_string().as_str()), - } - } -} - -impl<'de> Deserialize<'de> for DeleteAppsRequestDataItemsType { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let s: String = String::deserialize(deserializer)?; - Ok(match s.as_str() { - "appDefinitions" => Self::APPDEFINITIONS, - _ => Self::UnparsedObject(crate::datadog::UnparsedObject { - value: serde_json::Value::String(s.into()), - }), - }) - } -} diff --git a/src/datadogV2/model/model_delete_apps_response.rs b/src/datadogV2/model/model_delete_apps_response.rs deleted file mode 100644 index b3dfe257c..000000000 --- a/src/datadogV2/model/model_delete_apps_response.rs +++ /dev/null @@ -1,109 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `DeleteAppsResponse` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct DeleteAppsResponse { - /// The `DeleteAppsResponse` `data`. - #[serde(rename = "data")] - pub data: Option>, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl DeleteAppsResponse { - pub fn new() -> DeleteAppsResponse { - DeleteAppsResponse { - data: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn data( - mut self, - value: Vec, - ) -> Self { - self.data = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for DeleteAppsResponse { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for DeleteAppsResponse { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct DeleteAppsResponseVisitor; - impl<'a> Visitor<'a> for DeleteAppsResponseVisitor { - type Value = DeleteAppsResponse; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut data: Option> = - None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "data" => { - if v.is_null() { - continue; - } - data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = DeleteAppsResponse { - data, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(DeleteAppsResponseVisitor) - } -} diff --git a/src/datadogV2/model/model_delete_apps_response_data_items.rs b/src/datadogV2/model/model_delete_apps_response_data_items.rs deleted file mode 100644 index 75444b835..000000000 --- a/src/datadogV2/model/model_delete_apps_response_data_items.rs +++ /dev/null @@ -1,114 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `DeleteAppsResponseDataItems` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct DeleteAppsResponseDataItems { - /// The `items` `id`. - #[serde(rename = "id")] - pub id: String, - /// The definition of `DeleteAppsResponseDataItemsType` object. - #[serde(rename = "type")] - pub type_: crate::datadogV2::model::DeleteAppsResponseDataItemsType, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl DeleteAppsResponseDataItems { - pub fn new( - id: String, - type_: crate::datadogV2::model::DeleteAppsResponseDataItemsType, - ) -> DeleteAppsResponseDataItems { - DeleteAppsResponseDataItems { - id, - type_, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl<'de> Deserialize<'de> for DeleteAppsResponseDataItems { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct DeleteAppsResponseDataItemsVisitor; - impl<'a> Visitor<'a> for DeleteAppsResponseDataItemsVisitor { - type Value = DeleteAppsResponseDataItems; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut id: Option = None; - let mut type_: Option = - None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "id" => { - id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "type" => { - type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - if let Some(ref _type_) = type_ { - match _type_ { - crate::datadogV2::model::DeleteAppsResponseDataItemsType::UnparsedObject(_type_) => { - _unparsed = true; - }, - _ => {} - } - } - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - let id = id.ok_or_else(|| M::Error::missing_field("id"))?; - let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; - - let content = DeleteAppsResponseDataItems { - id, - type_, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(DeleteAppsResponseDataItemsVisitor) - } -} diff --git a/src/datadogV2/model/model_delete_apps_response_data_items_type.rs b/src/datadogV2/model/model_delete_apps_response_data_items_type.rs deleted file mode 100644 index c563ee48d..000000000 --- a/src/datadogV2/model/model_delete_apps_response_data_items_type.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -use serde::{Deserialize, Deserializer, Serialize, Serializer}; - -#[non_exhaustive] -#[derive(Clone, Debug, Eq, PartialEq)] -pub enum DeleteAppsResponseDataItemsType { - APPDEFINITIONS, - UnparsedObject(crate::datadog::UnparsedObject), -} - -impl ToString for DeleteAppsResponseDataItemsType { - fn to_string(&self) -> String { - match self { - Self::APPDEFINITIONS => String::from("appDefinitions"), - Self::UnparsedObject(v) => v.value.to_string(), - } - } -} - -impl Serialize for DeleteAppsResponseDataItemsType { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - match self { - Self::UnparsedObject(v) => v.serialize(serializer), - _ => serializer.serialize_str(self.to_string().as_str()), - } - } -} - -impl<'de> Deserialize<'de> for DeleteAppsResponseDataItemsType { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let s: String = String::deserialize(deserializer)?; - Ok(match s.as_str() { - "appDefinitions" => Self::APPDEFINITIONS, - _ => Self::UnparsedObject(crate::datadog::UnparsedObject { - value: serde_json::Value::String(s.into()), - }), - }) - } -} diff --git a/src/datadogV2/model/model_deploy_app_response.rs b/src/datadogV2/model/model_deploy_app_response.rs deleted file mode 100644 index 35fc712dc..000000000 --- a/src/datadogV2/model/model_deploy_app_response.rs +++ /dev/null @@ -1,105 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `DeployAppResponse` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct DeployAppResponse { - /// The definition of `DeployAppResponseData` object. - #[serde(rename = "data")] - pub data: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl DeployAppResponse { - pub fn new() -> DeployAppResponse { - DeployAppResponse { - data: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn data(mut self, value: crate::datadogV2::model::DeployAppResponseData) -> Self { - self.data = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for DeployAppResponse { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for DeployAppResponse { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct DeployAppResponseVisitor; - impl<'a> Visitor<'a> for DeployAppResponseVisitor { - type Value = DeployAppResponse; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut data: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "data" => { - if v.is_null() { - continue; - } - data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = DeployAppResponse { - data, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(DeployAppResponseVisitor) - } -} diff --git a/src/datadogV2/model/model_deploy_app_response_data.rs b/src/datadogV2/model/model_deploy_app_response_data.rs deleted file mode 100644 index a36623b34..000000000 --- a/src/datadogV2/model/model_deploy_app_response_data.rs +++ /dev/null @@ -1,169 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `DeployAppResponseData` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct DeployAppResponseData { - /// The definition of `DeployAppResponseDataAttributes` object. - #[serde(rename = "attributes")] - pub attributes: Option, - /// The `data` `id`. - #[serde(rename = "id")] - pub id: Option, - /// The definition of `DeploymentMeta` object. - #[serde(rename = "meta")] - pub meta: Option, - /// The definition of `DeployAppResponseDataType` object. - #[serde(rename = "type")] - pub type_: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl DeployAppResponseData { - pub fn new() -> DeployAppResponseData { - DeployAppResponseData { - attributes: None, - id: None, - meta: None, - type_: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn attributes( - mut self, - value: crate::datadogV2::model::DeployAppResponseDataAttributes, - ) -> Self { - self.attributes = Some(value); - self - } - - pub fn id(mut self, value: String) -> Self { - self.id = Some(value); - self - } - - pub fn meta(mut self, value: crate::datadogV2::model::DeploymentMeta) -> Self { - self.meta = Some(value); - self - } - - pub fn type_(mut self, value: crate::datadogV2::model::DeployAppResponseDataType) -> Self { - self.type_ = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for DeployAppResponseData { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for DeployAppResponseData { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct DeployAppResponseDataVisitor; - impl<'a> Visitor<'a> for DeployAppResponseDataVisitor { - type Value = DeployAppResponseData; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut attributes: Option< - crate::datadogV2::model::DeployAppResponseDataAttributes, - > = None; - let mut id: Option = None; - let mut meta: Option = None; - let mut type_: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "attributes" => { - if v.is_null() { - continue; - } - attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "id" => { - if v.is_null() { - continue; - } - id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "meta" => { - if v.is_null() { - continue; - } - meta = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "type" => { - if v.is_null() { - continue; - } - type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - if let Some(ref _type_) = type_ { - match _type_ { - crate::datadogV2::model::DeployAppResponseDataType::UnparsedObject(_type_) => { - _unparsed = true; - }, - _ => {} - } - } - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = DeployAppResponseData { - attributes, - id, - meta, - type_, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(DeployAppResponseDataVisitor) - } -} diff --git a/src/datadogV2/model/model_deploy_app_response_data_attributes.rs b/src/datadogV2/model/model_deploy_app_response_data_attributes.rs deleted file mode 100644 index 99124000c..000000000 --- a/src/datadogV2/model/model_deploy_app_response_data_attributes.rs +++ /dev/null @@ -1,106 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `DeployAppResponseDataAttributes` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct DeployAppResponseDataAttributes { - /// The `attributes` `app_version_id`. - #[serde(rename = "app_version_id")] - pub app_version_id: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl DeployAppResponseDataAttributes { - pub fn new() -> DeployAppResponseDataAttributes { - DeployAppResponseDataAttributes { - app_version_id: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn app_version_id(mut self, value: String) -> Self { - self.app_version_id = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for DeployAppResponseDataAttributes { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for DeployAppResponseDataAttributes { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct DeployAppResponseDataAttributesVisitor; - impl<'a> Visitor<'a> for DeployAppResponseDataAttributesVisitor { - type Value = DeployAppResponseDataAttributes; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut app_version_id: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "app_version_id" => { - if v.is_null() { - continue; - } - app_version_id = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = DeployAppResponseDataAttributes { - app_version_id, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(DeployAppResponseDataAttributesVisitor) - } -} diff --git a/src/datadogV2/model/model_deploy_app_response_data_type.rs b/src/datadogV2/model/model_deploy_app_response_data_type.rs deleted file mode 100644 index 9c1db1742..000000000 --- a/src/datadogV2/model/model_deploy_app_response_data_type.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -use serde::{Deserialize, Deserializer, Serialize, Serializer}; - -#[non_exhaustive] -#[derive(Clone, Debug, Eq, PartialEq)] -pub enum DeployAppResponseDataType { - DEPLOYMENT, - UnparsedObject(crate::datadog::UnparsedObject), -} - -impl ToString for DeployAppResponseDataType { - fn to_string(&self) -> String { - match self { - Self::DEPLOYMENT => String::from("deployment"), - Self::UnparsedObject(v) => v.value.to_string(), - } - } -} - -impl Serialize for DeployAppResponseDataType { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - match self { - Self::UnparsedObject(v) => v.serialize(serializer), - _ => serializer.serialize_str(self.to_string().as_str()), - } - } -} - -impl<'de> Deserialize<'de> for DeployAppResponseDataType { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let s: String = String::deserialize(deserializer)?; - Ok(match s.as_str() { - "deployment" => Self::DEPLOYMENT, - _ => Self::UnparsedObject(crate::datadog::UnparsedObject { - value: serde_json::Value::String(s.into()), - }), - }) - } -} diff --git a/src/datadogV2/model/model_deployment_included.rs b/src/datadogV2/model/model_deployment_included.rs deleted file mode 100644 index 7efa458f6..000000000 --- a/src/datadogV2/model/model_deployment_included.rs +++ /dev/null @@ -1,168 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `DeploymentIncluded` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct DeploymentIncluded { - /// The definition of `DeploymentIncludedAttributes` object. - #[serde(rename = "attributes")] - pub attributes: Option, - /// The `DeploymentIncluded` `id`. - #[serde(rename = "id")] - pub id: Option, - /// The definition of `DeploymentIncludedMeta` object. - #[serde(rename = "meta")] - pub meta: Option, - /// The definition of `DeploymentIncludedType` object. - #[serde(rename = "type")] - pub type_: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl DeploymentIncluded { - pub fn new() -> DeploymentIncluded { - DeploymentIncluded { - attributes: None, - id: None, - meta: None, - type_: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn attributes( - mut self, - value: crate::datadogV2::model::DeploymentIncludedAttributes, - ) -> Self { - self.attributes = Some(value); - self - } - - pub fn id(mut self, value: String) -> Self { - self.id = Some(value); - self - } - - pub fn meta(mut self, value: crate::datadogV2::model::DeploymentIncludedMeta) -> Self { - self.meta = Some(value); - self - } - - pub fn type_(mut self, value: crate::datadogV2::model::DeploymentIncludedType) -> Self { - self.type_ = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for DeploymentIncluded { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for DeploymentIncluded { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct DeploymentIncludedVisitor; - impl<'a> Visitor<'a> for DeploymentIncludedVisitor { - type Value = DeploymentIncluded; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut attributes: Option = - None; - let mut id: Option = None; - let mut meta: Option = None; - let mut type_: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "attributes" => { - if v.is_null() { - continue; - } - attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "id" => { - if v.is_null() { - continue; - } - id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "meta" => { - if v.is_null() { - continue; - } - meta = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "type" => { - if v.is_null() { - continue; - } - type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - if let Some(ref _type_) = type_ { - match _type_ { - crate::datadogV2::model::DeploymentIncludedType::UnparsedObject(_type_) => { - _unparsed = true; - }, - _ => {} - } - } - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = DeploymentIncluded { - attributes, - id, - meta, - type_, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(DeploymentIncludedVisitor) - } -} diff --git a/src/datadogV2/model/model_deployment_included_attributes.rs b/src/datadogV2/model/model_deployment_included_attributes.rs deleted file mode 100644 index f4a6d4273..000000000 --- a/src/datadogV2/model/model_deployment_included_attributes.rs +++ /dev/null @@ -1,106 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `DeploymentIncludedAttributes` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct DeploymentIncludedAttributes { - /// The `attributes` `app_version_id`. - #[serde(rename = "app_version_id")] - pub app_version_id: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl DeploymentIncludedAttributes { - pub fn new() -> DeploymentIncludedAttributes { - DeploymentIncludedAttributes { - app_version_id: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn app_version_id(mut self, value: String) -> Self { - self.app_version_id = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for DeploymentIncludedAttributes { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for DeploymentIncludedAttributes { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct DeploymentIncludedAttributesVisitor; - impl<'a> Visitor<'a> for DeploymentIncludedAttributesVisitor { - type Value = DeploymentIncludedAttributes; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut app_version_id: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "app_version_id" => { - if v.is_null() { - continue; - } - app_version_id = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = DeploymentIncludedAttributes { - app_version_id, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(DeploymentIncludedAttributesVisitor) - } -} diff --git a/src/datadogV2/model/model_deployment_included_meta.rs b/src/datadogV2/model/model_deployment_included_meta.rs deleted file mode 100644 index 9161dc392..000000000 --- a/src/datadogV2/model/model_deployment_included_meta.rs +++ /dev/null @@ -1,156 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `DeploymentIncludedMeta` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct DeploymentIncludedMeta { - /// The `meta` `created_at`. - #[serde(rename = "created_at")] - pub created_at: Option, - /// The `meta` `user_id`. - #[serde(rename = "user_id")] - pub user_id: Option, - /// The `meta` `user_name`. - #[serde(rename = "user_name")] - pub user_name: Option, - /// The `meta` `user_uuid`. - #[serde(rename = "user_uuid")] - pub user_uuid: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl DeploymentIncludedMeta { - pub fn new() -> DeploymentIncludedMeta { - DeploymentIncludedMeta { - created_at: None, - user_id: None, - user_name: None, - user_uuid: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn created_at(mut self, value: String) -> Self { - self.created_at = Some(value); - self - } - - pub fn user_id(mut self, value: i64) -> Self { - self.user_id = Some(value); - self - } - - pub fn user_name(mut self, value: String) -> Self { - self.user_name = Some(value); - self - } - - pub fn user_uuid(mut self, value: String) -> Self { - self.user_uuid = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for DeploymentIncludedMeta { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for DeploymentIncludedMeta { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct DeploymentIncludedMetaVisitor; - impl<'a> Visitor<'a> for DeploymentIncludedMetaVisitor { - type Value = DeploymentIncludedMeta; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut created_at: Option = None; - let mut user_id: Option = None; - let mut user_name: Option = None; - let mut user_uuid: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "created_at" => { - if v.is_null() { - continue; - } - created_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "user_id" => { - if v.is_null() { - continue; - } - user_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "user_name" => { - if v.is_null() { - continue; - } - user_name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "user_uuid" => { - if v.is_null() { - continue; - } - user_uuid = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = DeploymentIncludedMeta { - created_at, - user_id, - user_name, - user_uuid, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(DeploymentIncludedMetaVisitor) - } -} diff --git a/src/datadogV2/model/model_deployment_included_type.rs b/src/datadogV2/model/model_deployment_included_type.rs deleted file mode 100644 index 37b7cc1e7..000000000 --- a/src/datadogV2/model/model_deployment_included_type.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -use serde::{Deserialize, Deserializer, Serialize, Serializer}; - -#[non_exhaustive] -#[derive(Clone, Debug, Eq, PartialEq)] -pub enum DeploymentIncludedType { - DEPLOYMENT, - UnparsedObject(crate::datadog::UnparsedObject), -} - -impl ToString for DeploymentIncludedType { - fn to_string(&self) -> String { - match self { - Self::DEPLOYMENT => String::from("deployment"), - Self::UnparsedObject(v) => v.value.to_string(), - } - } -} - -impl Serialize for DeploymentIncludedType { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - match self { - Self::UnparsedObject(v) => v.serialize(serializer), - _ => serializer.serialize_str(self.to_string().as_str()), - } - } -} - -impl<'de> Deserialize<'de> for DeploymentIncludedType { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let s: String = String::deserialize(deserializer)?; - Ok(match s.as_str() { - "deployment" => Self::DEPLOYMENT, - _ => Self::UnparsedObject(crate::datadog::UnparsedObject { - value: serde_json::Value::String(s.into()), - }), - }) - } -} diff --git a/src/datadogV2/model/model_deployment_meta.rs b/src/datadogV2/model/model_deployment_meta.rs deleted file mode 100644 index 126810396..000000000 --- a/src/datadogV2/model/model_deployment_meta.rs +++ /dev/null @@ -1,156 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `DeploymentMeta` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct DeploymentMeta { - /// The `DeploymentMeta` `created_at`. - #[serde(rename = "created_at")] - pub created_at: Option, - /// The `DeploymentMeta` `user_id`. - #[serde(rename = "user_id")] - pub user_id: Option, - /// The `DeploymentMeta` `user_name`. - #[serde(rename = "user_name")] - pub user_name: Option, - /// The `DeploymentMeta` `user_uuid`. - #[serde(rename = "user_uuid")] - pub user_uuid: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl DeploymentMeta { - pub fn new() -> DeploymentMeta { - DeploymentMeta { - created_at: None, - user_id: None, - user_name: None, - user_uuid: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn created_at(mut self, value: String) -> Self { - self.created_at = Some(value); - self - } - - pub fn user_id(mut self, value: i64) -> Self { - self.user_id = Some(value); - self - } - - pub fn user_name(mut self, value: String) -> Self { - self.user_name = Some(value); - self - } - - pub fn user_uuid(mut self, value: String) -> Self { - self.user_uuid = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for DeploymentMeta { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for DeploymentMeta { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct DeploymentMetaVisitor; - impl<'a> Visitor<'a> for DeploymentMetaVisitor { - type Value = DeploymentMeta; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut created_at: Option = None; - let mut user_id: Option = None; - let mut user_name: Option = None; - let mut user_uuid: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "created_at" => { - if v.is_null() { - continue; - } - created_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "user_id" => { - if v.is_null() { - continue; - } - user_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "user_name" => { - if v.is_null() { - continue; - } - user_name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "user_uuid" => { - if v.is_null() { - continue; - } - user_uuid = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = DeploymentMeta { - created_at, - user_id, - user_name, - user_uuid, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(DeploymentMetaVisitor) - } -} diff --git a/src/datadogV2/model/model_deployment_relationship.rs b/src/datadogV2/model/model_deployment_relationship.rs deleted file mode 100644 index c1734804c..000000000 --- a/src/datadogV2/model/model_deployment_relationship.rs +++ /dev/null @@ -1,122 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `DeploymentRelationship` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct DeploymentRelationship { - /// The definition of `DeploymentRelationshipData` object. - #[serde(rename = "data")] - pub data: Option, - /// The definition of `DeploymentRelationshipMeta` object. - #[serde(rename = "meta")] - pub meta: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl DeploymentRelationship { - pub fn new() -> DeploymentRelationship { - DeploymentRelationship { - data: None, - meta: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn data(mut self, value: crate::datadogV2::model::DeploymentRelationshipData) -> Self { - self.data = Some(value); - self - } - - pub fn meta(mut self, value: crate::datadogV2::model::DeploymentRelationshipMeta) -> Self { - self.meta = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for DeploymentRelationship { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for DeploymentRelationship { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct DeploymentRelationshipVisitor; - impl<'a> Visitor<'a> for DeploymentRelationshipVisitor { - type Value = DeploymentRelationship; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut data: Option = None; - let mut meta: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "data" => { - if v.is_null() { - continue; - } - data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "meta" => { - if v.is_null() { - continue; - } - meta = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = DeploymentRelationship { - data, - meta, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(DeploymentRelationshipVisitor) - } -} diff --git a/src/datadogV2/model/model_deployment_relationship_data.rs b/src/datadogV2/model/model_deployment_relationship_data.rs deleted file mode 100644 index 547f23282..000000000 --- a/src/datadogV2/model/model_deployment_relationship_data.rs +++ /dev/null @@ -1,131 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `DeploymentRelationshipData` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct DeploymentRelationshipData { - /// The `data` `id`. - #[serde(rename = "id")] - pub id: Option, - /// The definition of `DeploymentRelationshipDataType` object. - #[serde(rename = "type")] - pub type_: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl DeploymentRelationshipData { - pub fn new() -> DeploymentRelationshipData { - DeploymentRelationshipData { - id: None, - type_: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn id(mut self, value: String) -> Self { - self.id = Some(value); - self - } - - pub fn type_(mut self, value: crate::datadogV2::model::DeploymentRelationshipDataType) -> Self { - self.type_ = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for DeploymentRelationshipData { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for DeploymentRelationshipData { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct DeploymentRelationshipDataVisitor; - impl<'a> Visitor<'a> for DeploymentRelationshipDataVisitor { - type Value = DeploymentRelationshipData; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut id: Option = None; - let mut type_: Option = - None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "id" => { - if v.is_null() { - continue; - } - id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "type" => { - if v.is_null() { - continue; - } - type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - if let Some(ref _type_) = type_ { - match _type_ { - crate::datadogV2::model::DeploymentRelationshipDataType::UnparsedObject(_type_) => { - _unparsed = true; - }, - _ => {} - } - } - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = DeploymentRelationshipData { - id, - type_, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(DeploymentRelationshipDataVisitor) - } -} diff --git a/src/datadogV2/model/model_deployment_relationship_data_type.rs b/src/datadogV2/model/model_deployment_relationship_data_type.rs deleted file mode 100644 index 83a68b220..000000000 --- a/src/datadogV2/model/model_deployment_relationship_data_type.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -use serde::{Deserialize, Deserializer, Serialize, Serializer}; - -#[non_exhaustive] -#[derive(Clone, Debug, Eq, PartialEq)] -pub enum DeploymentRelationshipDataType { - DEPLOYMENT, - UnparsedObject(crate::datadog::UnparsedObject), -} - -impl ToString for DeploymentRelationshipDataType { - fn to_string(&self) -> String { - match self { - Self::DEPLOYMENT => String::from("deployment"), - Self::UnparsedObject(v) => v.value.to_string(), - } - } -} - -impl Serialize for DeploymentRelationshipDataType { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - match self { - Self::UnparsedObject(v) => v.serialize(serializer), - _ => serializer.serialize_str(self.to_string().as_str()), - } - } -} - -impl<'de> Deserialize<'de> for DeploymentRelationshipDataType { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let s: String = String::deserialize(deserializer)?; - Ok(match s.as_str() { - "deployment" => Self::DEPLOYMENT, - _ => Self::UnparsedObject(crate::datadog::UnparsedObject { - value: serde_json::Value::String(s.into()), - }), - }) - } -} diff --git a/src/datadogV2/model/model_deployment_relationship_meta.rs b/src/datadogV2/model/model_deployment_relationship_meta.rs deleted file mode 100644 index c99b9a1d0..000000000 --- a/src/datadogV2/model/model_deployment_relationship_meta.rs +++ /dev/null @@ -1,156 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `DeploymentRelationshipMeta` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct DeploymentRelationshipMeta { - /// The `meta` `created_at`. - #[serde(rename = "created_at")] - pub created_at: Option, - /// The `meta` `user_id`. - #[serde(rename = "user_id")] - pub user_id: Option, - /// The `meta` `user_name`. - #[serde(rename = "user_name")] - pub user_name: Option, - /// The `meta` `user_uuid`. - #[serde(rename = "user_uuid")] - pub user_uuid: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl DeploymentRelationshipMeta { - pub fn new() -> DeploymentRelationshipMeta { - DeploymentRelationshipMeta { - created_at: None, - user_id: None, - user_name: None, - user_uuid: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn created_at(mut self, value: String) -> Self { - self.created_at = Some(value); - self - } - - pub fn user_id(mut self, value: i64) -> Self { - self.user_id = Some(value); - self - } - - pub fn user_name(mut self, value: String) -> Self { - self.user_name = Some(value); - self - } - - pub fn user_uuid(mut self, value: String) -> Self { - self.user_uuid = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for DeploymentRelationshipMeta { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for DeploymentRelationshipMeta { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct DeploymentRelationshipMetaVisitor; - impl<'a> Visitor<'a> for DeploymentRelationshipMetaVisitor { - type Value = DeploymentRelationshipMeta; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut created_at: Option = None; - let mut user_id: Option = None; - let mut user_name: Option = None; - let mut user_uuid: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "created_at" => { - if v.is_null() { - continue; - } - created_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "user_id" => { - if v.is_null() { - continue; - } - user_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "user_name" => { - if v.is_null() { - continue; - } - user_name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "user_uuid" => { - if v.is_null() { - continue; - } - user_uuid = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = DeploymentRelationshipMeta { - created_at, - user_id, - user_name, - user_uuid, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(DeploymentRelationshipMetaVisitor) - } -} diff --git a/src/datadogV2/model/model_disable_app_response.rs b/src/datadogV2/model/model_disable_app_response.rs deleted file mode 100644 index eea85cc6d..000000000 --- a/src/datadogV2/model/model_disable_app_response.rs +++ /dev/null @@ -1,105 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `DisableAppResponse` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct DisableAppResponse { - /// The definition of `DisableAppResponseData` object. - #[serde(rename = "data")] - pub data: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl DisableAppResponse { - pub fn new() -> DisableAppResponse { - DisableAppResponse { - data: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn data(mut self, value: crate::datadogV2::model::DisableAppResponseData) -> Self { - self.data = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for DisableAppResponse { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for DisableAppResponse { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct DisableAppResponseVisitor; - impl<'a> Visitor<'a> for DisableAppResponseVisitor { - type Value = DisableAppResponse; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut data: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "data" => { - if v.is_null() { - continue; - } - data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = DisableAppResponse { - data, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(DisableAppResponseVisitor) - } -} diff --git a/src/datadogV2/model/model_disable_app_response_data.rs b/src/datadogV2/model/model_disable_app_response_data.rs deleted file mode 100644 index 1d6716873..000000000 --- a/src/datadogV2/model/model_disable_app_response_data.rs +++ /dev/null @@ -1,169 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `DisableAppResponseData` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct DisableAppResponseData { - /// The definition of `DisableAppResponseDataAttributes` object. - #[serde(rename = "attributes")] - pub attributes: Option, - /// The `data` `id`. - #[serde(rename = "id")] - pub id: Option, - /// The definition of `DeploymentMeta` object. - #[serde(rename = "meta")] - pub meta: Option, - /// The definition of `DisableAppResponseDataType` object. - #[serde(rename = "type")] - pub type_: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl DisableAppResponseData { - pub fn new() -> DisableAppResponseData { - DisableAppResponseData { - attributes: None, - id: None, - meta: None, - type_: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn attributes( - mut self, - value: crate::datadogV2::model::DisableAppResponseDataAttributes, - ) -> Self { - self.attributes = Some(value); - self - } - - pub fn id(mut self, value: String) -> Self { - self.id = Some(value); - self - } - - pub fn meta(mut self, value: crate::datadogV2::model::DeploymentMeta) -> Self { - self.meta = Some(value); - self - } - - pub fn type_(mut self, value: crate::datadogV2::model::DisableAppResponseDataType) -> Self { - self.type_ = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for DisableAppResponseData { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for DisableAppResponseData { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct DisableAppResponseDataVisitor; - impl<'a> Visitor<'a> for DisableAppResponseDataVisitor { - type Value = DisableAppResponseData; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut attributes: Option< - crate::datadogV2::model::DisableAppResponseDataAttributes, - > = None; - let mut id: Option = None; - let mut meta: Option = None; - let mut type_: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "attributes" => { - if v.is_null() { - continue; - } - attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "id" => { - if v.is_null() { - continue; - } - id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "meta" => { - if v.is_null() { - continue; - } - meta = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "type" => { - if v.is_null() { - continue; - } - type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - if let Some(ref _type_) = type_ { - match _type_ { - crate::datadogV2::model::DisableAppResponseDataType::UnparsedObject(_type_) => { - _unparsed = true; - }, - _ => {} - } - } - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = DisableAppResponseData { - attributes, - id, - meta, - type_, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(DisableAppResponseDataVisitor) - } -} diff --git a/src/datadogV2/model/model_disable_app_response_data_attributes.rs b/src/datadogV2/model/model_disable_app_response_data_attributes.rs deleted file mode 100644 index e7678f884..000000000 --- a/src/datadogV2/model/model_disable_app_response_data_attributes.rs +++ /dev/null @@ -1,106 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `DisableAppResponseDataAttributes` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct DisableAppResponseDataAttributes { - /// The `attributes` `app_version_id`. - #[serde(rename = "app_version_id")] - pub app_version_id: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl DisableAppResponseDataAttributes { - pub fn new() -> DisableAppResponseDataAttributes { - DisableAppResponseDataAttributes { - app_version_id: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn app_version_id(mut self, value: String) -> Self { - self.app_version_id = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for DisableAppResponseDataAttributes { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for DisableAppResponseDataAttributes { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct DisableAppResponseDataAttributesVisitor; - impl<'a> Visitor<'a> for DisableAppResponseDataAttributesVisitor { - type Value = DisableAppResponseDataAttributes; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut app_version_id: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "app_version_id" => { - if v.is_null() { - continue; - } - app_version_id = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = DisableAppResponseDataAttributes { - app_version_id, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(DisableAppResponseDataAttributesVisitor) - } -} diff --git a/src/datadogV2/model/model_disable_app_response_data_type.rs b/src/datadogV2/model/model_disable_app_response_data_type.rs deleted file mode 100644 index 37010fba7..000000000 --- a/src/datadogV2/model/model_disable_app_response_data_type.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -use serde::{Deserialize, Deserializer, Serialize, Serializer}; - -#[non_exhaustive] -#[derive(Clone, Debug, Eq, PartialEq)] -pub enum DisableAppResponseDataType { - DEPLOYMENT, - UnparsedObject(crate::datadog::UnparsedObject), -} - -impl ToString for DisableAppResponseDataType { - fn to_string(&self) -> String { - match self { - Self::DEPLOYMENT => String::from("deployment"), - Self::UnparsedObject(v) => v.value.to_string(), - } - } -} - -impl Serialize for DisableAppResponseDataType { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - match self { - Self::UnparsedObject(v) => v.serialize(serializer), - _ => serializer.serialize_str(self.to_string().as_str()), - } - } -} - -impl<'de> Deserialize<'de> for DisableAppResponseDataType { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let s: String = String::deserialize(deserializer)?; - Ok(match s.as_str() { - "deployment" => Self::DEPLOYMENT, - _ => Self::UnparsedObject(crate::datadog::UnparsedObject { - value: serde_json::Value::String(s.into()), - }), - }) - } -} diff --git a/src/datadogV2/model/model_get_app_response.rs b/src/datadogV2/model/model_get_app_response.rs deleted file mode 100644 index 0c9065bd0..000000000 --- a/src/datadogV2/model/model_get_app_response.rs +++ /dev/null @@ -1,161 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `GetAppResponse` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct GetAppResponse { - /// The definition of `GetAppResponseData` object. - #[serde(rename = "data")] - pub data: Option, - /// The `GetAppResponse` `included`. - #[serde(rename = "included")] - pub included: Option>, - /// The definition of `AppMeta` object. - #[serde(rename = "meta")] - pub meta: Option, - /// The definition of `GetAppResponseRelationship` object. - #[serde(rename = "relationship")] - pub relationship: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl GetAppResponse { - pub fn new() -> GetAppResponse { - GetAppResponse { - data: None, - included: None, - meta: None, - relationship: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn data(mut self, value: crate::datadogV2::model::GetAppResponseData) -> Self { - self.data = Some(value); - self - } - - pub fn included(mut self, value: Vec) -> Self { - self.included = Some(value); - self - } - - pub fn meta(mut self, value: crate::datadogV2::model::AppMeta) -> Self { - self.meta = Some(value); - self - } - - pub fn relationship( - mut self, - value: crate::datadogV2::model::GetAppResponseRelationship, - ) -> Self { - self.relationship = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for GetAppResponse { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for GetAppResponse { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct GetAppResponseVisitor; - impl<'a> Visitor<'a> for GetAppResponseVisitor { - type Value = GetAppResponse; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut data: Option = None; - let mut included: Option> = None; - let mut meta: Option = None; - let mut relationship: Option = - None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "data" => { - if v.is_null() { - continue; - } - data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "included" => { - if v.is_null() { - continue; - } - included = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "meta" => { - if v.is_null() { - continue; - } - meta = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "relationship" => { - if v.is_null() { - continue; - } - relationship = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = GetAppResponse { - data, - included, - meta, - relationship, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(GetAppResponseVisitor) - } -} diff --git a/src/datadogV2/model/model_get_app_response_data.rs b/src/datadogV2/model/model_get_app_response_data.rs deleted file mode 100644 index e6957dc05..000000000 --- a/src/datadogV2/model/model_get_app_response_data.rs +++ /dev/null @@ -1,125 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `GetAppResponseData` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct GetAppResponseData { - /// The definition of `GetAppResponseDataAttributes` object. - #[serde(rename = "attributes")] - pub attributes: crate::datadogV2::model::GetAppResponseDataAttributes, - /// The `data` `id`. - #[serde(rename = "id")] - pub id: String, - /// The definition of `GetAppResponseDataType` object. - #[serde(rename = "type")] - pub type_: crate::datadogV2::model::GetAppResponseDataType, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl GetAppResponseData { - pub fn new( - attributes: crate::datadogV2::model::GetAppResponseDataAttributes, - id: String, - type_: crate::datadogV2::model::GetAppResponseDataType, - ) -> GetAppResponseData { - GetAppResponseData { - attributes, - id, - type_, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl<'de> Deserialize<'de> for GetAppResponseData { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct GetAppResponseDataVisitor; - impl<'a> Visitor<'a> for GetAppResponseDataVisitor { - type Value = GetAppResponseData; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut attributes: Option = - None; - let mut id: Option = None; - let mut type_: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "attributes" => { - attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "id" => { - id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "type" => { - type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - if let Some(ref _type_) = type_ { - match _type_ { - crate::datadogV2::model::GetAppResponseDataType::UnparsedObject(_type_) => { - _unparsed = true; - }, - _ => {} - } - } - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; - let id = id.ok_or_else(|| M::Error::missing_field("id"))?; - let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; - - let content = GetAppResponseData { - attributes, - id, - type_, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(GetAppResponseDataVisitor) - } -} diff --git a/src/datadogV2/model/model_get_app_response_data_attributes.rs b/src/datadogV2/model/model_get_app_response_data_attributes.rs deleted file mode 100644 index 36144953c..000000000 --- a/src/datadogV2/model/model_get_app_response_data_attributes.rs +++ /dev/null @@ -1,245 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `GetAppResponseDataAttributes` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct GetAppResponseDataAttributes { - /// The `attributes` `components`. - #[serde(rename = "components")] - pub components: Option>, - /// The `attributes` `description`. - #[serde(rename = "description")] - pub description: Option, - /// The `attributes` `embeddedQueries`. - #[serde(rename = "embeddedQueries")] - pub embedded_queries: Option>, - /// The `attributes` `favorite`. - #[serde(rename = "favorite")] - pub favorite: Option, - /// The definition of `InputSchema` object. - #[serde(rename = "inputSchema")] - pub input_schema: Option, - /// The `attributes` `name`. - #[serde(rename = "name")] - pub name: Option, - /// The `attributes` `rootInstanceName`. - #[serde(rename = "rootInstanceName")] - pub root_instance_name: Option, - /// The `attributes` `scripts`. - #[serde(rename = "scripts")] - pub scripts: Option>, - /// The `attributes` `tags`. - #[serde(rename = "tags")] - pub tags: Option>, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl GetAppResponseDataAttributes { - pub fn new() -> GetAppResponseDataAttributes { - GetAppResponseDataAttributes { - components: None, - description: None, - embedded_queries: None, - favorite: None, - input_schema: None, - name: None, - root_instance_name: None, - scripts: None, - tags: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn components(mut self, value: Vec) -> Self { - self.components = Some(value); - self - } - - pub fn description(mut self, value: String) -> Self { - self.description = Some(value); - self - } - - pub fn embedded_queries(mut self, value: Vec) -> Self { - self.embedded_queries = Some(value); - self - } - - pub fn favorite(mut self, value: bool) -> Self { - self.favorite = Some(value); - self - } - - pub fn input_schema(mut self, value: crate::datadogV2::model::InputSchema) -> Self { - self.input_schema = Some(value); - self - } - - pub fn name(mut self, value: String) -> Self { - self.name = Some(value); - self - } - - pub fn root_instance_name(mut self, value: String) -> Self { - self.root_instance_name = Some(value); - self - } - - pub fn scripts(mut self, value: Vec) -> Self { - self.scripts = Some(value); - self - } - - pub fn tags(mut self, value: Vec) -> Self { - self.tags = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for GetAppResponseDataAttributes { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for GetAppResponseDataAttributes { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct GetAppResponseDataAttributesVisitor; - impl<'a> Visitor<'a> for GetAppResponseDataAttributesVisitor { - type Value = GetAppResponseDataAttributes; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut components: Option> = None; - let mut description: Option = None; - let mut embedded_queries: Option> = None; - let mut favorite: Option = None; - let mut input_schema: Option = None; - let mut name: Option = None; - let mut root_instance_name: Option = None; - let mut scripts: Option> = None; - let mut tags: Option> = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "components" => { - if v.is_null() { - continue; - } - components = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "description" => { - if v.is_null() { - continue; - } - description = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "embeddedQueries" => { - if v.is_null() { - continue; - } - embedded_queries = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "favorite" => { - if v.is_null() { - continue; - } - favorite = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "inputSchema" => { - if v.is_null() { - continue; - } - input_schema = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "name" => { - if v.is_null() { - continue; - } - name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "rootInstanceName" => { - if v.is_null() { - continue; - } - root_instance_name = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "scripts" => { - if v.is_null() { - continue; - } - scripts = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "tags" => { - if v.is_null() { - continue; - } - tags = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = GetAppResponseDataAttributes { - components, - description, - embedded_queries, - favorite, - input_schema, - name, - root_instance_name, - scripts, - tags, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(GetAppResponseDataAttributesVisitor) - } -} diff --git a/src/datadogV2/model/model_get_app_response_data_type.rs b/src/datadogV2/model/model_get_app_response_data_type.rs deleted file mode 100644 index 7f98d2bc2..000000000 --- a/src/datadogV2/model/model_get_app_response_data_type.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -use serde::{Deserialize, Deserializer, Serialize, Serializer}; - -#[non_exhaustive] -#[derive(Clone, Debug, Eq, PartialEq)] -pub enum GetAppResponseDataType { - APPDEFINITIONS, - UnparsedObject(crate::datadog::UnparsedObject), -} - -impl ToString for GetAppResponseDataType { - fn to_string(&self) -> String { - match self { - Self::APPDEFINITIONS => String::from("appDefinitions"), - Self::UnparsedObject(v) => v.value.to_string(), - } - } -} - -impl Serialize for GetAppResponseDataType { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - match self { - Self::UnparsedObject(v) => v.serialize(serializer), - _ => serializer.serialize_str(self.to_string().as_str()), - } - } -} - -impl<'de> Deserialize<'de> for GetAppResponseDataType { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let s: String = String::deserialize(deserializer)?; - Ok(match s.as_str() { - "appDefinitions" => Self::APPDEFINITIONS, - _ => Self::UnparsedObject(crate::datadog::UnparsedObject { - value: serde_json::Value::String(s.into()), - }), - }) - } -} diff --git a/src/datadogV2/model/model_get_app_response_relationship.rs b/src/datadogV2/model/model_get_app_response_relationship.rs deleted file mode 100644 index dd4991bcf..000000000 --- a/src/datadogV2/model/model_get_app_response_relationship.rs +++ /dev/null @@ -1,123 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `GetAppResponseRelationship` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct GetAppResponseRelationship { - /// The `relationship` `connections`. - #[serde(rename = "connections")] - pub connections: Option>, - /// The definition of `DeploymentRelationship` object. - #[serde(rename = "deployment")] - pub deployment: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl GetAppResponseRelationship { - pub fn new() -> GetAppResponseRelationship { - GetAppResponseRelationship { - connections: None, - deployment: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn connections(mut self, value: Vec) -> Self { - self.connections = Some(value); - self - } - - pub fn deployment(mut self, value: crate::datadogV2::model::DeploymentRelationship) -> Self { - self.deployment = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for GetAppResponseRelationship { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for GetAppResponseRelationship { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct GetAppResponseRelationshipVisitor; - impl<'a> Visitor<'a> for GetAppResponseRelationshipVisitor { - type Value = GetAppResponseRelationship; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut connections: Option> = None; - let mut deployment: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "connections" => { - if v.is_null() { - continue; - } - connections = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "deployment" => { - if v.is_null() { - continue; - } - deployment = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = GetAppResponseRelationship { - connections, - deployment, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(GetAppResponseRelationshipVisitor) - } -} diff --git a/src/datadogV2/model/model_input_schema.rs b/src/datadogV2/model/model_input_schema.rs deleted file mode 100644 index 144228b34..000000000 --- a/src/datadogV2/model/model_input_schema.rs +++ /dev/null @@ -1,105 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `InputSchema` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct InputSchema { - /// The definition of `InputSchemaData` object. - #[serde(rename = "data")] - pub data: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl InputSchema { - pub fn new() -> InputSchema { - InputSchema { - data: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn data(mut self, value: crate::datadogV2::model::InputSchemaData) -> Self { - self.data = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for InputSchema { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for InputSchema { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct InputSchemaVisitor; - impl<'a> Visitor<'a> for InputSchemaVisitor { - type Value = InputSchema; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut data: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "data" => { - if v.is_null() { - continue; - } - data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = InputSchema { - data, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(InputSchemaVisitor) - } -} diff --git a/src/datadogV2/model/model_input_schema_data.rs b/src/datadogV2/model/model_input_schema_data.rs deleted file mode 100644 index 6f161649d..000000000 --- a/src/datadogV2/model/model_input_schema_data.rs +++ /dev/null @@ -1,148 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `InputSchemaData` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct InputSchemaData { - /// The definition of `InputSchemaDataAttributes` object. - #[serde(rename = "attributes")] - pub attributes: Option, - /// The `data` `id`. - #[serde(rename = "id")] - pub id: Option, - /// The definition of `InputSchemaDataType` object. - #[serde(rename = "type")] - pub type_: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl InputSchemaData { - pub fn new() -> InputSchemaData { - InputSchemaData { - attributes: None, - id: None, - type_: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn attributes(mut self, value: crate::datadogV2::model::InputSchemaDataAttributes) -> Self { - self.attributes = Some(value); - self - } - - pub fn id(mut self, value: String) -> Self { - self.id = Some(value); - self - } - - pub fn type_(mut self, value: crate::datadogV2::model::InputSchemaDataType) -> Self { - self.type_ = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for InputSchemaData { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for InputSchemaData { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct InputSchemaDataVisitor; - impl<'a> Visitor<'a> for InputSchemaDataVisitor { - type Value = InputSchemaData; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut attributes: Option = - None; - let mut id: Option = None; - let mut type_: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "attributes" => { - if v.is_null() { - continue; - } - attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "id" => { - if v.is_null() { - continue; - } - id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "type" => { - if v.is_null() { - continue; - } - type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - if let Some(ref _type_) = type_ { - match _type_ { - crate::datadogV2::model::InputSchemaDataType::UnparsedObject(_type_) => { - _unparsed = true; - }, - _ => {} - } - } - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = InputSchemaData { - attributes, - id, - type_, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(InputSchemaDataVisitor) - } -} diff --git a/src/datadogV2/model/model_input_schema_data_attributes.rs b/src/datadogV2/model/model_input_schema_data_attributes.rs deleted file mode 100644 index 6202839f0..000000000 --- a/src/datadogV2/model/model_input_schema_data_attributes.rs +++ /dev/null @@ -1,110 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `InputSchemaDataAttributes` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct InputSchemaDataAttributes { - /// The `attributes` `parameters`. - #[serde(rename = "parameters")] - pub parameters: Option>, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl InputSchemaDataAttributes { - pub fn new() -> InputSchemaDataAttributes { - InputSchemaDataAttributes { - parameters: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn parameters( - mut self, - value: Vec, - ) -> Self { - self.parameters = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for InputSchemaDataAttributes { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for InputSchemaDataAttributes { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct InputSchemaDataAttributesVisitor; - impl<'a> Visitor<'a> for InputSchemaDataAttributesVisitor { - type Value = InputSchemaDataAttributes; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut parameters: Option< - Vec, - > = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "parameters" => { - if v.is_null() { - continue; - } - parameters = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = InputSchemaDataAttributes { - parameters, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(InputSchemaDataAttributesVisitor) - } -} diff --git a/src/datadogV2/model/model_input_schema_data_attributes_parameters_items.rs b/src/datadogV2/model/model_input_schema_data_attributes_parameters_items.rs deleted file mode 100644 index 6dffaebc7..000000000 --- a/src/datadogV2/model/model_input_schema_data_attributes_parameters_items.rs +++ /dev/null @@ -1,110 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `InputSchemaDataAttributesParametersItems` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct InputSchemaDataAttributesParametersItems { - /// The definition of `InputSchemaDataAttributesParametersItemsData` object. - #[serde(rename = "data")] - pub data: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl InputSchemaDataAttributesParametersItems { - pub fn new() -> InputSchemaDataAttributesParametersItems { - InputSchemaDataAttributesParametersItems { - data: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn data( - mut self, - value: crate::datadogV2::model::InputSchemaDataAttributesParametersItemsData, - ) -> Self { - self.data = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for InputSchemaDataAttributesParametersItems { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for InputSchemaDataAttributesParametersItems { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct InputSchemaDataAttributesParametersItemsVisitor; - impl<'a> Visitor<'a> for InputSchemaDataAttributesParametersItemsVisitor { - type Value = InputSchemaDataAttributesParametersItems; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut data: Option< - crate::datadogV2::model::InputSchemaDataAttributesParametersItemsData, - > = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "data" => { - if v.is_null() { - continue; - } - data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = InputSchemaDataAttributesParametersItems { - data, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(InputSchemaDataAttributesParametersItemsVisitor) - } -} diff --git a/src/datadogV2/model/model_input_schema_data_attributes_parameters_items_data.rs b/src/datadogV2/model/model_input_schema_data_attributes_parameters_items_data.rs deleted file mode 100644 index dd194c22f..000000000 --- a/src/datadogV2/model/model_input_schema_data_attributes_parameters_items_data.rs +++ /dev/null @@ -1,111 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `InputSchemaDataAttributesParametersItemsData` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct InputSchemaDataAttributesParametersItemsData { - /// The definition of `InputSchemaDataAttributesParametersItemsDataAttributes` object. - #[serde(rename = "attributes")] - pub attributes: - Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl InputSchemaDataAttributesParametersItemsData { - pub fn new() -> InputSchemaDataAttributesParametersItemsData { - InputSchemaDataAttributesParametersItemsData { - attributes: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn attributes( - mut self, - value: crate::datadogV2::model::InputSchemaDataAttributesParametersItemsDataAttributes, - ) -> Self { - self.attributes = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for InputSchemaDataAttributesParametersItemsData { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for InputSchemaDataAttributesParametersItemsData { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct InputSchemaDataAttributesParametersItemsDataVisitor; - impl<'a> Visitor<'a> for InputSchemaDataAttributesParametersItemsDataVisitor { - type Value = InputSchemaDataAttributesParametersItemsData; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut attributes: Option< - crate::datadogV2::model::InputSchemaDataAttributesParametersItemsDataAttributes, - > = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "attributes" => { - if v.is_null() { - continue; - } - attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = InputSchemaDataAttributesParametersItemsData { - attributes, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(InputSchemaDataAttributesParametersItemsDataVisitor) - } -} diff --git a/src/datadogV2/model/model_input_schema_data_attributes_parameters_items_data_attributes.rs b/src/datadogV2/model/model_input_schema_data_attributes_parameters_items_data_attributes.rs deleted file mode 100644 index 0d6349e35..000000000 --- a/src/datadogV2/model/model_input_schema_data_attributes_parameters_items_data_attributes.rs +++ /dev/null @@ -1,192 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `InputSchemaDataAttributesParametersItemsDataAttributes` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct InputSchemaDataAttributesParametersItemsDataAttributes { - /// The `attributes` `defaultValue`. - #[serde(rename = "defaultValue")] - pub default_value: Option, - /// The `attributes` `description`. - #[serde(rename = "description")] - pub description: Option, - /// The `attributes` `enum`. - #[serde(rename = "enum")] - pub enum_: Option>, - /// The `attributes` `label`. - #[serde(rename = "label")] - pub label: Option, - /// The `attributes` `name`. - #[serde(rename = "name")] - pub name: Option, - /// The `attributes` `type`. - #[serde(rename = "type")] - pub type_: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl InputSchemaDataAttributesParametersItemsDataAttributes { - pub fn new() -> InputSchemaDataAttributesParametersItemsDataAttributes { - InputSchemaDataAttributesParametersItemsDataAttributes { - default_value: None, - description: None, - enum_: None, - label: None, - name: None, - type_: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn default_value(mut self, value: serde_json::Value) -> Self { - self.default_value = Some(value); - self - } - - pub fn description(mut self, value: String) -> Self { - self.description = Some(value); - self - } - - pub fn enum_(mut self, value: Vec) -> Self { - self.enum_ = Some(value); - self - } - - pub fn label(mut self, value: String) -> Self { - self.label = Some(value); - self - } - - pub fn name(mut self, value: String) -> Self { - self.name = Some(value); - self - } - - pub fn type_(mut self, value: String) -> Self { - self.type_ = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for InputSchemaDataAttributesParametersItemsDataAttributes { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for InputSchemaDataAttributesParametersItemsDataAttributes { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct InputSchemaDataAttributesParametersItemsDataAttributesVisitor; - impl<'a> Visitor<'a> for InputSchemaDataAttributesParametersItemsDataAttributesVisitor { - type Value = InputSchemaDataAttributesParametersItemsDataAttributes; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut default_value: Option = None; - let mut description: Option = None; - let mut enum_: Option> = None; - let mut label: Option = None; - let mut name: Option = None; - let mut type_: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "defaultValue" => { - if v.is_null() { - continue; - } - default_value = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "description" => { - if v.is_null() { - continue; - } - description = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "enum" => { - if v.is_null() { - continue; - } - enum_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "label" => { - if v.is_null() { - continue; - } - label = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "name" => { - if v.is_null() { - continue; - } - name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "type" => { - if v.is_null() { - continue; - } - type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = InputSchemaDataAttributesParametersItemsDataAttributes { - default_value, - description, - enum_, - label, - name, - type_, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(InputSchemaDataAttributesParametersItemsDataAttributesVisitor) - } -} diff --git a/src/datadogV2/model/model_input_schema_data_type.rs b/src/datadogV2/model/model_input_schema_data_type.rs deleted file mode 100644 index 758399682..000000000 --- a/src/datadogV2/model/model_input_schema_data_type.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -use serde::{Deserialize, Deserializer, Serialize, Serializer}; - -#[non_exhaustive] -#[derive(Clone, Debug, Eq, PartialEq)] -pub enum InputSchemaDataType { - INPUTSCHEMA, - UnparsedObject(crate::datadog::UnparsedObject), -} - -impl ToString for InputSchemaDataType { - fn to_string(&self) -> String { - match self { - Self::INPUTSCHEMA => String::from("inputSchema"), - Self::UnparsedObject(v) => v.value.to_string(), - } - } -} - -impl Serialize for InputSchemaDataType { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - match self { - Self::UnparsedObject(v) => v.serialize(serializer), - _ => serializer.serialize_str(self.to_string().as_str()), - } - } -} - -impl<'de> Deserialize<'de> for InputSchemaDataType { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let s: String = String::deserialize(deserializer)?; - Ok(match s.as_str() { - "inputSchema" => Self::INPUTSCHEMA, - _ => Self::UnparsedObject(crate::datadog::UnparsedObject { - value: serde_json::Value::String(s.into()), - }), - }) - } -} diff --git a/src/datadogV2/model/model_list_apps_response.rs b/src/datadogV2/model/model_list_apps_response.rs deleted file mode 100644 index 3bf0b219e..000000000 --- a/src/datadogV2/model/model_list_apps_response.rs +++ /dev/null @@ -1,140 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `ListAppsResponse` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct ListAppsResponse { - /// The `ListAppsResponse` `data`. - #[serde(rename = "data")] - pub data: Option>, - /// The `ListAppsResponse` `included`. - #[serde(rename = "included")] - pub included: Option>, - /// The definition of `ListAppsResponseMeta` object. - #[serde(rename = "meta")] - pub meta: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl ListAppsResponse { - pub fn new() -> ListAppsResponse { - ListAppsResponse { - data: None, - included: None, - meta: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn data(mut self, value: Vec) -> Self { - self.data = Some(value); - self - } - - pub fn included(mut self, value: Vec) -> Self { - self.included = Some(value); - self - } - - pub fn meta(mut self, value: crate::datadogV2::model::ListAppsResponseMeta) -> Self { - self.meta = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for ListAppsResponse { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for ListAppsResponse { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct ListAppsResponseVisitor; - impl<'a> Visitor<'a> for ListAppsResponseVisitor { - type Value = ListAppsResponse; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut data: Option> = - None; - let mut included: Option> = None; - let mut meta: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "data" => { - if v.is_null() { - continue; - } - data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "included" => { - if v.is_null() { - continue; - } - included = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "meta" => { - if v.is_null() { - continue; - } - meta = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = ListAppsResponse { - data, - included, - meta, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(ListAppsResponseVisitor) - } -} diff --git a/src/datadogV2/model/model_list_apps_response_data_items.rs b/src/datadogV2/model/model_list_apps_response_data_items.rs deleted file mode 100644 index 482216951..000000000 --- a/src/datadogV2/model/model_list_apps_response_data_items.rs +++ /dev/null @@ -1,167 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `ListAppsResponseDataItems` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct ListAppsResponseDataItems { - /// The definition of `ListAppsResponseDataItemsAttributes` object. - #[serde(rename = "attributes")] - pub attributes: crate::datadogV2::model::ListAppsResponseDataItemsAttributes, - /// The `items` `id`. - #[serde(rename = "id")] - pub id: String, - /// The definition of `AppMeta` object. - #[serde(rename = "meta")] - pub meta: Option, - /// The definition of `ListAppsResponseDataItemsRelationships` object. - #[serde(rename = "relationships")] - pub relationships: Option, - /// The definition of `ListAppsResponseDataItemsType` object. - #[serde(rename = "type")] - pub type_: crate::datadogV2::model::ListAppsResponseDataItemsType, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl ListAppsResponseDataItems { - pub fn new( - attributes: crate::datadogV2::model::ListAppsResponseDataItemsAttributes, - id: String, - type_: crate::datadogV2::model::ListAppsResponseDataItemsType, - ) -> ListAppsResponseDataItems { - ListAppsResponseDataItems { - attributes, - id, - meta: None, - relationships: None, - type_, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn meta(mut self, value: crate::datadogV2::model::AppMeta) -> Self { - self.meta = Some(value); - self - } - - pub fn relationships( - mut self, - value: crate::datadogV2::model::ListAppsResponseDataItemsRelationships, - ) -> Self { - self.relationships = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl<'de> Deserialize<'de> for ListAppsResponseDataItems { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct ListAppsResponseDataItemsVisitor; - impl<'a> Visitor<'a> for ListAppsResponseDataItemsVisitor { - type Value = ListAppsResponseDataItems; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut attributes: Option< - crate::datadogV2::model::ListAppsResponseDataItemsAttributes, - > = None; - let mut id: Option = None; - let mut meta: Option = None; - let mut relationships: Option< - crate::datadogV2::model::ListAppsResponseDataItemsRelationships, - > = None; - let mut type_: Option = - None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "attributes" => { - attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "id" => { - id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "meta" => { - if v.is_null() { - continue; - } - meta = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "relationships" => { - if v.is_null() { - continue; - } - relationships = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "type" => { - type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - if let Some(ref _type_) = type_ { - match _type_ { - crate::datadogV2::model::ListAppsResponseDataItemsType::UnparsedObject(_type_) => { - _unparsed = true; - }, - _ => {} - } - } - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; - let id = id.ok_or_else(|| M::Error::missing_field("id"))?; - let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; - - let content = ListAppsResponseDataItems { - attributes, - id, - meta, - relationships, - type_, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(ListAppsResponseDataItemsVisitor) - } -} diff --git a/src/datadogV2/model/model_list_apps_response_data_items_attributes.rs b/src/datadogV2/model/model_list_apps_response_data_items_attributes.rs deleted file mode 100644 index 6826be218..000000000 --- a/src/datadogV2/model/model_list_apps_response_data_items_attributes.rs +++ /dev/null @@ -1,175 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `ListAppsResponseDataItemsAttributes` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct ListAppsResponseDataItemsAttributes { - /// The `attributes` `description`. - #[serde(rename = "description")] - pub description: Option, - /// The `attributes` `favorite`. - #[serde(rename = "favorite")] - pub favorite: Option, - /// The `attributes` `name`. - #[serde(rename = "name")] - pub name: Option, - /// The `attributes` `selfService`. - #[serde(rename = "selfService")] - pub self_service: Option, - /// The `attributes` `tags`. - #[serde(rename = "tags")] - pub tags: Option>, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl ListAppsResponseDataItemsAttributes { - pub fn new() -> ListAppsResponseDataItemsAttributes { - ListAppsResponseDataItemsAttributes { - description: None, - favorite: None, - name: None, - self_service: None, - tags: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn description(mut self, value: String) -> Self { - self.description = Some(value); - self - } - - pub fn favorite(mut self, value: bool) -> Self { - self.favorite = Some(value); - self - } - - pub fn name(mut self, value: String) -> Self { - self.name = Some(value); - self - } - - pub fn self_service(mut self, value: bool) -> Self { - self.self_service = Some(value); - self - } - - pub fn tags(mut self, value: Vec) -> Self { - self.tags = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for ListAppsResponseDataItemsAttributes { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for ListAppsResponseDataItemsAttributes { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct ListAppsResponseDataItemsAttributesVisitor; - impl<'a> Visitor<'a> for ListAppsResponseDataItemsAttributesVisitor { - type Value = ListAppsResponseDataItemsAttributes; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut description: Option = None; - let mut favorite: Option = None; - let mut name: Option = None; - let mut self_service: Option = None; - let mut tags: Option> = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "description" => { - if v.is_null() { - continue; - } - description = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "favorite" => { - if v.is_null() { - continue; - } - favorite = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "name" => { - if v.is_null() { - continue; - } - name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "selfService" => { - if v.is_null() { - continue; - } - self_service = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "tags" => { - if v.is_null() { - continue; - } - tags = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = ListAppsResponseDataItemsAttributes { - description, - favorite, - name, - self_service, - tags, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(ListAppsResponseDataItemsAttributesVisitor) - } -} diff --git a/src/datadogV2/model/model_list_apps_response_data_items_relationships.rs b/src/datadogV2/model/model_list_apps_response_data_items_relationships.rs deleted file mode 100644 index d434b06ee..000000000 --- a/src/datadogV2/model/model_list_apps_response_data_items_relationships.rs +++ /dev/null @@ -1,105 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `ListAppsResponseDataItemsRelationships` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct ListAppsResponseDataItemsRelationships { - /// The definition of `DeploymentRelationship` object. - #[serde(rename = "deployment")] - pub deployment: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl ListAppsResponseDataItemsRelationships { - pub fn new() -> ListAppsResponseDataItemsRelationships { - ListAppsResponseDataItemsRelationships { - deployment: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn deployment(mut self, value: crate::datadogV2::model::DeploymentRelationship) -> Self { - self.deployment = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for ListAppsResponseDataItemsRelationships { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for ListAppsResponseDataItemsRelationships { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct ListAppsResponseDataItemsRelationshipsVisitor; - impl<'a> Visitor<'a> for ListAppsResponseDataItemsRelationshipsVisitor { - type Value = ListAppsResponseDataItemsRelationships; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut deployment: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "deployment" => { - if v.is_null() { - continue; - } - deployment = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = ListAppsResponseDataItemsRelationships { - deployment, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(ListAppsResponseDataItemsRelationshipsVisitor) - } -} diff --git a/src/datadogV2/model/model_list_apps_response_data_items_type.rs b/src/datadogV2/model/model_list_apps_response_data_items_type.rs deleted file mode 100644 index cc83fe004..000000000 --- a/src/datadogV2/model/model_list_apps_response_data_items_type.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -use serde::{Deserialize, Deserializer, Serialize, Serializer}; - -#[non_exhaustive] -#[derive(Clone, Debug, Eq, PartialEq)] -pub enum ListAppsResponseDataItemsType { - APPDEFINITIONS, - UnparsedObject(crate::datadog::UnparsedObject), -} - -impl ToString for ListAppsResponseDataItemsType { - fn to_string(&self) -> String { - match self { - Self::APPDEFINITIONS => String::from("appDefinitions"), - Self::UnparsedObject(v) => v.value.to_string(), - } - } -} - -impl Serialize for ListAppsResponseDataItemsType { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - match self { - Self::UnparsedObject(v) => v.serialize(serializer), - _ => serializer.serialize_str(self.to_string().as_str()), - } - } -} - -impl<'de> Deserialize<'de> for ListAppsResponseDataItemsType { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let s: String = String::deserialize(deserializer)?; - Ok(match s.as_str() { - "appDefinitions" => Self::APPDEFINITIONS, - _ => Self::UnparsedObject(crate::datadog::UnparsedObject { - value: serde_json::Value::String(s.into()), - }), - }) - } -} diff --git a/src/datadogV2/model/model_list_apps_response_meta.rs b/src/datadogV2/model/model_list_apps_response_meta.rs deleted file mode 100644 index a54bedf47..000000000 --- a/src/datadogV2/model/model_list_apps_response_meta.rs +++ /dev/null @@ -1,105 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `ListAppsResponseMeta` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct ListAppsResponseMeta { - /// The definition of `ListAppsResponseMetaPage` object. - #[serde(rename = "page")] - pub page: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl ListAppsResponseMeta { - pub fn new() -> ListAppsResponseMeta { - ListAppsResponseMeta { - page: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn page(mut self, value: crate::datadogV2::model::ListAppsResponseMetaPage) -> Self { - self.page = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for ListAppsResponseMeta { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for ListAppsResponseMeta { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct ListAppsResponseMetaVisitor; - impl<'a> Visitor<'a> for ListAppsResponseMetaVisitor { - type Value = ListAppsResponseMeta; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut page: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "page" => { - if v.is_null() { - continue; - } - page = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = ListAppsResponseMeta { - page, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(ListAppsResponseMetaVisitor) - } -} diff --git a/src/datadogV2/model/model_list_apps_response_meta_page.rs b/src/datadogV2/model/model_list_apps_response_meta_page.rs deleted file mode 100644 index b1408b5f2..000000000 --- a/src/datadogV2/model/model_list_apps_response_meta_page.rs +++ /dev/null @@ -1,124 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `ListAppsResponseMetaPage` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct ListAppsResponseMetaPage { - /// The `page` `totalCount`. - #[serde(rename = "totalCount")] - pub total_count: Option, - /// The `page` `totalFilteredCount`. - #[serde(rename = "totalFilteredCount")] - pub total_filtered_count: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl ListAppsResponseMetaPage { - pub fn new() -> ListAppsResponseMetaPage { - ListAppsResponseMetaPage { - total_count: None, - total_filtered_count: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn total_count(mut self, value: i64) -> Self { - self.total_count = Some(value); - self - } - - pub fn total_filtered_count(mut self, value: i64) -> Self { - self.total_filtered_count = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for ListAppsResponseMetaPage { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for ListAppsResponseMetaPage { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct ListAppsResponseMetaPageVisitor; - impl<'a> Visitor<'a> for ListAppsResponseMetaPageVisitor { - type Value = ListAppsResponseMetaPage; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut total_count: Option = None; - let mut total_filtered_count: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "totalCount" => { - if v.is_null() { - continue; - } - total_count = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "totalFilteredCount" => { - if v.is_null() { - continue; - } - total_filtered_count = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = ListAppsResponseMetaPage { - total_count, - total_filtered_count, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(ListAppsResponseMetaPageVisitor) - } -} diff --git a/src/datadogV2/model/model_query.rs b/src/datadogV2/model/model_query.rs deleted file mode 100644 index e90511857..000000000 --- a/src/datadogV2/model/model_query.rs +++ /dev/null @@ -1,154 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `Query` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct Query { - /// The `Query` `events`. - #[serde(rename = "events")] - pub events: Option>, - /// The `Query` `id`. - #[serde(rename = "id")] - pub id: String, - /// The `Query` `name`. - #[serde(rename = "name")] - pub name: String, - /// The `Query` `properties`. - #[serde(rename = "properties")] - pub properties: Option, - /// The definition of `QueryType` object. - #[serde(rename = "type")] - pub type_: crate::datadogV2::model::QueryType, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl Query { - pub fn new(id: String, name: String, type_: crate::datadogV2::model::QueryType) -> Query { - Query { - events: None, - id, - name, - properties: None, - type_, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn events(mut self, value: Vec) -> Self { - self.events = Some(value); - self - } - - pub fn properties(mut self, value: serde_json::Value) -> Self { - self.properties = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl<'de> Deserialize<'de> for Query { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct QueryVisitor; - impl<'a> Visitor<'a> for QueryVisitor { - type Value = Query; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut events: Option> = None; - let mut id: Option = None; - let mut name: Option = None; - let mut properties: Option = None; - let mut type_: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "events" => { - if v.is_null() { - continue; - } - events = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "id" => { - id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "name" => { - name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "properties" => { - if v.is_null() { - continue; - } - properties = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "type" => { - type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - if let Some(ref _type_) = type_ { - match _type_ { - crate::datadogV2::model::QueryType::UnparsedObject(_type_) => { - _unparsed = true; - } - _ => {} - } - } - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - let id = id.ok_or_else(|| M::Error::missing_field("id"))?; - let name = name.ok_or_else(|| M::Error::missing_field("name"))?; - let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; - - let content = Query { - events, - id, - name, - properties, - type_, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(QueryVisitor) - } -} diff --git a/src/datadogV2/model/model_query_type.rs b/src/datadogV2/model/model_query_type.rs deleted file mode 100644 index b0f11af15..000000000 --- a/src/datadogV2/model/model_query_type.rs +++ /dev/null @@ -1,54 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -use serde::{Deserialize, Deserializer, Serialize, Serializer}; - -#[non_exhaustive] -#[derive(Clone, Debug, Eq, PartialEq)] -pub enum QueryType { - ACTION, - STATEVARIABLE, - DATATRANSFORM, - UnparsedObject(crate::datadog::UnparsedObject), -} - -impl ToString for QueryType { - fn to_string(&self) -> String { - match self { - Self::ACTION => String::from("action"), - Self::STATEVARIABLE => String::from("stateVariable"), - Self::DATATRANSFORM => String::from("dataTransform"), - Self::UnparsedObject(v) => v.value.to_string(), - } - } -} - -impl Serialize for QueryType { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - match self { - Self::UnparsedObject(v) => v.serialize(serializer), - _ => serializer.serialize_str(self.to_string().as_str()), - } - } -} - -impl<'de> Deserialize<'de> for QueryType { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let s: String = String::deserialize(deserializer)?; - Ok(match s.as_str() { - "action" => Self::ACTION, - "stateVariable" => Self::STATEVARIABLE, - "dataTransform" => Self::DATATRANSFORM, - _ => Self::UnparsedObject(crate::datadog::UnparsedObject { - value: serde_json::Value::String(s.into()), - }), - }) - } -} diff --git a/src/datadogV2/model/model_script.rs b/src/datadogV2/model/model_script.rs deleted file mode 100644 index af656f432..000000000 --- a/src/datadogV2/model/model_script.rs +++ /dev/null @@ -1,105 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `Script` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct Script { - /// The definition of `ScriptData` object. - #[serde(rename = "data")] - pub data: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl Script { - pub fn new() -> Script { - Script { - data: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn data(mut self, value: crate::datadogV2::model::ScriptData) -> Self { - self.data = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for Script { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for Script { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct ScriptVisitor; - impl<'a> Visitor<'a> for ScriptVisitor { - type Value = Script; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut data: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "data" => { - if v.is_null() { - continue; - } - data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = Script { - data, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(ScriptVisitor) - } -} diff --git a/src/datadogV2/model/model_script_data.rs b/src/datadogV2/model/model_script_data.rs deleted file mode 100644 index 587926c66..000000000 --- a/src/datadogV2/model/model_script_data.rs +++ /dev/null @@ -1,149 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `ScriptData` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct ScriptData { - /// The definition of `ScriptDataAttributes` object. - #[serde(rename = "attributes")] - pub attributes: Option, - /// The `data` `id`. - #[serde(rename = "id")] - pub id: Option, - /// The definition of `ScriptDataType` object. - #[serde(rename = "type")] - pub type_: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl ScriptData { - pub fn new() -> ScriptData { - ScriptData { - attributes: None, - id: None, - type_: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn attributes(mut self, value: crate::datadogV2::model::ScriptDataAttributes) -> Self { - self.attributes = Some(value); - self - } - - pub fn id(mut self, value: String) -> Self { - self.id = Some(value); - self - } - - pub fn type_(mut self, value: crate::datadogV2::model::ScriptDataType) -> Self { - self.type_ = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for ScriptData { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for ScriptData { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct ScriptDataVisitor; - impl<'a> Visitor<'a> for ScriptDataVisitor { - type Value = ScriptData; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut attributes: Option = None; - let mut id: Option = None; - let mut type_: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "attributes" => { - if v.is_null() { - continue; - } - attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "id" => { - if v.is_null() { - continue; - } - id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "type" => { - if v.is_null() { - continue; - } - type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - if let Some(ref _type_) = type_ { - match _type_ { - crate::datadogV2::model::ScriptDataType::UnparsedObject( - _type_, - ) => { - _unparsed = true; - } - _ => {} - } - } - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = ScriptData { - attributes, - id, - type_, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(ScriptDataVisitor) - } -} diff --git a/src/datadogV2/model/model_script_data_attributes.rs b/src/datadogV2/model/model_script_data_attributes.rs deleted file mode 100644 index 4181b8383..000000000 --- a/src/datadogV2/model/model_script_data_attributes.rs +++ /dev/null @@ -1,139 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `ScriptDataAttributes` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct ScriptDataAttributes { - /// The `attributes` `name`. - #[serde(rename = "name")] - pub name: Option, - /// The `attributes` `src`. - #[serde(rename = "src")] - pub src: Option, - /// The `attributes` `type`. - #[serde(rename = "type")] - pub type_: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl ScriptDataAttributes { - pub fn new() -> ScriptDataAttributes { - ScriptDataAttributes { - name: None, - src: None, - type_: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn name(mut self, value: String) -> Self { - self.name = Some(value); - self - } - - pub fn src(mut self, value: String) -> Self { - self.src = Some(value); - self - } - - pub fn type_(mut self, value: String) -> Self { - self.type_ = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for ScriptDataAttributes { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for ScriptDataAttributes { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct ScriptDataAttributesVisitor; - impl<'a> Visitor<'a> for ScriptDataAttributesVisitor { - type Value = ScriptDataAttributes; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut name: Option = None; - let mut src: Option = None; - let mut type_: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "name" => { - if v.is_null() { - continue; - } - name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "src" => { - if v.is_null() { - continue; - } - src = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "type" => { - if v.is_null() { - continue; - } - type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = ScriptDataAttributes { - name, - src, - type_, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(ScriptDataAttributesVisitor) - } -} diff --git a/src/datadogV2/model/model_script_data_type.rs b/src/datadogV2/model/model_script_data_type.rs deleted file mode 100644 index 53ab43d20..000000000 --- a/src/datadogV2/model/model_script_data_type.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -use serde::{Deserialize, Deserializer, Serialize, Serializer}; - -#[non_exhaustive] -#[derive(Clone, Debug, Eq, PartialEq)] -pub enum ScriptDataType { - SCRIPTS, - UnparsedObject(crate::datadog::UnparsedObject), -} - -impl ToString for ScriptDataType { - fn to_string(&self) -> String { - match self { - Self::SCRIPTS => String::from("scripts"), - Self::UnparsedObject(v) => v.value.to_string(), - } - } -} - -impl Serialize for ScriptDataType { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - match self { - Self::UnparsedObject(v) => v.serialize(serializer), - _ => serializer.serialize_str(self.to_string().as_str()), - } - } -} - -impl<'de> Deserialize<'de> for ScriptDataType { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let s: String = String::deserialize(deserializer)?; - Ok(match s.as_str() { - "scripts" => Self::SCRIPTS, - _ => Self::UnparsedObject(crate::datadog::UnparsedObject { - value: serde_json::Value::String(s.into()), - }), - }) - } -} diff --git a/src/datadogV2/model/model_update_app_request.rs b/src/datadogV2/model/model_update_app_request.rs deleted file mode 100644 index 4103d111a..000000000 --- a/src/datadogV2/model/model_update_app_request.rs +++ /dev/null @@ -1,105 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `UpdateAppRequest` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct UpdateAppRequest { - /// The definition of `UpdateAppRequestData` object. - #[serde(rename = "data")] - pub data: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl UpdateAppRequest { - pub fn new() -> UpdateAppRequest { - UpdateAppRequest { - data: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn data(mut self, value: crate::datadogV2::model::UpdateAppRequestData) -> Self { - self.data = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for UpdateAppRequest { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for UpdateAppRequest { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct UpdateAppRequestVisitor; - impl<'a> Visitor<'a> for UpdateAppRequestVisitor { - type Value = UpdateAppRequest; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut data: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "data" => { - if v.is_null() { - continue; - } - data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = UpdateAppRequest { - data, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(UpdateAppRequestVisitor) - } -} diff --git a/src/datadogV2/model/model_update_app_request_data.rs b/src/datadogV2/model/model_update_app_request_data.rs deleted file mode 100644 index b58b70629..000000000 --- a/src/datadogV2/model/model_update_app_request_data.rs +++ /dev/null @@ -1,139 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `UpdateAppRequestData` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct UpdateAppRequestData { - /// The definition of `UpdateAppRequestDataAttributes` object. - #[serde(rename = "attributes")] - pub attributes: Option, - /// The `data` `id`. - #[serde(rename = "id")] - pub id: Option, - /// The definition of `UpdateAppRequestDataType` object. - #[serde(rename = "type")] - pub type_: crate::datadogV2::model::UpdateAppRequestDataType, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl UpdateAppRequestData { - pub fn new(type_: crate::datadogV2::model::UpdateAppRequestDataType) -> UpdateAppRequestData { - UpdateAppRequestData { - attributes: None, - id: None, - type_, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn attributes( - mut self, - value: crate::datadogV2::model::UpdateAppRequestDataAttributes, - ) -> Self { - self.attributes = Some(value); - self - } - - pub fn id(mut self, value: String) -> Self { - self.id = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl<'de> Deserialize<'de> for UpdateAppRequestData { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct UpdateAppRequestDataVisitor; - impl<'a> Visitor<'a> for UpdateAppRequestDataVisitor { - type Value = UpdateAppRequestData; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut attributes: Option< - crate::datadogV2::model::UpdateAppRequestDataAttributes, - > = None; - let mut id: Option = None; - let mut type_: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "attributes" => { - if v.is_null() { - continue; - } - attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "id" => { - if v.is_null() { - continue; - } - id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "type" => { - type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - if let Some(ref _type_) = type_ { - match _type_ { - crate::datadogV2::model::UpdateAppRequestDataType::UnparsedObject(_type_) => { - _unparsed = true; - }, - _ => {} - } - } - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; - - let content = UpdateAppRequestData { - attributes, - id, - type_, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(UpdateAppRequestDataVisitor) - } -} diff --git a/src/datadogV2/model/model_update_app_request_data_attributes.rs b/src/datadogV2/model/model_update_app_request_data_attributes.rs deleted file mode 100644 index 28d184fb4..000000000 --- a/src/datadogV2/model/model_update_app_request_data_attributes.rs +++ /dev/null @@ -1,228 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `UpdateAppRequestDataAttributes` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct UpdateAppRequestDataAttributes { - /// The `attributes` `components`. - #[serde(rename = "components")] - pub components: Option>, - /// The `attributes` `description`. - #[serde(rename = "description")] - pub description: Option, - /// The `attributes` `embeddedQueries`. - #[serde(rename = "embeddedQueries")] - pub embedded_queries: Option>, - /// The definition of `InputSchema` object. - #[serde(rename = "inputSchema")] - pub input_schema: Option, - /// The `attributes` `name`. - #[serde(rename = "name")] - pub name: Option, - /// The `attributes` `rootInstanceName`. - #[serde(rename = "rootInstanceName")] - pub root_instance_name: Option, - /// The `attributes` `scripts`. - #[serde(rename = "scripts")] - pub scripts: Option>, - /// The `attributes` `tags`. - #[serde(rename = "tags")] - pub tags: Option>, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl UpdateAppRequestDataAttributes { - pub fn new() -> UpdateAppRequestDataAttributes { - UpdateAppRequestDataAttributes { - components: None, - description: None, - embedded_queries: None, - input_schema: None, - name: None, - root_instance_name: None, - scripts: None, - tags: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn components(mut self, value: Vec) -> Self { - self.components = Some(value); - self - } - - pub fn description(mut self, value: String) -> Self { - self.description = Some(value); - self - } - - pub fn embedded_queries(mut self, value: Vec) -> Self { - self.embedded_queries = Some(value); - self - } - - pub fn input_schema(mut self, value: crate::datadogV2::model::InputSchema) -> Self { - self.input_schema = Some(value); - self - } - - pub fn name(mut self, value: String) -> Self { - self.name = Some(value); - self - } - - pub fn root_instance_name(mut self, value: String) -> Self { - self.root_instance_name = Some(value); - self - } - - pub fn scripts(mut self, value: Vec) -> Self { - self.scripts = Some(value); - self - } - - pub fn tags(mut self, value: Vec) -> Self { - self.tags = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for UpdateAppRequestDataAttributes { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for UpdateAppRequestDataAttributes { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct UpdateAppRequestDataAttributesVisitor; - impl<'a> Visitor<'a> for UpdateAppRequestDataAttributesVisitor { - type Value = UpdateAppRequestDataAttributes; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut components: Option> = None; - let mut description: Option = None; - let mut embedded_queries: Option> = None; - let mut input_schema: Option = None; - let mut name: Option = None; - let mut root_instance_name: Option = None; - let mut scripts: Option> = None; - let mut tags: Option> = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "components" => { - if v.is_null() { - continue; - } - components = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "description" => { - if v.is_null() { - continue; - } - description = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "embeddedQueries" => { - if v.is_null() { - continue; - } - embedded_queries = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "inputSchema" => { - if v.is_null() { - continue; - } - input_schema = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "name" => { - if v.is_null() { - continue; - } - name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "rootInstanceName" => { - if v.is_null() { - continue; - } - root_instance_name = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "scripts" => { - if v.is_null() { - continue; - } - scripts = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "tags" => { - if v.is_null() { - continue; - } - tags = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = UpdateAppRequestDataAttributes { - components, - description, - embedded_queries, - input_schema, - name, - root_instance_name, - scripts, - tags, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(UpdateAppRequestDataAttributesVisitor) - } -} diff --git a/src/datadogV2/model/model_update_app_request_data_type.rs b/src/datadogV2/model/model_update_app_request_data_type.rs deleted file mode 100644 index 6d9021318..000000000 --- a/src/datadogV2/model/model_update_app_request_data_type.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -use serde::{Deserialize, Deserializer, Serialize, Serializer}; - -#[non_exhaustive] -#[derive(Clone, Debug, Eq, PartialEq)] -pub enum UpdateAppRequestDataType { - APPDEFINITIONS, - UnparsedObject(crate::datadog::UnparsedObject), -} - -impl ToString for UpdateAppRequestDataType { - fn to_string(&self) -> String { - match self { - Self::APPDEFINITIONS => String::from("appDefinitions"), - Self::UnparsedObject(v) => v.value.to_string(), - } - } -} - -impl Serialize for UpdateAppRequestDataType { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - match self { - Self::UnparsedObject(v) => v.serialize(serializer), - _ => serializer.serialize_str(self.to_string().as_str()), - } - } -} - -impl<'de> Deserialize<'de> for UpdateAppRequestDataType { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let s: String = String::deserialize(deserializer)?; - Ok(match s.as_str() { - "appDefinitions" => Self::APPDEFINITIONS, - _ => Self::UnparsedObject(crate::datadog::UnparsedObject { - value: serde_json::Value::String(s.into()), - }), - }) - } -} diff --git a/src/datadogV2/model/model_update_app_response.rs b/src/datadogV2/model/model_update_app_response.rs deleted file mode 100644 index 91f40efc6..000000000 --- a/src/datadogV2/model/model_update_app_response.rs +++ /dev/null @@ -1,162 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `UpdateAppResponse` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct UpdateAppResponse { - /// The definition of `UpdateAppResponseData` object. - #[serde(rename = "data")] - pub data: Option, - /// The `UpdateAppResponse` `included`. - #[serde(rename = "included")] - pub included: Option>, - /// The definition of `AppMeta` object. - #[serde(rename = "meta")] - pub meta: Option, - /// The definition of `UpdateAppResponseRelationship` object. - #[serde(rename = "relationship")] - pub relationship: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl UpdateAppResponse { - pub fn new() -> UpdateAppResponse { - UpdateAppResponse { - data: None, - included: None, - meta: None, - relationship: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn data(mut self, value: crate::datadogV2::model::UpdateAppResponseData) -> Self { - self.data = Some(value); - self - } - - pub fn included(mut self, value: Vec) -> Self { - self.included = Some(value); - self - } - - pub fn meta(mut self, value: crate::datadogV2::model::AppMeta) -> Self { - self.meta = Some(value); - self - } - - pub fn relationship( - mut self, - value: crate::datadogV2::model::UpdateAppResponseRelationship, - ) -> Self { - self.relationship = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for UpdateAppResponse { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for UpdateAppResponse { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct UpdateAppResponseVisitor; - impl<'a> Visitor<'a> for UpdateAppResponseVisitor { - type Value = UpdateAppResponse; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut data: Option = None; - let mut included: Option> = None; - let mut meta: Option = None; - let mut relationship: Option< - crate::datadogV2::model::UpdateAppResponseRelationship, - > = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "data" => { - if v.is_null() { - continue; - } - data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "included" => { - if v.is_null() { - continue; - } - included = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "meta" => { - if v.is_null() { - continue; - } - meta = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "relationship" => { - if v.is_null() { - continue; - } - relationship = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = UpdateAppResponse { - data, - included, - meta, - relationship, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(UpdateAppResponseVisitor) - } -} diff --git a/src/datadogV2/model/model_update_app_response_data.rs b/src/datadogV2/model/model_update_app_response_data.rs deleted file mode 100644 index 849552d4c..000000000 --- a/src/datadogV2/model/model_update_app_response_data.rs +++ /dev/null @@ -1,126 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `UpdateAppResponseData` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct UpdateAppResponseData { - /// The definition of `UpdateAppResponseDataAttributes` object. - #[serde(rename = "attributes")] - pub attributes: crate::datadogV2::model::UpdateAppResponseDataAttributes, - /// The `data` `id`. - #[serde(rename = "id")] - pub id: String, - /// The definition of `UpdateAppResponseDataType` object. - #[serde(rename = "type")] - pub type_: crate::datadogV2::model::UpdateAppResponseDataType, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl UpdateAppResponseData { - pub fn new( - attributes: crate::datadogV2::model::UpdateAppResponseDataAttributes, - id: String, - type_: crate::datadogV2::model::UpdateAppResponseDataType, - ) -> UpdateAppResponseData { - UpdateAppResponseData { - attributes, - id, - type_, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl<'de> Deserialize<'de> for UpdateAppResponseData { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct UpdateAppResponseDataVisitor; - impl<'a> Visitor<'a> for UpdateAppResponseDataVisitor { - type Value = UpdateAppResponseData; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut attributes: Option< - crate::datadogV2::model::UpdateAppResponseDataAttributes, - > = None; - let mut id: Option = None; - let mut type_: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "attributes" => { - attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "id" => { - id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "type" => { - type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - if let Some(ref _type_) = type_ { - match _type_ { - crate::datadogV2::model::UpdateAppResponseDataType::UnparsedObject(_type_) => { - _unparsed = true; - }, - _ => {} - } - } - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; - let id = id.ok_or_else(|| M::Error::missing_field("id"))?; - let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; - - let content = UpdateAppResponseData { - attributes, - id, - type_, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(UpdateAppResponseDataVisitor) - } -} diff --git a/src/datadogV2/model/model_update_app_response_data_attributes.rs b/src/datadogV2/model/model_update_app_response_data_attributes.rs deleted file mode 100644 index 4e92f96bc..000000000 --- a/src/datadogV2/model/model_update_app_response_data_attributes.rs +++ /dev/null @@ -1,245 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `UpdateAppResponseDataAttributes` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct UpdateAppResponseDataAttributes { - /// The `attributes` `components`. - #[serde(rename = "components")] - pub components: Option>, - /// The `attributes` `description`. - #[serde(rename = "description")] - pub description: Option, - /// The `attributes` `embeddedQueries`. - #[serde(rename = "embeddedQueries")] - pub embedded_queries: Option>, - /// The `attributes` `favorite`. - #[serde(rename = "favorite")] - pub favorite: Option, - /// The definition of `InputSchema` object. - #[serde(rename = "inputSchema")] - pub input_schema: Option, - /// The `attributes` `name`. - #[serde(rename = "name")] - pub name: Option, - /// The `attributes` `rootInstanceName`. - #[serde(rename = "rootInstanceName")] - pub root_instance_name: Option, - /// The `attributes` `scripts`. - #[serde(rename = "scripts")] - pub scripts: Option>, - /// The `attributes` `tags`. - #[serde(rename = "tags")] - pub tags: Option>, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl UpdateAppResponseDataAttributes { - pub fn new() -> UpdateAppResponseDataAttributes { - UpdateAppResponseDataAttributes { - components: None, - description: None, - embedded_queries: None, - favorite: None, - input_schema: None, - name: None, - root_instance_name: None, - scripts: None, - tags: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn components(mut self, value: Vec) -> Self { - self.components = Some(value); - self - } - - pub fn description(mut self, value: String) -> Self { - self.description = Some(value); - self - } - - pub fn embedded_queries(mut self, value: Vec) -> Self { - self.embedded_queries = Some(value); - self - } - - pub fn favorite(mut self, value: bool) -> Self { - self.favorite = Some(value); - self - } - - pub fn input_schema(mut self, value: crate::datadogV2::model::InputSchema) -> Self { - self.input_schema = Some(value); - self - } - - pub fn name(mut self, value: String) -> Self { - self.name = Some(value); - self - } - - pub fn root_instance_name(mut self, value: String) -> Self { - self.root_instance_name = Some(value); - self - } - - pub fn scripts(mut self, value: Vec) -> Self { - self.scripts = Some(value); - self - } - - pub fn tags(mut self, value: Vec) -> Self { - self.tags = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for UpdateAppResponseDataAttributes { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for UpdateAppResponseDataAttributes { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct UpdateAppResponseDataAttributesVisitor; - impl<'a> Visitor<'a> for UpdateAppResponseDataAttributesVisitor { - type Value = UpdateAppResponseDataAttributes; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut components: Option> = None; - let mut description: Option = None; - let mut embedded_queries: Option> = None; - let mut favorite: Option = None; - let mut input_schema: Option = None; - let mut name: Option = None; - let mut root_instance_name: Option = None; - let mut scripts: Option> = None; - let mut tags: Option> = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "components" => { - if v.is_null() { - continue; - } - components = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "description" => { - if v.is_null() { - continue; - } - description = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "embeddedQueries" => { - if v.is_null() { - continue; - } - embedded_queries = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "favorite" => { - if v.is_null() { - continue; - } - favorite = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "inputSchema" => { - if v.is_null() { - continue; - } - input_schema = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "name" => { - if v.is_null() { - continue; - } - name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "rootInstanceName" => { - if v.is_null() { - continue; - } - root_instance_name = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "scripts" => { - if v.is_null() { - continue; - } - scripts = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "tags" => { - if v.is_null() { - continue; - } - tags = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = UpdateAppResponseDataAttributes { - components, - description, - embedded_queries, - favorite, - input_schema, - name, - root_instance_name, - scripts, - tags, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(UpdateAppResponseDataAttributesVisitor) - } -} diff --git a/src/datadogV2/model/model_update_app_response_data_type.rs b/src/datadogV2/model/model_update_app_response_data_type.rs deleted file mode 100644 index e4f6610d0..000000000 --- a/src/datadogV2/model/model_update_app_response_data_type.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -use serde::{Deserialize, Deserializer, Serialize, Serializer}; - -#[non_exhaustive] -#[derive(Clone, Debug, Eq, PartialEq)] -pub enum UpdateAppResponseDataType { - APPDEFINITIONS, - UnparsedObject(crate::datadog::UnparsedObject), -} - -impl ToString for UpdateAppResponseDataType { - fn to_string(&self) -> String { - match self { - Self::APPDEFINITIONS => String::from("appDefinitions"), - Self::UnparsedObject(v) => v.value.to_string(), - } - } -} - -impl Serialize for UpdateAppResponseDataType { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - match self { - Self::UnparsedObject(v) => v.serialize(serializer), - _ => serializer.serialize_str(self.to_string().as_str()), - } - } -} - -impl<'de> Deserialize<'de> for UpdateAppResponseDataType { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let s: String = String::deserialize(deserializer)?; - Ok(match s.as_str() { - "appDefinitions" => Self::APPDEFINITIONS, - _ => Self::UnparsedObject(crate::datadog::UnparsedObject { - value: serde_json::Value::String(s.into()), - }), - }) - } -} diff --git a/src/datadogV2/model/model_update_app_response_relationship.rs b/src/datadogV2/model/model_update_app_response_relationship.rs deleted file mode 100644 index 73cc2083c..000000000 --- a/src/datadogV2/model/model_update_app_response_relationship.rs +++ /dev/null @@ -1,123 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// The definition of `UpdateAppResponseRelationship` object. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct UpdateAppResponseRelationship { - /// The `relationship` `connections`. - #[serde(rename = "connections")] - pub connections: Option>, - /// The definition of `DeploymentRelationship` object. - #[serde(rename = "deployment")] - pub deployment: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl UpdateAppResponseRelationship { - pub fn new() -> UpdateAppResponseRelationship { - UpdateAppResponseRelationship { - connections: None, - deployment: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn connections(mut self, value: Vec) -> Self { - self.connections = Some(value); - self - } - - pub fn deployment(mut self, value: crate::datadogV2::model::DeploymentRelationship) -> Self { - self.deployment = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for UpdateAppResponseRelationship { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for UpdateAppResponseRelationship { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct UpdateAppResponseRelationshipVisitor; - impl<'a> Visitor<'a> for UpdateAppResponseRelationshipVisitor { - type Value = UpdateAppResponseRelationship; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut connections: Option> = None; - let mut deployment: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "connections" => { - if v.is_null() { - continue; - } - connections = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "deployment" => { - if v.is_null() { - continue; - } - deployment = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = UpdateAppResponseRelationship { - connections, - deployment, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(UpdateAppResponseRelationshipVisitor) - } -} diff --git a/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Bad-Request-response.frozen b/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Bad-Request-response.frozen deleted file mode 100644 index 70eab29e2..000000000 --- a/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Bad-Request-response.frozen +++ /dev/null @@ -1 +0,0 @@ -2024-12-10T19:57:35.320Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Bad-Request-response.json b/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Bad-Request-response.json deleted file mode 100644 index 3edd87946..000000000 --- a/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Bad-Request-response.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "http_interactions": [ - { - "request": { - "body": "", - "headers": { - "Accept": [ - "application/json" - ] - }, - "method": "post", - "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/invalid-uuid/deployment" - }, - "response": { - "body": { - "string": "{\"errors\":[{\"detail\":\"invalid path parameter\",\"source\":{\"parameter\":\"appId\"}}]}", - "encoding": null - }, - "headers": { - "Content-Type": [ - "application/vnd.api+json" - ] - }, - "status": { - "code": 400, - "message": "Bad Request" - } - }, - "recorded_at": "Tue, 10 Dec 2024 19:57:35 GMT" - } - ], - "recorded_with": "VCR 6.0.0" -} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Created-response.frozen b/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Created-response.frozen deleted file mode 100644 index 52661b934..000000000 --- a/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Created-response.frozen +++ /dev/null @@ -1 +0,0 @@ -2024-12-10T19:57:35.459Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Created-response.json b/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Created-response.json deleted file mode 100644 index c0667ee5c..000000000 --- a/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Created-response.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "http_interactions": [ - { - "request": { - "body": { - "string": "{\"data\":{\"attributes\":{\"components\":[{\"events\":[],\"name\":\"grid0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"gridCell0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"calloutValue0\",\"properties\":{\"isDisabled\":false,\"isLoading\":false,\"isVisible\":true,\"label\":\"CPU Usage\",\"size\":\"sm\",\"style\":\"vivid_yellow\",\"unit\":\"kB\",\"value\":\"42\"},\"type\":\"calloutValue\"}],\"isVisible\":\"true\",\"layout\":{\"default\":{\"height\":8,\"width\":2,\"x\":0,\"y\":0}}},\"type\":\"gridCell\"}]},\"type\":\"grid\"}],\"description\":\"This is a simple example app\",\"embeddedQueries\":[],\"name\":\"Example App\",\"rootInstanceName\":\"grid0\"},\"type\":\"appDefinitions\"}}", - "encoding": null - }, - "headers": { - "Accept": [ - "application/json" - ], - "Content-Type": [ - "application/json" - ] - }, - "method": "post", - "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" - }, - "response": { - "body": { - "string": "{\"data\":{\"id\":\"f40f3df0-f9e5-46e9-87e4-aba789548b0b\",\"type\":\"appDefinitions\"}}", - "encoding": null - }, - "headers": { - "Content-Type": [ - "application/vnd.api+json" - ] - }, - "status": { - "code": 201, - "message": "Created" - } - }, - "recorded_at": "Tue, 10 Dec 2024 19:57:35 GMT" - }, - { - "request": { - "body": "", - "headers": { - "Accept": [ - "application/json" - ] - }, - "method": "post", - "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/f40f3df0-f9e5-46e9-87e4-aba789548b0b/deployment" - }, - "response": { - "body": { - "string": "{\"data\":{\"id\":\"21151cad-2a7c-4b14-b151-ed45916e0ee2\",\"type\":\"deployment\",\"attributes\":{\"app_version_id\":\"d5f91141-ac8f-4da5-a27f-33f1c7f4042f\"},\"meta\":{\"created_at\":\"2024-12-10T19:57:35.83889Z\",\"user_id\":15479137,\"user_uuid\":\"b3f98453-b289-11ef-a4e9-d6d283f92d91\",\"user_name\":\"oliver.li@datadoghq.com\"}}}", - "encoding": null - }, - "headers": { - "Content-Type": [ - "application/vnd.api+json" - ] - }, - "status": { - "code": 201, - "message": "Created" - } - }, - "recorded_at": "Tue, 10 Dec 2024 19:57:35 GMT" - }, - { - "request": { - "body": "", - "headers": { - "Accept": [ - "application/json" - ] - }, - "method": "delete", - "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/f40f3df0-f9e5-46e9-87e4-aba789548b0b" - }, - "response": { - "body": { - "string": "{\"data\":{\"id\":\"f40f3df0-f9e5-46e9-87e4-aba789548b0b\",\"type\":\"appDefinitions\"}}", - "encoding": null - }, - "headers": { - "Content-Type": [ - "application/vnd.api+json" - ] - }, - "status": { - "code": 200, - "message": "OK" - } - }, - "recorded_at": "Tue, 10 Dec 2024 19:57:35 GMT" - } - ], - "recorded_with": "VCR 6.0.0" -} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Not-Found-response.frozen b/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Not-Found-response.frozen deleted file mode 100644 index c11fe09d7..000000000 --- a/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Not-Found-response.frozen +++ /dev/null @@ -1 +0,0 @@ -2024-12-10T19:57:35.984Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Not-Found-response.json b/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Not-Found-response.json deleted file mode 100644 index 973dda706..000000000 --- a/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Not-Found-response.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "http_interactions": [ - { - "request": { - "body": "", - "headers": { - "Accept": [ - "application/json" - ] - }, - "method": "post", - "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/7addb29b-f935-472c-ae79-d1963979a23e/deployment" - }, - "response": { - "body": { - "string": "{\"errors\":[{\"detail\":\"app not found\"}]}", - "encoding": null - }, - "headers": { - "Content-Type": [ - "application/vnd.api+json" - ] - }, - "status": { - "code": 404, - "message": "Not Found" - } - }, - "recorded_at": "Tue, 10 Dec 2024 19:57:35 GMT" - } - ], - "recorded_with": "VCR 6.0.0" -} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Bad-Request-response.frozen b/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Bad-Request-response.frozen deleted file mode 100644 index bf3af7629..000000000 --- a/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Bad-Request-response.frozen +++ /dev/null @@ -1 +0,0 @@ -2024-12-10T19:57:36.091Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Bad-Request-response.json b/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Bad-Request-response.json deleted file mode 100644 index bcf179101..000000000 --- a/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Bad-Request-response.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "http_interactions": [ - { - "request": { - "body": "", - "headers": { - "Accept": [ - "application/json" - ] - }, - "method": "delete", - "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/invalid-uuid/deployment" - }, - "response": { - "body": { - "string": "{\"errors\":[{\"detail\":\"invalid path parameter\",\"source\":{\"parameter\":\"appId\"}}]}", - "encoding": null - }, - "headers": { - "Content-Type": [ - "application/vnd.api+json" - ] - }, - "status": { - "code": 400, - "message": "Bad Request" - } - }, - "recorded_at": "Tue, 10 Dec 2024 19:57:36 GMT" - } - ], - "recorded_with": "VCR 6.0.0" -} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Not-Found-response.frozen b/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Not-Found-response.frozen deleted file mode 100644 index 8dc6b57d7..000000000 --- a/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Not-Found-response.frozen +++ /dev/null @@ -1 +0,0 @@ -2024-12-10T19:57:36.179Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Not-Found-response.json b/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Not-Found-response.json deleted file mode 100644 index 9f596d72c..000000000 --- a/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Not-Found-response.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "http_interactions": [ - { - "request": { - "body": "", - "headers": { - "Accept": [ - "application/json" - ] - }, - "method": "delete", - "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/7addb29b-f935-472c-ae79-d1963979a23e/deployment" - }, - "response": { - "body": { - "string": "{\"errors\":[{\"detail\":\"app not found\"}]}", - "encoding": null - }, - "headers": { - "Content-Type": [ - "application/vnd.api+json" - ] - }, - "status": { - "code": 404, - "message": "Not Found" - } - }, - "recorded_at": "Tue, 10 Dec 2024 19:57:36 GMT" - } - ], - "recorded_with": "VCR 6.0.0" -} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-OK-response.frozen deleted file mode 100644 index 433052b1a..000000000 --- a/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-OK-response.frozen +++ /dev/null @@ -1 +0,0 @@ -2024-12-10T19:57:36.281Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-OK-response.json b/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-OK-response.json deleted file mode 100644 index 80669c138..000000000 --- a/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-OK-response.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "http_interactions": [ - { - "request": { - "body": { - "string": "{\"data\":{\"attributes\":{\"components\":[{\"events\":[],\"name\":\"grid0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"gridCell0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"calloutValue0\",\"properties\":{\"isDisabled\":false,\"isLoading\":false,\"isVisible\":true,\"label\":\"CPU Usage\",\"size\":\"sm\",\"style\":\"vivid_yellow\",\"unit\":\"kB\",\"value\":\"42\"},\"type\":\"calloutValue\"}],\"isVisible\":\"true\",\"layout\":{\"default\":{\"height\":8,\"width\":2,\"x\":0,\"y\":0}}},\"type\":\"gridCell\"}]},\"type\":\"grid\"}],\"description\":\"This is a simple example app\",\"embeddedQueries\":[],\"name\":\"Example App\",\"rootInstanceName\":\"grid0\"},\"type\":\"appDefinitions\"}}", - "encoding": null - }, - "headers": { - "Accept": [ - "application/json" - ], - "Content-Type": [ - "application/json" - ] - }, - "method": "post", - "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" - }, - "response": { - "body": { - "string": "{\"data\":{\"id\":\"10fe8156-fe6b-4dbd-b0b6-8dc08e072b1d\",\"type\":\"appDefinitions\"}}", - "encoding": null - }, - "headers": { - "Content-Type": [ - "application/vnd.api+json" - ] - }, - "status": { - "code": 201, - "message": "Created" - } - }, - "recorded_at": "Tue, 10 Dec 2024 19:57:36 GMT" - }, - { - "request": { - "body": "", - "headers": { - "Accept": [ - "application/json" - ] - }, - "method": "delete", - "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/10fe8156-fe6b-4dbd-b0b6-8dc08e072b1d/deployment" - }, - "response": { - "body": { - "string": "{\"data\":{\"id\":\"1d3fc23b-d099-4646-b5bd-2c8e419f82aa\",\"type\":\"deployment\",\"attributes\":{\"app_version_id\":\"00000000-0000-0000-0000-000000000000\"},\"meta\":{\"created_at\":\"2024-12-10T19:57:36.674239Z\",\"user_id\":15479137,\"user_uuid\":\"b3f98453-b289-11ef-a4e9-d6d283f92d91\",\"user_name\":\"oliver.li@datadoghq.com\"}}}", - "encoding": null - }, - "headers": { - "Content-Type": [ - "application/vnd.api+json" - ] - }, - "status": { - "code": 200, - "message": "OK" - } - }, - "recorded_at": "Tue, 10 Dec 2024 19:57:36 GMT" - }, - { - "request": { - "body": "", - "headers": { - "Accept": [ - "application/json" - ] - }, - "method": "delete", - "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/10fe8156-fe6b-4dbd-b0b6-8dc08e072b1d" - }, - "response": { - "body": { - "string": "{\"data\":{\"id\":\"10fe8156-fe6b-4dbd-b0b6-8dc08e072b1d\",\"type\":\"appDefinitions\"}}", - "encoding": null - }, - "headers": { - "Content-Type": [ - "application/vnd.api+json" - ] - }, - "status": { - "code": 200, - "message": "OK" - } - }, - "recorded_at": "Tue, 10 Dec 2024 19:57:36 GMT" - } - ], - "recorded_with": "VCR 6.0.0" -} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Create-App-returns-App-Created-response.frozen b/tests/scenarios/cassettes/v2/apps/Create-App-returns-App-Created-response.frozen deleted file mode 100644 index e9cd9f816..000000000 --- a/tests/scenarios/cassettes/v2/apps/Create-App-returns-App-Created-response.frozen +++ /dev/null @@ -1 +0,0 @@ -2024-12-10T19:57:09.544Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Create-App-returns-App-Created-response.json b/tests/scenarios/cassettes/v2/apps/Create-App-returns-App-Created-response.json deleted file mode 100644 index 2f3b5c9ff..000000000 --- a/tests/scenarios/cassettes/v2/apps/Create-App-returns-App-Created-response.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "http_interactions": [ - { - "request": { - "body": { - "string": "{\"data\":{\"attributes\":{\"components\":[{\"events\":[],\"name\":\"grid0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"gridCell0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"calloutValue0\",\"properties\":{\"isDisabled\":false,\"isLoading\":false,\"isVisible\":true,\"label\":\"CPU Usage\",\"size\":\"sm\",\"style\":\"vivid_yellow\",\"unit\":\"kB\",\"value\":\"42\"},\"type\":\"calloutValue\"}],\"isVisible\":\"true\",\"layout\":{\"default\":{\"height\":8,\"width\":2,\"x\":0,\"y\":0}}},\"type\":\"gridCell\"}]},\"type\":\"grid\"}],\"description\":\"This is a simple example app\",\"embeddedQueries\":[],\"name\":\"Example App\",\"rootInstanceName\":\"grid0\"},\"type\":\"appDefinitions\"}}", - "encoding": null - }, - "headers": { - "Accept": [ - "application/json" - ], - "Content-Type": [ - "application/json" - ] - }, - "method": "post", - "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" - }, - "response": { - "body": { - "string": "{\"data\":{\"id\":\"7189aab4-a57b-4709-95b2-e5d8dd9937df\",\"type\":\"appDefinitions\"}}", - "encoding": null - }, - "headers": { - "Content-Type": [ - "application/vnd.api+json" - ] - }, - "status": { - "code": 201, - "message": "Created" - } - }, - "recorded_at": "Tue, 10 Dec 2024 19:57:09 GMT" - }, - { - "request": { - "body": "", - "headers": { - "Accept": [ - "application/json" - ] - }, - "method": "delete", - "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/7189aab4-a57b-4709-95b2-e5d8dd9937df" - }, - "response": { - "body": { - "string": "{\"data\":{\"id\":\"7189aab4-a57b-4709-95b2-e5d8dd9937df\",\"type\":\"appDefinitions\"}}", - "encoding": null - }, - "headers": { - "Content-Type": [ - "application/vnd.api+json" - ] - }, - "status": { - "code": 200, - "message": "OK" - } - }, - "recorded_at": "Tue, 10 Dec 2024 19:57:09 GMT" - } - ], - "recorded_with": "VCR 6.0.0" -} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Create-App-returns-Bad-Request-response.frozen b/tests/scenarios/cassettes/v2/apps/Create-App-returns-Bad-Request-response.frozen deleted file mode 100644 index 5912dc344..000000000 --- a/tests/scenarios/cassettes/v2/apps/Create-App-returns-Bad-Request-response.frozen +++ /dev/null @@ -1 +0,0 @@ -2024-12-10T19:57:10.031Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Create-App-returns-Bad-Request-response.json b/tests/scenarios/cassettes/v2/apps/Create-App-returns-Bad-Request-response.json deleted file mode 100644 index e834634c8..000000000 --- a/tests/scenarios/cassettes/v2/apps/Create-App-returns-Bad-Request-response.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "http_interactions": [ - { - "request": { - "body": { - "string": "{\"data\":{\"attributes\":{\"description\":\"This is a bad example app\",\"embeddedQueries\":[],\"rootInstanceName\":\"grid0\"},\"type\":\"appDefinitions\"}}", - "encoding": null - }, - "headers": { - "Accept": [ - "application/json" - ], - "Content-Type": [ - "application/json" - ] - }, - "method": "post", - "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" - }, - "response": { - "body": { - "string": "{\"errors\":[{\"detail\":\"missing required field\",\"source\":{\"pointer\":\"/data/attributes/name\"}}]}", - "encoding": null - }, - "headers": { - "Content-Type": [ - "application/vnd.api+json" - ] - }, - "status": { - "code": 400, - "message": "Bad Request" - } - }, - "recorded_at": "Tue, 10 Dec 2024 19:57:10 GMT" - } - ], - "recorded_with": "VCR 6.0.0" -} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Delete-App-returns-Bad-Request-response.frozen b/tests/scenarios/cassettes/v2/apps/Delete-App-returns-Bad-Request-response.frozen deleted file mode 100644 index 3925b1b25..000000000 --- a/tests/scenarios/cassettes/v2/apps/Delete-App-returns-Bad-Request-response.frozen +++ /dev/null @@ -1 +0,0 @@ -2024-12-10T19:57:10.128Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Delete-App-returns-Bad-Request-response.json b/tests/scenarios/cassettes/v2/apps/Delete-App-returns-Bad-Request-response.json deleted file mode 100644 index b94026f89..000000000 --- a/tests/scenarios/cassettes/v2/apps/Delete-App-returns-Bad-Request-response.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "http_interactions": [ - { - "request": { - "body": "", - "headers": { - "Accept": [ - "application/json" - ] - }, - "method": "delete", - "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/bad-app-id" - }, - "response": { - "body": { - "string": "{\"errors\":[{\"detail\":\"invalid path parameter\",\"source\":{\"parameter\":\"appId\"}}]}", - "encoding": null - }, - "headers": { - "Content-Type": [ - "application/vnd.api+json" - ] - }, - "status": { - "code": 400, - "message": "Bad Request" - } - }, - "recorded_at": "Tue, 10 Dec 2024 19:57:10 GMT" - } - ], - "recorded_with": "VCR 6.0.0" -} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Delete-App-returns-Not-Found-response.frozen b/tests/scenarios/cassettes/v2/apps/Delete-App-returns-Not-Found-response.frozen deleted file mode 100644 index cfa34bd9b..000000000 --- a/tests/scenarios/cassettes/v2/apps/Delete-App-returns-Not-Found-response.frozen +++ /dev/null @@ -1 +0,0 @@ -2024-12-10T19:57:10.225Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Delete-App-returns-Not-Found-response.json b/tests/scenarios/cassettes/v2/apps/Delete-App-returns-Not-Found-response.json deleted file mode 100644 index 1fa48dc29..000000000 --- a/tests/scenarios/cassettes/v2/apps/Delete-App-returns-Not-Found-response.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "http_interactions": [ - { - "request": { - "body": "", - "headers": { - "Accept": [ - "application/json" - ] - }, - "method": "delete", - "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/7addb29b-f935-472c-ae79-d1963979a23e" - }, - "response": { - "body": { - "string": "{\"errors\":[{\"detail\":\"app not found\"}]}", - "encoding": null - }, - "headers": { - "Content-Type": [ - "application/vnd.api+json" - ] - }, - "status": { - "code": 404, - "message": "Not Found" - } - }, - "recorded_at": "Tue, 10 Dec 2024 19:57:10 GMT" - } - ], - "recorded_with": "VCR 6.0.0" -} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Delete-App-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/apps/Delete-App-returns-OK-response.frozen deleted file mode 100644 index 1e1440d65..000000000 --- a/tests/scenarios/cassettes/v2/apps/Delete-App-returns-OK-response.frozen +++ /dev/null @@ -1 +0,0 @@ -2024-12-10T19:57:10.331Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Delete-App-returns-OK-response.json b/tests/scenarios/cassettes/v2/apps/Delete-App-returns-OK-response.json deleted file mode 100644 index 7ccbbe915..000000000 --- a/tests/scenarios/cassettes/v2/apps/Delete-App-returns-OK-response.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "http_interactions": [ - { - "request": { - "body": { - "string": "{\"data\":{\"attributes\":{\"components\":[{\"events\":[],\"name\":\"grid0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"gridCell0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"calloutValue0\",\"properties\":{\"isDisabled\":false,\"isLoading\":false,\"isVisible\":true,\"label\":\"CPU Usage\",\"size\":\"sm\",\"style\":\"vivid_yellow\",\"unit\":\"kB\",\"value\":\"42\"},\"type\":\"calloutValue\"}],\"isVisible\":\"true\",\"layout\":{\"default\":{\"height\":8,\"width\":2,\"x\":0,\"y\":0}}},\"type\":\"gridCell\"}]},\"type\":\"grid\"}],\"description\":\"This is a simple example app\",\"embeddedQueries\":[],\"name\":\"Example App\",\"rootInstanceName\":\"grid0\"},\"type\":\"appDefinitions\"}}", - "encoding": null - }, - "headers": { - "Accept": [ - "application/json" - ], - "Content-Type": [ - "application/json" - ] - }, - "method": "post", - "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" - }, - "response": { - "body": { - "string": "{\"data\":{\"id\":\"31966edc-cbbc-4f12-91c1-c179a1d6f7bd\",\"type\":\"appDefinitions\"}}", - "encoding": null - }, - "headers": { - "Content-Type": [ - "application/vnd.api+json" - ] - }, - "status": { - "code": 201, - "message": "Created" - } - }, - "recorded_at": "Tue, 10 Dec 2024 19:57:10 GMT" - }, - { - "request": { - "body": "", - "headers": { - "Accept": [ - "application/json" - ] - }, - "method": "delete", - "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/31966edc-cbbc-4f12-91c1-c179a1d6f7bd" - }, - "response": { - "body": { - "string": "{\"data\":{\"id\":\"31966edc-cbbc-4f12-91c1-c179a1d6f7bd\",\"type\":\"appDefinitions\"}}", - "encoding": null - }, - "headers": { - "Content-Type": [ - "application/vnd.api+json" - ] - }, - "status": { - "code": 200, - "message": "OK" - } - }, - "recorded_at": "Tue, 10 Dec 2024 19:57:10 GMT" - }, - { - "request": { - "body": "", - "headers": { - "Accept": [ - "application/json" - ] - }, - "method": "delete", - "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/31966edc-cbbc-4f12-91c1-c179a1d6f7bd" - }, - "response": { - "body": { - "string": "{\"errors\":[{\"detail\":\"app not found\"}]}", - "encoding": null - }, - "headers": { - "Content-Type": [ - "application/vnd.api+json" - ] - }, - "status": { - "code": 404, - "message": "Not Found" - } - }, - "recorded_at": "Tue, 10 Dec 2024 19:57:10 GMT" - } - ], - "recorded_with": "VCR 6.0.0" -} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Bad-Request-response.frozen b/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Bad-Request-response.frozen deleted file mode 100644 index 47c84b21b..000000000 --- a/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Bad-Request-response.frozen +++ /dev/null @@ -1 +0,0 @@ -2024-12-10T19:57:10.845Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Bad-Request-response.json b/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Bad-Request-response.json deleted file mode 100644 index f92a0f7b4..000000000 --- a/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Bad-Request-response.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "http_interactions": [ - { - "request": { - "body": { - "string": "{\"data\":[{\"id\":\"71c0d358-eac5-41e3-892d-a7467571b9b\",\"type\":\"appDefinitions\"},{\"id\":\"71c0d358-eac5-41e3-892d-a7467571b9b0\",\"type\":\"appDefinitions\"},{\"id\":\"98e7e44d-1562-474a-90f7-3a94e739c006\",\"type\":\"appDefinitions\"}]}", - "encoding": null - }, - "headers": { - "Accept": [ - "application/json" - ], - "Content-Type": [ - "application/json" - ] - }, - "method": "delete", - "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" - }, - "response": { - "body": { - "string": "{\"errors\":[{\"status\":\"400\",\"title\":\"Bad Request\",\"detail\":\"invalid UUID length: 35\"}]}", - "encoding": null - }, - "headers": { - "Content-Type": [ - "application/vnd.api+json" - ] - }, - "status": { - "code": 400, - "message": "Bad Request" - } - }, - "recorded_at": "Tue, 10 Dec 2024 19:57:10 GMT" - } - ], - "recorded_with": "VCR 6.0.0" -} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Not-Found-response.frozen b/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Not-Found-response.frozen deleted file mode 100644 index 0fbfbe769..000000000 --- a/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Not-Found-response.frozen +++ /dev/null @@ -1 +0,0 @@ -2024-12-10T19:57:10.942Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Not-Found-response.json b/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Not-Found-response.json deleted file mode 100644 index 0264cf115..000000000 --- a/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Not-Found-response.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "http_interactions": [ - { - "request": { - "body": { - "string": "{\"data\":[{\"id\":\"29494ddd-ac13-46a7-8558-b05b050ee755\",\"type\":\"appDefinitions\"},{\"id\":\"71c0d358-eac5-41e3-892d-a7467571b9b0\",\"type\":\"appDefinitions\"},{\"id\":\"98e7e44d-1562-474a-90f7-3a94e739c006\",\"type\":\"appDefinitions\"}]}", - "encoding": null - }, - "headers": { - "Accept": [ - "application/json" - ], - "Content-Type": [ - "application/json" - ] - }, - "method": "delete", - "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" - }, - "response": { - "body": { - "string": "{\"errors\":[{\"detail\":\"one or more apps not found\"}]}", - "encoding": null - }, - "headers": { - "Content-Type": [ - "application/vnd.api+json" - ] - }, - "status": { - "code": 404, - "message": "Not Found" - } - }, - "recorded_at": "Tue, 10 Dec 2024 19:57:10 GMT" - } - ], - "recorded_with": "VCR 6.0.0" -} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-OK-response.frozen deleted file mode 100644 index d002ad3b4..000000000 --- a/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-OK-response.frozen +++ /dev/null @@ -1 +0,0 @@ -2024-12-10T19:57:11.041Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-OK-response.json b/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-OK-response.json deleted file mode 100644 index ad3f10729..000000000 --- a/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-OK-response.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "http_interactions": [ - { - "request": { - "body": { - "string": "{\"data\":{\"attributes\":{\"components\":[{\"events\":[],\"name\":\"grid0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"gridCell0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"calloutValue0\",\"properties\":{\"isDisabled\":false,\"isLoading\":false,\"isVisible\":true,\"label\":\"CPU Usage\",\"size\":\"sm\",\"style\":\"vivid_yellow\",\"unit\":\"kB\",\"value\":\"42\"},\"type\":\"calloutValue\"}],\"isVisible\":\"true\",\"layout\":{\"default\":{\"height\":8,\"width\":2,\"x\":0,\"y\":0}}},\"type\":\"gridCell\"}]},\"type\":\"grid\"}],\"description\":\"This is a simple example app\",\"embeddedQueries\":[],\"name\":\"Example App\",\"rootInstanceName\":\"grid0\"},\"type\":\"appDefinitions\"}}", - "encoding": null - }, - "headers": { - "Accept": [ - "application/json" - ], - "Content-Type": [ - "application/json" - ] - }, - "method": "post", - "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" - }, - "response": { - "body": { - "string": "{\"data\":{\"id\":\"c582f723-26c4-4b98-9a4e-cb14e756450e\",\"type\":\"appDefinitions\"}}", - "encoding": null - }, - "headers": { - "Content-Type": [ - "application/vnd.api+json" - ] - }, - "status": { - "code": 201, - "message": "Created" - } - }, - "recorded_at": "Tue, 10 Dec 2024 19:57:11 GMT" - }, - { - "request": { - "body": { - "string": "{\"data\":[{\"id\":\"c582f723-26c4-4b98-9a4e-cb14e756450e\",\"type\":\"appDefinitions\"}]}", - "encoding": null - }, - "headers": { - "Accept": [ - "application/json" - ], - "Content-Type": [ - "application/json" - ] - }, - "method": "delete", - "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" - }, - "response": { - "body": { - "string": "{\"data\":[{\"id\":\"c582f723-26c4-4b98-9a4e-cb14e756450e\",\"type\":\"appDefinitions\"}]}", - "encoding": null - }, - "headers": { - "Content-Type": [ - "application/vnd.api+json" - ] - }, - "status": { - "code": 200, - "message": "OK" - } - }, - "recorded_at": "Tue, 10 Dec 2024 19:57:11 GMT" - }, - { - "request": { - "body": "", - "headers": { - "Accept": [ - "application/json" - ] - }, - "method": "delete", - "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/c582f723-26c4-4b98-9a4e-cb14e756450e" - }, - "response": { - "body": { - "string": "{\"errors\":[{\"detail\":\"app not found\"}]}", - "encoding": null - }, - "headers": { - "Content-Type": [ - "application/vnd.api+json" - ] - }, - "status": { - "code": 404, - "message": "Not Found" - } - }, - "recorded_at": "Tue, 10 Dec 2024 19:57:11 GMT" - } - ], - "recorded_with": "VCR 6.0.0" -} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Get-App-returns-Bad-Request-response.frozen b/tests/scenarios/cassettes/v2/apps/Get-App-returns-Bad-Request-response.frozen deleted file mode 100644 index 9a1b4493f..000000000 --- a/tests/scenarios/cassettes/v2/apps/Get-App-returns-Bad-Request-response.frozen +++ /dev/null @@ -1 +0,0 @@ -2024-12-10T19:57:11.519Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Get-App-returns-Bad-Request-response.json b/tests/scenarios/cassettes/v2/apps/Get-App-returns-Bad-Request-response.json deleted file mode 100644 index 4d47e8159..000000000 --- a/tests/scenarios/cassettes/v2/apps/Get-App-returns-Bad-Request-response.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "http_interactions": [ - { - "request": { - "body": "", - "headers": { - "Accept": [ - "application/json" - ] - }, - "method": "get", - "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/invalid-uuid" - }, - "response": { - "body": { - "string": "{\"errors\":[{\"detail\":\"invalid path parameter\",\"source\":{\"parameter\":\"appId\"}}]}", - "encoding": null - }, - "headers": { - "Content-Type": [ - "application/vnd.api+json" - ] - }, - "status": { - "code": 400, - "message": "Bad Request" - } - }, - "recorded_at": "Tue, 10 Dec 2024 19:57:11 GMT" - } - ], - "recorded_with": "VCR 6.0.0" -} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Get-App-returns-Not-Found-response.frozen b/tests/scenarios/cassettes/v2/apps/Get-App-returns-Not-Found-response.frozen deleted file mode 100644 index 0d42c7607..000000000 --- a/tests/scenarios/cassettes/v2/apps/Get-App-returns-Not-Found-response.frozen +++ /dev/null @@ -1 +0,0 @@ -2024-12-10T19:57:11.612Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Get-App-returns-Not-Found-response.json b/tests/scenarios/cassettes/v2/apps/Get-App-returns-Not-Found-response.json deleted file mode 100644 index a83cb8847..000000000 --- a/tests/scenarios/cassettes/v2/apps/Get-App-returns-Not-Found-response.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "http_interactions": [ - { - "request": { - "body": "", - "headers": { - "Accept": [ - "application/json" - ] - }, - "method": "get", - "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/7addb29b-f935-472c-ae79-d1963979a23e" - }, - "response": { - "body": { - "string": "{\"errors\":[{\"detail\":\"app not found\"}]}", - "encoding": null - }, - "headers": { - "Content-Type": [ - "application/vnd.api+json" - ] - }, - "status": { - "code": 404, - "message": "Not Found" - } - }, - "recorded_at": "Tue, 10 Dec 2024 19:57:11 GMT" - } - ], - "recorded_with": "VCR 6.0.0" -} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Get-App-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/apps/Get-App-returns-OK-response.frozen deleted file mode 100644 index 285af0bd6..000000000 --- a/tests/scenarios/cassettes/v2/apps/Get-App-returns-OK-response.frozen +++ /dev/null @@ -1 +0,0 @@ -2024-12-10T19:57:11.740Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Get-App-returns-OK-response.json b/tests/scenarios/cassettes/v2/apps/Get-App-returns-OK-response.json deleted file mode 100644 index 368071ef7..000000000 --- a/tests/scenarios/cassettes/v2/apps/Get-App-returns-OK-response.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "http_interactions": [ - { - "request": { - "body": { - "string": "{\"data\":{\"attributes\":{\"components\":[{\"events\":[],\"name\":\"grid0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"gridCell0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"calloutValue0\",\"properties\":{\"isDisabled\":false,\"isLoading\":false,\"isVisible\":true,\"label\":\"CPU Usage\",\"size\":\"sm\",\"style\":\"vivid_yellow\",\"unit\":\"kB\",\"value\":\"42\"},\"type\":\"calloutValue\"}],\"isVisible\":\"true\",\"layout\":{\"default\":{\"height\":8,\"width\":2,\"x\":0,\"y\":0}}},\"type\":\"gridCell\"}]},\"type\":\"grid\"}],\"description\":\"This is a simple example app\",\"embeddedQueries\":[],\"name\":\"Example App\",\"rootInstanceName\":\"grid0\"},\"type\":\"appDefinitions\"}}", - "encoding": null - }, - "headers": { - "Accept": [ - "application/json" - ], - "Content-Type": [ - "application/json" - ] - }, - "method": "post", - "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" - }, - "response": { - "body": { - "string": "{\"data\":{\"id\":\"810bb071-15a9-40bd-a7ff-d3811f171610\",\"type\":\"appDefinitions\"}}", - "encoding": null - }, - "headers": { - "Content-Type": [ - "application/vnd.api+json" - ] - }, - "status": { - "code": 201, - "message": "Created" - } - }, - "recorded_at": "Tue, 10 Dec 2024 19:57:11 GMT" - }, - { - "request": { - "body": "", - "headers": { - "Accept": [ - "application/json" - ] - }, - "method": "get", - "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/810bb071-15a9-40bd-a7ff-d3811f171610" - }, - "response": { - "body": { - "string": "{\"data\":{\"id\":\"810bb071-15a9-40bd-a7ff-d3811f171610\",\"type\":\"appDefinitions\",\"attributes\":{\"components\":[{\"events\":[],\"name\":\"grid0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"gridCell0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"calloutValue0\",\"properties\":{\"isDisabled\":false,\"isLoading\":false,\"isVisible\":true,\"label\":\"CPU Usage\",\"size\":\"sm\",\"style\":\"vivid_yellow\",\"unit\":\"kB\",\"value\":\"42\"},\"type\":\"calloutValue\"}],\"isVisible\":\"true\",\"layout\":{\"default\":{\"height\":8,\"width\":2,\"x\":0,\"y\":0}}},\"type\":\"gridCell\"}]},\"type\":\"grid\"}],\"description\":\"This is a simple example app\",\"embeddedQueries\":[],\"favorite\":false,\"name\":\"Example App\",\"rootInstanceName\":\"grid0\",\"selfService\":false,\"tags\":[]},\"meta\":{\"org_id\":1107852,\"user_id\":15479137,\"user_uuid\":\"b3f98453-b289-11ef-a4e9-d6d283f92d91\",\"user_name\":\"oliver.li@datadoghq.com\",\"version\":1,\"updated_since_deployment\":false,\"created_at\":\"2024-12-10T19:57:11.9304Z\",\"updated_at\":\"2024-12-10T19:57:11.9304Z\",\"deleted_at\":\"0001-01-01T00:00:00Z\"}}}", - "encoding": null - }, - "headers": { - "Content-Type": [ - "application/vnd.api+json" - ] - }, - "status": { - "code": 200, - "message": "OK" - } - }, - "recorded_at": "Tue, 10 Dec 2024 19:57:11 GMT" - }, - { - "request": { - "body": "", - "headers": { - "Accept": [ - "application/json" - ] - }, - "method": "delete", - "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/810bb071-15a9-40bd-a7ff-d3811f171610" - }, - "response": { - "body": { - "string": "{\"data\":{\"id\":\"810bb071-15a9-40bd-a7ff-d3811f171610\",\"type\":\"appDefinitions\"}}", - "encoding": null - }, - "headers": { - "Content-Type": [ - "application/vnd.api+json" - ] - }, - "status": { - "code": 200, - "message": "OK" - } - }, - "recorded_at": "Tue, 10 Dec 2024 19:57:11 GMT" - } - ], - "recorded_with": "VCR 6.0.0" -} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/List-Apps-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/apps/List-Apps-returns-OK-response.frozen deleted file mode 100644 index 1cb2468dc..000000000 --- a/tests/scenarios/cassettes/v2/apps/List-Apps-returns-OK-response.frozen +++ /dev/null @@ -1 +0,0 @@ -2024-12-10T19:57:12.227Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/List-Apps-returns-OK-response.json b/tests/scenarios/cassettes/v2/apps/List-Apps-returns-OK-response.json deleted file mode 100644 index ec7b8dc71..000000000 --- a/tests/scenarios/cassettes/v2/apps/List-Apps-returns-OK-response.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "http_interactions": [ - { - "request": { - "body": "", - "headers": { - "Accept": [ - "application/json" - ] - }, - "method": "get", - "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" - }, - "response": { - "body": { - "string": "{\"data\":[{\"id\":\"d595693a-473d-4671-9da3-fce89e3a5c5d\",\"type\":\"appDefinitions\",\"attributes\":{\"description\":\"\",\"favorite\":false,\"name\":\"Max's App Fri, Jul 12, 11:10:35 am\",\"selfService\":false,\"tags\":[]},\"meta\":{\"org_id\":1107852,\"user_id\":7571362,\"user_uuid\":\"3114f3a0-3fc9-11ef-acbe-a6def6551924\",\"user_name\":\"max.gale@datadoghq.com\",\"version\":0,\"updated_since_deployment\":false,\"created_at\":\"2024-07-12T15:10:48.690305Z\",\"updated_at\":\"2024-07-12T15:10:48.690305Z\",\"deleted_at\":\"0001-01-01T00:00:00Z\"}}],\"meta\":{\"page\":{\"totalCount\":1,\"totalFilteredCount\":1}}}", - "encoding": null - }, - "headers": { - "Content-Type": [ - "application/vnd.api+json" - ] - }, - "status": { - "code": 200, - "message": "OK" - } - }, - "recorded_at": "Tue, 10 Dec 2024 19:57:12 GMT" - } - ], - "recorded_with": "VCR 6.0.0" -} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Update-App-returns-Bad-Request-response.frozen b/tests/scenarios/cassettes/v2/apps/Update-App-returns-Bad-Request-response.frozen deleted file mode 100644 index 8ec69a42f..000000000 --- a/tests/scenarios/cassettes/v2/apps/Update-App-returns-Bad-Request-response.frozen +++ /dev/null @@ -1 +0,0 @@ -2024-12-10T19:57:12.347Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Update-App-returns-Bad-Request-response.json b/tests/scenarios/cassettes/v2/apps/Update-App-returns-Bad-Request-response.json deleted file mode 100644 index 05c50e2e8..000000000 --- a/tests/scenarios/cassettes/v2/apps/Update-App-returns-Bad-Request-response.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "http_interactions": [ - { - "request": { - "body": { - "string": "{\"data\":{\"attributes\":{\"components\":[{\"events\":[],\"name\":\"grid0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"gridCell0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"calloutValue0\",\"properties\":{\"isDisabled\":false,\"isLoading\":false,\"isVisible\":true,\"label\":\"CPU Usage\",\"size\":\"sm\",\"style\":\"vivid_yellow\",\"unit\":\"kB\",\"value\":\"42\"},\"type\":\"calloutValue\"}],\"isVisible\":\"true\",\"layout\":{\"default\":{\"height\":8,\"width\":2,\"x\":0,\"y\":0}}},\"type\":\"gridCell\"}]},\"type\":\"grid\"}],\"description\":\"This is a simple example app\",\"embeddedQueries\":[],\"name\":\"Example App\",\"rootInstanceName\":\"grid0\"},\"type\":\"appDefinitions\"}}", - "encoding": null - }, - "headers": { - "Accept": [ - "application/json" - ], - "Content-Type": [ - "application/json" - ] - }, - "method": "post", - "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" - }, - "response": { - "body": { - "string": "{\"data\":{\"id\":\"cbff0c31-56b6-48f7-9c4f-5a96a2358d6c\",\"type\":\"appDefinitions\"}}", - "encoding": null - }, - "headers": { - "Content-Type": [ - "application/vnd.api+json" - ] - }, - "status": { - "code": 201, - "message": "Created" - } - }, - "recorded_at": "Tue, 10 Dec 2024 19:57:12 GMT" - }, - { - "request": { - "body": { - "string": "{\"data\":{\"attributes\":{\"rootInstanceName\":\"\"},\"id\":\"cbff0c31-56b6-48f7-9c4f-5a96a2358d6c\",\"type\":\"appDefinitions\"}}", - "encoding": null - }, - "headers": { - "Accept": [ - "application/json" - ], - "Content-Type": [ - "application/json" - ] - }, - "method": "patch", - "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/cbff0c31-56b6-48f7-9c4f-5a96a2358d6c" - }, - "response": { - "body": { - "string": "{\"errors\":[{\"detail\":\"missing required field\",\"source\":{\"pointer\":\"/data/attributes/rootInstanceName\"}}]}", - "encoding": null - }, - "headers": { - "Content-Type": [ - "application/vnd.api+json" - ] - }, - "status": { - "code": 400, - "message": "Bad Request" - } - }, - "recorded_at": "Tue, 10 Dec 2024 19:57:12 GMT" - }, - { - "request": { - "body": "", - "headers": { - "Accept": [ - "application/json" - ] - }, - "method": "delete", - "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/cbff0c31-56b6-48f7-9c4f-5a96a2358d6c" - }, - "response": { - "body": { - "string": "{\"data\":{\"id\":\"cbff0c31-56b6-48f7-9c4f-5a96a2358d6c\",\"type\":\"appDefinitions\"}}", - "encoding": null - }, - "headers": { - "Content-Type": [ - "application/vnd.api+json" - ] - }, - "status": { - "code": 200, - "message": "OK" - } - }, - "recorded_at": "Tue, 10 Dec 2024 19:57:12 GMT" - } - ], - "recorded_with": "VCR 6.0.0" -} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Update-App-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/apps/Update-App-returns-OK-response.frozen deleted file mode 100644 index f6a0202ba..000000000 --- a/tests/scenarios/cassettes/v2/apps/Update-App-returns-OK-response.frozen +++ /dev/null @@ -1 +0,0 @@ -2024-12-10T19:57:12.823Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Update-App-returns-OK-response.json b/tests/scenarios/cassettes/v2/apps/Update-App-returns-OK-response.json deleted file mode 100644 index 0c77d8ea0..000000000 --- a/tests/scenarios/cassettes/v2/apps/Update-App-returns-OK-response.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "http_interactions": [ - { - "request": { - "body": { - "string": "{\"data\":{\"attributes\":{\"components\":[{\"events\":[],\"name\":\"grid0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"gridCell0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"calloutValue0\",\"properties\":{\"isDisabled\":false,\"isLoading\":false,\"isVisible\":true,\"label\":\"CPU Usage\",\"size\":\"sm\",\"style\":\"vivid_yellow\",\"unit\":\"kB\",\"value\":\"42\"},\"type\":\"calloutValue\"}],\"isVisible\":\"true\",\"layout\":{\"default\":{\"height\":8,\"width\":2,\"x\":0,\"y\":0}}},\"type\":\"gridCell\"}]},\"type\":\"grid\"}],\"description\":\"This is a simple example app\",\"embeddedQueries\":[],\"name\":\"Example App\",\"rootInstanceName\":\"grid0\"},\"type\":\"appDefinitions\"}}", - "encoding": null - }, - "headers": { - "Accept": [ - "application/json" - ], - "Content-Type": [ - "application/json" - ] - }, - "method": "post", - "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" - }, - "response": { - "body": { - "string": "{\"data\":{\"id\":\"291d8084-0383-4e59-b17c-ef0c0d7e6532\",\"type\":\"appDefinitions\"}}", - "encoding": null - }, - "headers": { - "Content-Type": [ - "application/vnd.api+json" - ] - }, - "status": { - "code": 201, - "message": "Created" - } - }, - "recorded_at": "Tue, 10 Dec 2024 19:57:12 GMT" - }, - { - "request": { - "body": { - "string": "{\"data\":{\"attributes\":{\"name\":\"Updated Name\",\"rootInstanceName\":\"grid0\"},\"id\":\"291d8084-0383-4e59-b17c-ef0c0d7e6532\",\"type\":\"appDefinitions\"}}", - "encoding": null - }, - "headers": { - "Accept": [ - "application/json" - ], - "Content-Type": [ - "application/json" - ] - }, - "method": "patch", - "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/291d8084-0383-4e59-b17c-ef0c0d7e6532" - }, - "response": { - "body": { - "string": "{\"data\":{\"id\":\"291d8084-0383-4e59-b17c-ef0c0d7e6532\",\"type\":\"appDefinitions\",\"attributes\":{\"components\":[{\"events\":[],\"name\":\"grid0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"gridCell0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"calloutValue0\",\"properties\":{\"isDisabled\":false,\"isLoading\":false,\"isVisible\":true,\"label\":\"CPU Usage\",\"size\":\"sm\",\"style\":\"vivid_yellow\",\"unit\":\"kB\",\"value\":\"42\"},\"type\":\"calloutValue\"}],\"isVisible\":\"true\",\"layout\":{\"default\":{\"height\":8,\"width\":2,\"x\":0,\"y\":0}}},\"type\":\"gridCell\"}]},\"type\":\"grid\"}],\"description\":\"This is a simple example app\",\"embeddedQueries\":[],\"favorite\":false,\"name\":\"Updated Name\",\"rootInstanceName\":\"grid0\",\"selfService\":false,\"tags\":[]},\"meta\":{\"org_id\":1107852,\"user_id\":15479137,\"user_uuid\":\"b3f98453-b289-11ef-a4e9-d6d283f92d91\",\"user_name\":\"oliver.li@datadoghq.com\",\"version\":2,\"updated_since_deployment\":false,\"created_at\":\"2024-12-10T19:57:13.001527Z\",\"updated_at\":\"2024-12-10T19:57:13.188796Z\",\"deleted_at\":\"0001-01-01T00:00:00Z\"}}}", - "encoding": null - }, - "headers": { - "Content-Type": [ - "application/vnd.api+json" - ] - }, - "status": { - "code": 200, - "message": "OK" - } - }, - "recorded_at": "Tue, 10 Dec 2024 19:57:12 GMT" - }, - { - "request": { - "body": "", - "headers": { - "Accept": [ - "application/json" - ] - }, - "method": "delete", - "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/291d8084-0383-4e59-b17c-ef0c0d7e6532" - }, - "response": { - "body": { - "string": "{\"data\":{\"id\":\"291d8084-0383-4e59-b17c-ef0c0d7e6532\",\"type\":\"appDefinitions\"}}", - "encoding": null - }, - "headers": { - "Content-Type": [ - "application/vnd.api+json" - ] - }, - "status": { - "code": 200, - "message": "OK" - } - }, - "recorded_at": "Tue, 10 Dec 2024 19:57:12 GMT" - } - ], - "recorded_with": "VCR 6.0.0" -} \ No newline at end of file diff --git a/tests/scenarios/features/v2/app_deployment.feature b/tests/scenarios/features/v2/app_deployment.feature deleted file mode 100644 index f1d486992..000000000 --- a/tests/scenarios/features/v2/app_deployment.feature +++ /dev/null @@ -1,58 +0,0 @@ -@endpoint(app-deployment) @endpoint(app-deployment-v2) -Feature: App Deployment - Deploy and disable apps in App Builder. - - Background: - Given a valid "apiKeyAuth" key in the system - And a valid "appKeyAuth" key in the system - And an instance of "AppDeployment" API - - @team:DataDog/app-builder-backend - Scenario: Deploy App returns "Bad Request" response - Given operation "DeployApp" enabled - And new "DeployApp" request - And request contains "app_id" parameter with value "invalid-uuid" - When the request is sent - Then the response status is 400 Bad Request - - @team:DataDog/app-builder-backend - Scenario: Deploy App returns "Created" response - Given operation "DeployApp" enabled - And new "DeployApp" request - And there is a valid "app" in the system - And request contains "app_id" parameter from "app.data.id" - When the request is sent - Then the response status is 201 Created - - @team:DataDog/app-builder-backend - Scenario: Deploy App returns "Not Found" response - Given operation "DeployApp" enabled - And new "DeployApp" request - And request contains "app_id" parameter with value "7addb29b-f935-472c-ae79-d1963979a23e" - When the request is sent - Then the response status is 404 Not Found - - @team:DataDog/app-builder-backend - Scenario: Disable App returns "Bad Request" response - Given operation "DisableApp" enabled - And new "DisableApp" request - And request contains "app_id" parameter with value "invalid-uuid" - When the request is sent - Then the response status is 400 Bad Request - - @team:DataDog/app-builder-backend - Scenario: Disable App returns "Not Found" response - Given operation "DisableApp" enabled - And new "DisableApp" request - And request contains "app_id" parameter with value "7addb29b-f935-472c-ae79-d1963979a23e" - When the request is sent - Then the response status is 404 Not Found - - @team:DataDog/app-builder-backend - Scenario: Disable App returns "OK" response - Given operation "DisableApp" enabled - And new "DisableApp" request - And there is a valid "app" in the system - And request contains "app_id" parameter from "app.data.id" - When the request is sent - Then the response status is 200 OK diff --git a/tests/scenarios/features/v2/apps.feature b/tests/scenarios/features/v2/apps.feature deleted file mode 100644 index b306b9959..000000000 --- a/tests/scenarios/features/v2/apps.feature +++ /dev/null @@ -1,155 +0,0 @@ -@endpoint(apps) @endpoint(apps-v2) -Feature: Apps - Create, read, update, and delete apps in App Builder. - - Background: - Given a valid "apiKeyAuth" key in the system - And a valid "appKeyAuth" key in the system - And an instance of "Apps" API - - @team:DataDog/app-builder-backend - Scenario: Create App returns "App Created" response - Given operation "CreateApp" enabled - And new "CreateApp" request - And body with value {"data": {"attributes": {"components": [{"events": [], "name": "grid0", "properties": {"children": [{"events": [], "name": "gridCell0", "properties": {"children": [{"events": [], "name": "calloutValue0", "properties": {"isDisabled": false, "isLoading": false, "isVisible": true, "label": "CPU Usage", "size": "sm", "style": "vivid_yellow", "unit": "kB", "value": "42"}, "type": "calloutValue"}], "isVisible": "true", "layout": {"default": {"height": 8, "width": 2, "x": 0, "y": 0}}}, "type": "gridCell"}]}, "type": "grid"}], "description": "This is a simple example app", "embeddedQueries": [], "name": "Example App", "rootInstanceName": "grid0"}, "type": "appDefinitions"}} - When the request is sent - Then the response status is 201 App Created - And the response "data.type" is equal to "appDefinitions" - - @team:DataDog/app-builder-backend - Scenario: Create App returns "Bad Request" response - Given operation "CreateApp" enabled - And new "CreateApp" request - And body with value {"data": {"attributes": {"description": "This is a bad example app", "embeddedQueries": [], "rootInstanceName": "grid0"}, "type": "appDefinitions"}} - When the request is sent - Then the response status is 400 Bad Request - And the response "errors" has length 1 - And the response "errors[0].detail" is equal to "missing required field" - - @team:DataDog/app-builder-backend - Scenario: Delete App returns "Bad Request" response - Given operation "DeleteApp" enabled - And new "DeleteApp" request - And request contains "app_id" parameter with value "bad-app-id" - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/app-builder-backend - Scenario: Delete App returns "Gone" response - Given operation "DeleteApp" enabled - And new "DeleteApp" request - And request contains "app_id" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 410 Gone - - @team:DataDog/app-builder-backend - Scenario: Delete App returns "Not Found" response - Given operation "DeleteApp" enabled - And new "DeleteApp" request - And request contains "app_id" parameter with value "7addb29b-f935-472c-ae79-d1963979a23e" - When the request is sent - Then the response status is 404 Not Found - - @team:DataDog/app-builder-backend - Scenario: Delete App returns "OK" response - Given operation "DeleteApp" enabled - And there is a valid "app" in the system - And new "DeleteApp" request - And request contains "app_id" parameter from "app.data.id" - When the request is sent - Then the response status is 200 OK - And the response "data.id" has the same value as "app.data.id" - And the response "data.type" is equal to "appDefinitions" - - @team:DataDog/app-builder-backend - Scenario: Delete Multiple Apps returns "Bad Request" response - Given operation "DeleteApps" enabled - And new "DeleteApps" request - And body with value {"data": [{"id": "71c0d358-eac5-41e3-892d-a7467571b9b", "type": "appDefinitions"}, {"id": "71c0d358-eac5-41e3-892d-a7467571b9b0", "type": "appDefinitions"}, {"id": "98e7e44d-1562-474a-90f7-3a94e739c006", "type": "appDefinitions"}]} - When the request is sent - Then the response status is 400 Bad Request - - @team:DataDog/app-builder-backend - Scenario: Delete Multiple Apps returns "Not Found" response - Given operation "DeleteApps" enabled - And new "DeleteApps" request - And body with value {"data": [{"id": "29494ddd-ac13-46a7-8558-b05b050ee755", "type": "appDefinitions"}, {"id": "71c0d358-eac5-41e3-892d-a7467571b9b0", "type": "appDefinitions"}, {"id": "98e7e44d-1562-474a-90f7-3a94e739c006", "type": "appDefinitions"}]} - When the request is sent - Then the response status is 404 Not Found - - @team:DataDog/app-builder-backend - Scenario: Delete Multiple Apps returns "OK" response - Given operation "DeleteApps" enabled - And new "DeleteApps" request - And there is a valid "app" in the system - And body with value {"data": [{"id": "{{ app.data.id }}", "type": "appDefinitions"}]} - When the request is sent - Then the response status is 200 OK - And the response "data" has length 1 - And the response "data[0].id" has the same value as "app.data.id" - - @team:DataDog/app-builder-backend - Scenario: Get App returns "Bad Request" response - Given operation "GetApp" enabled - And new "GetApp" request - And request contains "app_id" parameter with value "invalid-uuid" - When the request is sent - Then the response status is 400 Bad Request - - @team:DataDog/app-builder-backend - Scenario: Get App returns "Not Found" response - Given operation "GetApp" enabled - And new "GetApp" request - And request contains "app_id" parameter with value "7addb29b-f935-472c-ae79-d1963979a23e" - When the request is sent - Then the response status is 404 Not Found - - @team:DataDog/app-builder-backend - Scenario: Get App returns "OK" response - Given operation "GetApp" enabled - And new "GetApp" request - And there is a valid "app" in the system - And request contains "app_id" parameter from "app.data.id" - When the request is sent - Then the response status is 200 OK - And the response "data.id" has the same value as "app.data.id" - And the response "data.type" is equal to "appDefinitions" - - @generated @skip @team:DataDog/app-builder-backend - Scenario: List Apps returns "Bad Request, e.g. invalid sort parameter" response - Given operation "ListApps" enabled - And new "ListApps" request - When the request is sent - Then the response status is 400 Bad Request, e.g. invalid sort parameter - - @team:DataDog/app-builder-backend - Scenario: List Apps returns "OK" response - Given operation "ListApps" enabled - And new "ListApps" request - When the request is sent - Then the response status is 200 OK - - @team:DataDog/app-builder-backend - Scenario: Update App returns "Bad Request" response - Given operation "UpdateApp" enabled - And new "UpdateApp" request - And there is a valid "app" in the system - And request contains "app_id" parameter from "app.data.id" - And body with value {"data": {"attributes": {"rootInstanceName": ""}, "id": "{{ app.data.id }}", "type": "appDefinitions"}} - When the request is sent - Then the response status is 400 Bad Request - And the response "errors" has length 1 - And the response "errors[0].detail" is equal to "missing required field" - - @team:DataDog/app-builder-backend - Scenario: Update App returns "OK" response - Given operation "UpdateApp" enabled - And new "UpdateApp" request - And there is a valid "app" in the system - And request contains "app_id" parameter from "app.data.id" - And body with value {"data": {"attributes": {"name": "Updated Name", "rootInstanceName": "grid0"}, "id": "{{ app.data.id }}", "type": "appDefinitions"}} - When the request is sent - Then the response status is 200 OK - And the response "data.id" has the same value as "app.data.id" - And the response "data.type" is equal to "appDefinitions" - And the response "data.attributes.name" is equal to "Updated Name" diff --git a/tests/scenarios/features/v2/given.json b/tests/scenarios/features/v2/given.json index 3c9e42793..21d526af2 100644 --- a/tests/scenarios/features/v2/given.json +++ b/tests/scenarios/features/v2/given.json @@ -47,18 +47,6 @@ "tag": "APM Retention Filters", "operationId": "CreateApmRetentionFilter" }, - { - "parameters": [ - { - "name": "body", - "value": "{\"data\": {\"attributes\": {\"components\": [{\"events\": [], \"name\": \"grid0\", \"properties\": {\"children\": [{\"events\": [], \"name\": \"gridCell0\", \"properties\": {\"children\": [{\"events\": [], \"name\": \"calloutValue0\", \"properties\": {\"isDisabled\": false, \"isLoading\": false, \"isVisible\": true, \"label\": \"CPU Usage\", \"size\": \"sm\", \"style\": \"vivid_yellow\", \"unit\": \"kB\", \"value\": \"42\"}, \"type\": \"calloutValue\"}], \"isVisible\": \"true\", \"layout\": {\"default\": {\"height\": 8, \"width\": 2, \"x\": 0, \"y\": 0}}}, \"type\": \"gridCell\"}]}, \"type\": \"grid\"}], \"description\": \"This is a simple example app\", \"embeddedQueries\": [], \"name\": \"Example App\", \"rootInstanceName\": \"grid0\"}, \"type\": \"appDefinitions\"}}" - } - ], - "step": "there is a valid \"app\" in the system", - "key": "app", - "tag": "Apps", - "operationId": "CreateApp" - }, { "parameters": [ { diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index 7f5663e7d..9db842c40 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -153,61 +153,6 @@ "type": "idempotent" } }, - "DeleteApps": { - "tag": "Apps", - "undo": { - "type": "idempotent" - } - }, - "ListApps": { - "tag": "Apps", - "undo": { - "type": "safe" - } - }, - "CreateApp": { - "tag": "Apps", - "undo": { - "operationId": "DeleteApp", - "parameters": [ - { - "name": "app_id", - "source": "data.id" - } - ], - "type": "unsafe" - } - }, - "DeleteApp": { - "tag": "Apps", - "undo": { - "type": "idempotent" - } - }, - "GetApp": { - "tag": "Apps", - "undo": { - "type": "safe" - } - }, - "UpdateApp": { - "tag": "Apps", - "undo": { - "type": "idempotent" - } - }, - "DisableApp": { - "tag": "App Deployment", - "undo": { - "type": "idempotent" - } - }, - "DeployApp": { - "tag": "App Deployment", - "undo": { - "type": "idempotent" - } - }, "ListApplicationKeys": { "tag": "Key Management", "undo": { diff --git a/tests/scenarios/function_mappings.rs b/tests/scenarios/function_mappings.rs index f4e0138c3..be3ebc194 100644 --- a/tests/scenarios/function_mappings.rs +++ b/tests/scenarios/function_mappings.rs @@ -54,8 +54,6 @@ pub struct ApiInstances { pub v2_api_spans_metrics: Option, pub v2_api_apm_retention_filters: Option, - pub v2_api_apps: Option, - pub v2_api_app_deployment: Option, pub v2_api_audit: Option, pub v2_api_authn_mappings: Option, pub v2_api_case_management: Option, @@ -477,21 +475,6 @@ pub fn initialize_api_instance(world: &mut DatadogWorld, api: String) { world.http_client.as_ref().unwrap().clone() )); } - "Apps" => { - world.api_instances.v2_api_apps = - Some(datadogV2::api_apps::AppsAPI::with_client_and_config( - world.config.clone(), - world.http_client.as_ref().unwrap().clone(), - )); - } - "AppDeployment" => { - world.api_instances.v2_api_app_deployment = Some( - datadogV2::api_app_deployment::AppDeploymentAPI::with_client_and_config( - world.config.clone(), - world.http_client.as_ref().unwrap().clone(), - ), - ); - } "Audit" => { world.api_instances.v2_api_audit = Some(datadogV2::api_audit::AuditAPI::with_client_and_config( @@ -1730,30 +1713,6 @@ pub fn collect_function_calls(world: &mut DatadogWorld) { "v2.UpdateApmRetentionFilter".into(), test_v2_update_apm_retention_filter, ); - world - .function_mappings - .insert("v2.DeleteApps".into(), test_v2_delete_apps); - world - .function_mappings - .insert("v2.ListApps".into(), test_v2_list_apps); - world - .function_mappings - .insert("v2.CreateApp".into(), test_v2_create_app); - world - .function_mappings - .insert("v2.DeleteApp".into(), test_v2_delete_app); - world - .function_mappings - .insert("v2.GetApp".into(), test_v2_get_app); - world - .function_mappings - .insert("v2.UpdateApp".into(), test_v2_update_app); - world - .function_mappings - .insert("v2.DisableApp".into(), test_v2_disable_app); - world - .function_mappings - .insert("v2.DeployApp".into(), test_v2_deploy_app); world .function_mappings .insert("v2.ListAuditLogs".into(), test_v2_list_audit_logs); @@ -11304,247 +11263,6 @@ fn test_v2_update_apm_retention_filter( world.response.code = response.status.as_u16(); } -fn test_v2_delete_apps(world: &mut DatadogWorld, _parameters: &HashMap) { - let api = world - .api_instances - .v2_api_apps - .as_ref() - .expect("api instance not found"); - let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); - let response = match block_on(api.delete_apps_with_http_info(body)) { - Ok(response) => response, - Err(error) => { - return match error { - Error::ResponseError(e) => { - world.response.code = e.status.as_u16(); - if let Some(entity) = e.entity { - world.response.object = serde_json::to_value(entity).unwrap(); - } - } - _ => panic!("error parsing response: {error}"), - }; - } - }; - world.response.object = serde_json::to_value(response.entity).unwrap(); - world.response.code = response.status.as_u16(); -} - -fn test_v2_list_apps(world: &mut DatadogWorld, _parameters: &HashMap) { - let api = world - .api_instances - .v2_api_apps - .as_ref() - .expect("api instance not found"); - let limit = _parameters - .get("limit") - .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); - let page = _parameters - .get("page") - .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); - let filter_user_name = _parameters - .get("filter[user_name]") - .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); - let filter_user_uuid = _parameters - .get("filter[user_uuid]") - .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); - let filter_name = _parameters - .get("filter[name]") - .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); - let filter_query = _parameters - .get("filter[query]") - .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); - let filter_deployed = _parameters - .get("filter[deployed]") - .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); - let filter_tags = _parameters - .get("filter[tags]") - .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); - let filter_favorite = _parameters - .get("filter[favorite]") - .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); - let sort = _parameters - .get("sort") - .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); - let mut params = datadogV2::api_apps::ListAppsOptionalParams::default(); - params.limit = limit; - params.page = page; - params.filter_user_name = filter_user_name; - params.filter_user_uuid = filter_user_uuid; - params.filter_name = filter_name; - params.filter_query = filter_query; - params.filter_deployed = filter_deployed; - params.filter_tags = filter_tags; - params.filter_favorite = filter_favorite; - params.sort = sort; - let response = match block_on(api.list_apps_with_http_info(params)) { - Ok(response) => response, - Err(error) => { - return match error { - Error::ResponseError(e) => { - world.response.code = e.status.as_u16(); - if let Some(entity) = e.entity { - world.response.object = serde_json::to_value(entity).unwrap(); - } - } - _ => panic!("error parsing response: {error}"), - }; - } - }; - world.response.object = serde_json::to_value(response.entity).unwrap(); - world.response.code = response.status.as_u16(); -} - -fn test_v2_create_app(world: &mut DatadogWorld, _parameters: &HashMap) { - let api = world - .api_instances - .v2_api_apps - .as_ref() - .expect("api instance not found"); - let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); - let response = match block_on(api.create_app_with_http_info(body)) { - Ok(response) => response, - Err(error) => { - return match error { - Error::ResponseError(e) => { - world.response.code = e.status.as_u16(); - if let Some(entity) = e.entity { - world.response.object = serde_json::to_value(entity).unwrap(); - } - } - _ => panic!("error parsing response: {error}"), - }; - } - }; - world.response.object = serde_json::to_value(response.entity).unwrap(); - world.response.code = response.status.as_u16(); -} - -fn test_v2_delete_app(world: &mut DatadogWorld, _parameters: &HashMap) { - let api = world - .api_instances - .v2_api_apps - .as_ref() - .expect("api instance not found"); - let app_id = serde_json::from_value(_parameters.get("app_id").unwrap().clone()).unwrap(); - let response = match block_on(api.delete_app_with_http_info(app_id)) { - Ok(response) => response, - Err(error) => { - return match error { - Error::ResponseError(e) => { - world.response.code = e.status.as_u16(); - if let Some(entity) = e.entity { - world.response.object = serde_json::to_value(entity).unwrap(); - } - } - _ => panic!("error parsing response: {error}"), - }; - } - }; - world.response.object = serde_json::to_value(response.entity).unwrap(); - world.response.code = response.status.as_u16(); -} - -fn test_v2_get_app(world: &mut DatadogWorld, _parameters: &HashMap) { - let api = world - .api_instances - .v2_api_apps - .as_ref() - .expect("api instance not found"); - let app_id = serde_json::from_value(_parameters.get("app_id").unwrap().clone()).unwrap(); - let response = match block_on(api.get_app_with_http_info(app_id)) { - Ok(response) => response, - Err(error) => { - return match error { - Error::ResponseError(e) => { - world.response.code = e.status.as_u16(); - if let Some(entity) = e.entity { - world.response.object = serde_json::to_value(entity).unwrap(); - } - } - _ => panic!("error parsing response: {error}"), - }; - } - }; - world.response.object = serde_json::to_value(response.entity).unwrap(); - world.response.code = response.status.as_u16(); -} - -fn test_v2_update_app(world: &mut DatadogWorld, _parameters: &HashMap) { - let api = world - .api_instances - .v2_api_apps - .as_ref() - .expect("api instance not found"); - let app_id = serde_json::from_value(_parameters.get("app_id").unwrap().clone()).unwrap(); - let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); - let response = match block_on(api.update_app_with_http_info(app_id, body)) { - Ok(response) => response, - Err(error) => { - return match error { - Error::ResponseError(e) => { - world.response.code = e.status.as_u16(); - if let Some(entity) = e.entity { - world.response.object = serde_json::to_value(entity).unwrap(); - } - } - _ => panic!("error parsing response: {error}"), - }; - } - }; - world.response.object = serde_json::to_value(response.entity).unwrap(); - world.response.code = response.status.as_u16(); -} - -fn test_v2_disable_app(world: &mut DatadogWorld, _parameters: &HashMap) { - let api = world - .api_instances - .v2_api_app_deployment - .as_ref() - .expect("api instance not found"); - let app_id = serde_json::from_value(_parameters.get("app_id").unwrap().clone()).unwrap(); - let response = match block_on(api.disable_app_with_http_info(app_id)) { - Ok(response) => response, - Err(error) => { - return match error { - Error::ResponseError(e) => { - world.response.code = e.status.as_u16(); - if let Some(entity) = e.entity { - world.response.object = serde_json::to_value(entity).unwrap(); - } - } - _ => panic!("error parsing response: {error}"), - }; - } - }; - world.response.object = serde_json::to_value(response.entity).unwrap(); - world.response.code = response.status.as_u16(); -} - -fn test_v2_deploy_app(world: &mut DatadogWorld, _parameters: &HashMap) { - let api = world - .api_instances - .v2_api_app_deployment - .as_ref() - .expect("api instance not found"); - let app_id = serde_json::from_value(_parameters.get("app_id").unwrap().clone()).unwrap(); - let response = match block_on(api.deploy_app_with_http_info(app_id)) { - Ok(response) => response, - Err(error) => { - return match error { - Error::ResponseError(e) => { - world.response.code = e.status.as_u16(); - if let Some(entity) = e.entity { - world.response.object = serde_json::to_value(entity).unwrap(); - } - } - _ => panic!("error parsing response: {error}"), - }; - } - }; - world.response.object = serde_json::to_value(response.entity).unwrap(); - world.response.code = response.status.as_u16(); -} - fn test_v2_list_audit_logs(world: &mut DatadogWorld, _parameters: &HashMap) { let api = world .api_instances From d7bc3a5c8b981b9de1194b7b9a2ebc8c1d6ccfe5 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 17 Dec 2024 15:56:38 +0000 Subject: [PATCH 4/4] Regenerate client from commit b82d3677 of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 1691 +++++++++++++++++ examples/v2_app-deployment_DeployApp.rs | 18 + examples/v2_app-deployment_DisableApp.rs | 18 + examples/v2_apps_CreateApp.rs | 55 + examples/v2_apps_DeleteApp.rs | 18 + examples/v2_apps_DeleteApps.rs | 25 + examples/v2_apps_GetApp.rs | 18 + examples/v2_apps_ListApps.rs | 17 + examples/v2_apps_UpdateApp.rs | 31 + src/datadog/configuration.rs | 8 + src/datadogV2/api/api_app_deployment.rs | 316 +++ src/datadogV2/api/api_apps.rs | 1078 +++++++++++ src/datadogV2/api/mod.rs | 2 + src/datadogV2/mod.rs | 2 + src/datadogV2/model/mod.rs | 174 ++ .../model/model_app_builder_error.rs | 109 ++ .../model_app_builder_error_errors_items.rs | 126 ++ ...l_app_builder_error_errors_items_source.rs | 122 ++ .../model/model_app_builder_event.rs | 138 ++ .../model/model_app_builder_event_name.rs | 75 + .../model/model_app_builder_event_type.rs | 69 + src/datadogV2/model/model_app_meta.rs | 260 +++ src/datadogV2/model/model_apps_sort_field.rs | 69 + src/datadogV2/model/model_component.rs | 157 ++ src/datadogV2/model/model_component_grid.rs | 160 ++ .../model/model_component_grid_properties.rs | 153 ++ ...el_component_grid_properties_is_visible.rs | 33 + .../model/model_component_grid_type.rs | 48 + .../model/model_component_properties.rs | 134 ++ .../model_component_properties_is_visible.rs | 33 + src/datadogV2/model/model_component_type.rs | 105 + .../model/model_create_app_request.rs | 105 + .../model/model_create_app_request_data.rs | 122 ++ ...odel_create_app_request_data_attributes.rs | 228 +++ .../model_create_app_request_data_type.rs | 48 + .../model/model_create_app_response.rs | 105 + .../model/model_create_app_response_data.rs | 113 ++ .../model_create_app_response_data_type.rs | 48 + .../model/model_custom_connection.rs | 151 ++ .../model_custom_connection_attributes.rs | 128 ++ ...om_connection_attributes_on_prem_runner.rs | 122 ++ .../model/model_custom_connection_type.rs | 48 + .../model/model_delete_app_response.rs | 105 + .../model/model_delete_app_response_data.rs | 113 ++ .../model_delete_app_response_data_type.rs | 48 + .../model/model_delete_apps_request.rs | 106 ++ .../model_delete_apps_request_data_items.rs | 114 ++ ...del_delete_apps_request_data_items_type.rs | 48 + .../model/model_delete_apps_response.rs | 109 ++ .../model_delete_apps_response_data_items.rs | 114 ++ ...el_delete_apps_response_data_items_type.rs | 48 + .../model/model_deploy_app_response.rs | 105 + .../model/model_deploy_app_response_data.rs | 169 ++ ...del_deploy_app_response_data_attributes.rs | 106 ++ .../model_deploy_app_response_data_type.rs | 48 + .../model/model_deployment_included.rs | 168 ++ .../model_deployment_included_attributes.rs | 106 ++ .../model/model_deployment_included_meta.rs | 156 ++ .../model/model_deployment_included_type.rs | 48 + src/datadogV2/model/model_deployment_meta.rs | 156 ++ .../model/model_deployment_relationship.rs | 122 ++ .../model_deployment_relationship_data.rs | 131 ++ ...model_deployment_relationship_data_type.rs | 48 + .../model_deployment_relationship_meta.rs | 156 ++ .../model/model_disable_app_response.rs | 105 + .../model/model_disable_app_response_data.rs | 169 ++ ...el_disable_app_response_data_attributes.rs | 106 ++ .../model_disable_app_response_data_type.rs | 48 + src/datadogV2/model/model_get_app_response.rs | 161 ++ .../model/model_get_app_response_data.rs | 125 ++ .../model_get_app_response_data_attributes.rs | 245 +++ .../model/model_get_app_response_data_type.rs | 48 + .../model_get_app_response_relationship.rs | 123 ++ src/datadogV2/model/model_input_schema.rs | 105 + .../model/model_input_schema_data.rs | 148 ++ .../model_input_schema_data_attributes.rs | 110 ++ ...schema_data_attributes_parameters_items.rs | 110 ++ ...a_data_attributes_parameters_items_data.rs | 111 ++ ...ibutes_parameters_items_data_attributes.rs | 192 ++ .../model/model_input_schema_data_type.rs | 48 + .../model/model_list_apps_response.rs | 140 ++ .../model_list_apps_response_data_items.rs | 167 ++ ...ist_apps_response_data_items_attributes.rs | 175 ++ ..._apps_response_data_items_relationships.rs | 105 + ...odel_list_apps_response_data_items_type.rs | 48 + .../model/model_list_apps_response_meta.rs | 105 + .../model_list_apps_response_meta_page.rs | 124 ++ src/datadogV2/model/model_query.rs | 154 ++ src/datadogV2/model/model_query_type.rs | 54 + src/datadogV2/model/model_script.rs | 105 + src/datadogV2/model/model_script_data.rs | 149 ++ .../model/model_script_data_attributes.rs | 139 ++ src/datadogV2/model/model_script_data_type.rs | 48 + .../model/model_update_app_request.rs | 105 + .../model/model_update_app_request_data.rs | 139 ++ ...odel_update_app_request_data_attributes.rs | 228 +++ .../model_update_app_request_data_type.rs | 48 + .../model/model_update_app_response.rs | 162 ++ .../model/model_update_app_response_data.rs | 126 ++ ...del_update_app_response_data_attributes.rs | 245 +++ .../model_update_app_response_data_type.rs | 48 + .../model_update_app_response_relationship.rs | 123 ++ ...oy-App-returns-Bad-Request-response.frozen | 1 + ...ploy-App-returns-Bad-Request-response.json | 33 + ...Deploy-App-returns-Created-response.frozen | 1 + .../Deploy-App-returns-Created-response.json | 95 + ...ploy-App-returns-Not-Found-response.frozen | 1 + ...Deploy-App-returns-Not-Found-response.json | 33 + ...le-App-returns-Bad-Request-response.frozen | 1 + ...able-App-returns-Bad-Request-response.json | 33 + ...able-App-returns-Not-Found-response.frozen | 1 + ...isable-App-returns-Not-Found-response.json | 33 + .../Disable-App-returns-OK-response.frozen | 1 + .../Disable-App-returns-OK-response.json | 95 + ...te-App-returns-App-Created-response.frozen | 1 + ...eate-App-returns-App-Created-response.json | 67 + ...te-App-returns-Bad-Request-response.frozen | 1 + ...eate-App-returns-Bad-Request-response.json | 39 + ...te-App-returns-Bad-Request-response.frozen | 1 + ...lete-App-returns-Bad-Request-response.json | 33 + ...lete-App-returns-Not-Found-response.frozen | 1 + ...Delete-App-returns-Not-Found-response.json | 33 + .../Delete-App-returns-OK-response.frozen | 1 + .../apps/Delete-App-returns-OK-response.json | 95 + ...e-Apps-returns-Bad-Request-response.frozen | 1 + ...ple-Apps-returns-Bad-Request-response.json | 39 + ...ple-Apps-returns-Not-Found-response.frozen | 1 + ...tiple-Apps-returns-Not-Found-response.json | 39 + ...e-Multiple-Apps-returns-OK-response.frozen | 1 + ...ete-Multiple-Apps-returns-OK-response.json | 101 + ...et-App-returns-Bad-Request-response.frozen | 1 + .../Get-App-returns-Bad-Request-response.json | 33 + .../Get-App-returns-Not-Found-response.frozen | 1 + .../Get-App-returns-Not-Found-response.json | 33 + .../apps/Get-App-returns-OK-response.frozen | 1 + .../v2/apps/Get-App-returns-OK-response.json | 95 + .../apps/List-Apps-returns-OK-response.frozen | 1 + .../apps/List-Apps-returns-OK-response.json | 33 + ...te-App-returns-Bad-Request-response.frozen | 1 + ...date-App-returns-Bad-Request-response.json | 101 + .../Update-App-returns-OK-response.frozen | 1 + .../apps/Update-App-returns-OK-response.json | 101 + .../features/v2/app_deployment.feature | 58 + tests/scenarios/features/v2/apps.feature | 155 ++ tests/scenarios/features/v2/given.json | 12 + tests/scenarios/features/v2/undo.json | 55 + tests/scenarios/function_mappings.rs | 282 +++ 148 files changed, 15245 insertions(+), 4 deletions(-) create mode 100644 examples/v2_app-deployment_DeployApp.rs create mode 100644 examples/v2_app-deployment_DisableApp.rs create mode 100644 examples/v2_apps_CreateApp.rs create mode 100644 examples/v2_apps_DeleteApp.rs create mode 100644 examples/v2_apps_DeleteApps.rs create mode 100644 examples/v2_apps_GetApp.rs create mode 100644 examples/v2_apps_ListApps.rs create mode 100644 examples/v2_apps_UpdateApp.rs create mode 100644 src/datadogV2/api/api_app_deployment.rs create mode 100644 src/datadogV2/api/api_apps.rs create mode 100644 src/datadogV2/model/model_app_builder_error.rs create mode 100644 src/datadogV2/model/model_app_builder_error_errors_items.rs create mode 100644 src/datadogV2/model/model_app_builder_error_errors_items_source.rs create mode 100644 src/datadogV2/model/model_app_builder_event.rs create mode 100644 src/datadogV2/model/model_app_builder_event_name.rs create mode 100644 src/datadogV2/model/model_app_builder_event_type.rs create mode 100644 src/datadogV2/model/model_app_meta.rs create mode 100644 src/datadogV2/model/model_apps_sort_field.rs create mode 100644 src/datadogV2/model/model_component.rs create mode 100644 src/datadogV2/model/model_component_grid.rs create mode 100644 src/datadogV2/model/model_component_grid_properties.rs create mode 100644 src/datadogV2/model/model_component_grid_properties_is_visible.rs create mode 100644 src/datadogV2/model/model_component_grid_type.rs create mode 100644 src/datadogV2/model/model_component_properties.rs create mode 100644 src/datadogV2/model/model_component_properties_is_visible.rs create mode 100644 src/datadogV2/model/model_component_type.rs create mode 100644 src/datadogV2/model/model_create_app_request.rs create mode 100644 src/datadogV2/model/model_create_app_request_data.rs create mode 100644 src/datadogV2/model/model_create_app_request_data_attributes.rs create mode 100644 src/datadogV2/model/model_create_app_request_data_type.rs create mode 100644 src/datadogV2/model/model_create_app_response.rs create mode 100644 src/datadogV2/model/model_create_app_response_data.rs create mode 100644 src/datadogV2/model/model_create_app_response_data_type.rs create mode 100644 src/datadogV2/model/model_custom_connection.rs create mode 100644 src/datadogV2/model/model_custom_connection_attributes.rs create mode 100644 src/datadogV2/model/model_custom_connection_attributes_on_prem_runner.rs create mode 100644 src/datadogV2/model/model_custom_connection_type.rs create mode 100644 src/datadogV2/model/model_delete_app_response.rs create mode 100644 src/datadogV2/model/model_delete_app_response_data.rs create mode 100644 src/datadogV2/model/model_delete_app_response_data_type.rs create mode 100644 src/datadogV2/model/model_delete_apps_request.rs create mode 100644 src/datadogV2/model/model_delete_apps_request_data_items.rs create mode 100644 src/datadogV2/model/model_delete_apps_request_data_items_type.rs create mode 100644 src/datadogV2/model/model_delete_apps_response.rs create mode 100644 src/datadogV2/model/model_delete_apps_response_data_items.rs create mode 100644 src/datadogV2/model/model_delete_apps_response_data_items_type.rs create mode 100644 src/datadogV2/model/model_deploy_app_response.rs create mode 100644 src/datadogV2/model/model_deploy_app_response_data.rs create mode 100644 src/datadogV2/model/model_deploy_app_response_data_attributes.rs create mode 100644 src/datadogV2/model/model_deploy_app_response_data_type.rs create mode 100644 src/datadogV2/model/model_deployment_included.rs create mode 100644 src/datadogV2/model/model_deployment_included_attributes.rs create mode 100644 src/datadogV2/model/model_deployment_included_meta.rs create mode 100644 src/datadogV2/model/model_deployment_included_type.rs create mode 100644 src/datadogV2/model/model_deployment_meta.rs create mode 100644 src/datadogV2/model/model_deployment_relationship.rs create mode 100644 src/datadogV2/model/model_deployment_relationship_data.rs create mode 100644 src/datadogV2/model/model_deployment_relationship_data_type.rs create mode 100644 src/datadogV2/model/model_deployment_relationship_meta.rs create mode 100644 src/datadogV2/model/model_disable_app_response.rs create mode 100644 src/datadogV2/model/model_disable_app_response_data.rs create mode 100644 src/datadogV2/model/model_disable_app_response_data_attributes.rs create mode 100644 src/datadogV2/model/model_disable_app_response_data_type.rs create mode 100644 src/datadogV2/model/model_get_app_response.rs create mode 100644 src/datadogV2/model/model_get_app_response_data.rs create mode 100644 src/datadogV2/model/model_get_app_response_data_attributes.rs create mode 100644 src/datadogV2/model/model_get_app_response_data_type.rs create mode 100644 src/datadogV2/model/model_get_app_response_relationship.rs create mode 100644 src/datadogV2/model/model_input_schema.rs create mode 100644 src/datadogV2/model/model_input_schema_data.rs create mode 100644 src/datadogV2/model/model_input_schema_data_attributes.rs create mode 100644 src/datadogV2/model/model_input_schema_data_attributes_parameters_items.rs create mode 100644 src/datadogV2/model/model_input_schema_data_attributes_parameters_items_data.rs create mode 100644 src/datadogV2/model/model_input_schema_data_attributes_parameters_items_data_attributes.rs create mode 100644 src/datadogV2/model/model_input_schema_data_type.rs create mode 100644 src/datadogV2/model/model_list_apps_response.rs create mode 100644 src/datadogV2/model/model_list_apps_response_data_items.rs create mode 100644 src/datadogV2/model/model_list_apps_response_data_items_attributes.rs create mode 100644 src/datadogV2/model/model_list_apps_response_data_items_relationships.rs create mode 100644 src/datadogV2/model/model_list_apps_response_data_items_type.rs create mode 100644 src/datadogV2/model/model_list_apps_response_meta.rs create mode 100644 src/datadogV2/model/model_list_apps_response_meta_page.rs create mode 100644 src/datadogV2/model/model_query.rs create mode 100644 src/datadogV2/model/model_query_type.rs create mode 100644 src/datadogV2/model/model_script.rs create mode 100644 src/datadogV2/model/model_script_data.rs create mode 100644 src/datadogV2/model/model_script_data_attributes.rs create mode 100644 src/datadogV2/model/model_script_data_type.rs create mode 100644 src/datadogV2/model/model_update_app_request.rs create mode 100644 src/datadogV2/model/model_update_app_request_data.rs create mode 100644 src/datadogV2/model/model_update_app_request_data_attributes.rs create mode 100644 src/datadogV2/model/model_update_app_request_data_type.rs create mode 100644 src/datadogV2/model/model_update_app_response.rs create mode 100644 src/datadogV2/model/model_update_app_response_data.rs create mode 100644 src/datadogV2/model/model_update_app_response_data_attributes.rs create mode 100644 src/datadogV2/model/model_update_app_response_data_type.rs create mode 100644 src/datadogV2/model/model_update_app_response_relationship.rs create mode 100644 tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Bad-Request-response.frozen create mode 100644 tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Bad-Request-response.json create mode 100644 tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Created-response.frozen create mode 100644 tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Created-response.json create mode 100644 tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Not-Found-response.frozen create mode 100644 tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Not-Found-response.json create mode 100644 tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Bad-Request-response.frozen create mode 100644 tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Bad-Request-response.json create mode 100644 tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Not-Found-response.frozen create mode 100644 tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Not-Found-response.json create mode 100644 tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-OK-response.frozen create mode 100644 tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-OK-response.json create mode 100644 tests/scenarios/cassettes/v2/apps/Create-App-returns-App-Created-response.frozen create mode 100644 tests/scenarios/cassettes/v2/apps/Create-App-returns-App-Created-response.json create mode 100644 tests/scenarios/cassettes/v2/apps/Create-App-returns-Bad-Request-response.frozen create mode 100644 tests/scenarios/cassettes/v2/apps/Create-App-returns-Bad-Request-response.json create mode 100644 tests/scenarios/cassettes/v2/apps/Delete-App-returns-Bad-Request-response.frozen create mode 100644 tests/scenarios/cassettes/v2/apps/Delete-App-returns-Bad-Request-response.json create mode 100644 tests/scenarios/cassettes/v2/apps/Delete-App-returns-Not-Found-response.frozen create mode 100644 tests/scenarios/cassettes/v2/apps/Delete-App-returns-Not-Found-response.json create mode 100644 tests/scenarios/cassettes/v2/apps/Delete-App-returns-OK-response.frozen create mode 100644 tests/scenarios/cassettes/v2/apps/Delete-App-returns-OK-response.json create mode 100644 tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Bad-Request-response.frozen create mode 100644 tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Bad-Request-response.json create mode 100644 tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Not-Found-response.frozen create mode 100644 tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Not-Found-response.json create mode 100644 tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-OK-response.frozen create mode 100644 tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-OK-response.json create mode 100644 tests/scenarios/cassettes/v2/apps/Get-App-returns-Bad-Request-response.frozen create mode 100644 tests/scenarios/cassettes/v2/apps/Get-App-returns-Bad-Request-response.json create mode 100644 tests/scenarios/cassettes/v2/apps/Get-App-returns-Not-Found-response.frozen create mode 100644 tests/scenarios/cassettes/v2/apps/Get-App-returns-Not-Found-response.json create mode 100644 tests/scenarios/cassettes/v2/apps/Get-App-returns-OK-response.frozen create mode 100644 tests/scenarios/cassettes/v2/apps/Get-App-returns-OK-response.json create mode 100644 tests/scenarios/cassettes/v2/apps/List-Apps-returns-OK-response.frozen create mode 100644 tests/scenarios/cassettes/v2/apps/List-Apps-returns-OK-response.json create mode 100644 tests/scenarios/cassettes/v2/apps/Update-App-returns-Bad-Request-response.frozen create mode 100644 tests/scenarios/cassettes/v2/apps/Update-App-returns-Bad-Request-response.json create mode 100644 tests/scenarios/cassettes/v2/apps/Update-App-returns-OK-response.frozen create mode 100644 tests/scenarios/cassettes/v2/apps/Update-App-returns-OK-response.json create mode 100644 tests/scenarios/features/v2/app_deployment.feature create mode 100644 tests/scenarios/features/v2/apps.feature diff --git a/.apigentools-info b/.apigentools-info index 0b8614430..ad9e55604 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-12-16 19:15:41.785620", - "spec_repo_commit": "162aece5" + "regenerated": "2024-12-17 15:51:05.376779", + "spec_repo_commit": "b82d3677" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-12-16 19:15:41.800183", - "spec_repo_commit": "162aece5" + "regenerated": "2024-12-17 15:51:05.390982", + "spec_repo_commit": "b82d3677" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 5d4184e4f..c19d456f4 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1615,6 +1615,126 @@ components: type: string x-enum-varnames: - apm_retention_filter + AppBuilderError: + description: The definition of `AppBuilderError` object. + properties: + errors: + description: The `AppBuilderError` `errors`. + items: + $ref: '#/components/schemas/AppBuilderErrorErrorsItems' + type: array + type: object + AppBuilderErrorErrorsItems: + description: The definition of `AppBuilderErrorErrorsItems` object. + properties: + detail: + description: The `items` `detail`. + type: string + source: + $ref: '#/components/schemas/AppBuilderErrorErrorsItemsSource' + type: object + AppBuilderErrorErrorsItemsSource: + description: The definition of `AppBuilderErrorErrorsItemsSource` object. + properties: + parameter: + description: The `source` `parameter`. + type: string + pointer: + description: The `source` `pointer`. + type: string + type: object + AppBuilderEvent: + additionalProperties: {} + description: The definition of `AppBuilderEvent` object. + properties: + name: + $ref: '#/components/schemas/AppBuilderEventName' + type: + $ref: '#/components/schemas/AppBuilderEventType' + type: object + AppBuilderEventName: + description: The triggering action for the event. + enum: + - pageChange + - tableRowClick + - _tableRowButtonClick + - change + - submit + - click + - toggleOpen + - close + - open + - executionFinished + type: string + x-enum-varnames: + - PAGECHANGE + - TABLEROWCLICK + - TABLEROWBUTTONCLICK + - CHANGE + - SUBMIT + - CLICK + - TOGGLEOPEN + - CLOSE + - OPEN + - EXECUTIONFINISHED + AppBuilderEventType: + description: The response to the event. + enum: + - custom + - setComponentState + - triggerQuery + - openModal + - closeModal + - openUrl + - downloadFile + - setStateVariableValue + type: string + x-enum-varnames: + - CUSTOM + - SETCOMPONENTSTATE + - TRIGGERQUERY + - OPENMODAL + - CLOSEMODAL + - OPENURL + - DOWNLOADFILE + - SETSTATEVARIABLEVALUE + AppMeta: + description: The definition of `AppMeta` object. + properties: + created_at: + description: The `AppMeta` `created_at`. + type: string + deleted_at: + description: The `AppMeta` `deleted_at`. + type: string + org_id: + description: The `AppMeta` `org_id`. + format: int64 + type: integer + run_as_user: + description: The `AppMeta` `run_as_user`. + type: string + updated_at: + description: The `AppMeta` `updated_at`. + type: string + updated_since_deployment: + description: The `AppMeta` `updated_since_deployment`. + type: boolean + user_id: + description: The `AppMeta` `user_id`. + format: int64 + type: integer + user_name: + description: The `AppMeta` `user_name`. + type: string + user_uuid: + description: The `AppMeta` `user_uuid`. + type: string + version: + description: The `AppMeta` `version`. + format: int64 + type: integer + type: object ApplicationKeyCreateAttributes: description: Attributes used to create an application Key. properties: @@ -1766,6 +1886,27 @@ components: type: string x-enum-varnames: - APPLICATION_KEYS + AppsSortField: + description: The field and direction to sort apps by + enum: + - name + - created_at + - updated_at + - user_name + - -name + - -created_at + - -updated_at + - -user_name + type: string + x-enum-varnames: + - NAME + - CREATED_AT + - UPDATED_AT + - USER_NAME + - NAME_DESC + - CREATED_AT_DESC + - UPDATED_AT_DESC + - USER_NAME_DESC AuditLogsEvent: description: Object description of an Audit Logs event after it is processed and stored by Datadog. @@ -5528,6 +5669,150 @@ components: $ref: '#/components/schemas/CloudflareAccountResponseData' type: array type: object + Component: + description: The definition of `Component` object. + properties: + events: + description: The `Component` `events`. + items: + $ref: '#/components/schemas/AppBuilderEvent' + type: array + id: + description: The `Component` `id`. + nullable: true + type: string + name: + description: The `Component` `name`. + example: '' + type: string + properties: + $ref: '#/components/schemas/ComponentProperties' + type: + $ref: '#/components/schemas/ComponentType' + required: + - name + - type + - properties + type: object + ComponentGrid: + description: The definition of `ComponentGrid` object. + properties: + events: + description: The `ComponentGrid` `events`. + items: + $ref: '#/components/schemas/AppBuilderEvent' + type: array + id: + description: The `ComponentGrid` `id`. + type: string + name: + description: The `ComponentGrid` `name`. + example: '' + type: string + properties: + $ref: '#/components/schemas/ComponentGridProperties' + type: + $ref: '#/components/schemas/ComponentGridType' + required: + - name + - type + - properties + type: object + ComponentGridProperties: + description: The definition of `ComponentGridProperties` object. + properties: + backgroundColor: + default: default + description: The `ComponentGridProperties` `backgroundColor`. + type: string + children: + description: The `ComponentGridProperties` `children`. + items: + $ref: '#/components/schemas/Component' + type: array + isVisible: + $ref: '#/components/schemas/ComponentGridPropertiesIsVisible' + type: object + ComponentGridPropertiesIsVisible: + description: The definition of `ComponentGridPropertiesIsVisible` object. + oneOf: + - type: string + - default: true + type: boolean + ComponentGridType: + description: The definition of `ComponentGridType` object. + enum: + - grid + example: grid + type: string + x-enum-varnames: + - GRID + ComponentProperties: + additionalProperties: {} + description: The definition of `ComponentProperties` object. + properties: + children: + description: The `ComponentProperties` `children`. + items: + $ref: '#/components/schemas/Component' + type: array + isVisible: + $ref: '#/components/schemas/ComponentPropertiesIsVisible' + type: object + ComponentPropertiesIsVisible: + description: The definition of `ComponentPropertiesIsVisible` object. + oneOf: + - type: boolean + - description: If a string, it should be a valid JavaScript expression that + evaluates to a boolean. + example: ${true} + type: string + ComponentType: + description: The definition of `ComponentType` object. + enum: + - table + - textInput + - textArea + - button + - text + - select + - modal + - schemaForm + - checkbox + - tabs + - vegaChart + - radioButtons + - numberInput + - fileInput + - jsonInput + - gridCell + - dateRangePicker + - search + - container + - calloutValue + example: table + type: string + x-enum-varnames: + - TABLE + - TEXTINPUT + - TEXTAREA + - BUTTON + - TEXT + - SELECT + - MODAL + - SCHEMAFORM + - CHECKBOX + - TABS + - VEGACHART + - RADIOBUTTONS + - NUMBERINPUT + - FILEINPUT + - JSONINPUT + - GRIDCELL + - DATERANGEPICKER + - SEARCH + - CONTAINER + - CALLOUTVALUE ConfluentAccountCreateRequest: description: Payload schema when adding a Confluent account. properties: @@ -6529,6 +6814,132 @@ components: type: string x-enum-varnames: - COST_BY_ORG + CreateAppRequest: + description: The definition of `CreateAppRequest` object. + example: + data: + attributes: + components: + - events: [] + name: grid0 + properties: + children: + - events: [] + name: gridCell0 + properties: + children: + - events: [] + name: calloutValue0 + properties: + isDisabled: false + isLoading: false + isVisible: true + label: CPU Usage + size: sm + style: vivid_yellow + unit: kB + value: '42' + type: calloutValue + isVisible: 'true' + layout: + default: + height: 8 + width: 2 + x: 0 + y: 0 + type: gridCell + type: grid + description: This is a simple example app + embeddedQueries: [] + name: Example App + rootInstanceName: grid0 + type: appDefinitions + properties: + data: + $ref: '#/components/schemas/CreateAppRequestData' + type: object + CreateAppRequestData: + description: The definition of `CreateAppRequestData` object. + properties: + attributes: + $ref: '#/components/schemas/CreateAppRequestDataAttributes' + type: + $ref: '#/components/schemas/CreateAppRequestDataType' + required: + - type + type: object + CreateAppRequestDataAttributes: + description: The definition of `CreateAppRequestDataAttributes` object. + properties: + components: + description: The `attributes` `components`. + items: + $ref: '#/components/schemas/ComponentGrid' + type: array + description: + description: The `attributes` `description`. + type: string + embeddedQueries: + description: The `attributes` `embeddedQueries`. + items: + $ref: '#/components/schemas/Query' + type: array + inputSchema: + $ref: '#/components/schemas/InputSchema' + name: + description: The `attributes` `name`. + type: string + rootInstanceName: + description: The `attributes` `rootInstanceName`. + type: string + scripts: + description: The `attributes` `scripts`. + items: + $ref: '#/components/schemas/Script' + type: array + tags: + description: The `attributes` `tags`. + items: + type: string + type: array + type: object + CreateAppRequestDataType: + default: appDefinitions + description: The definition of `CreateAppRequestDataType` object. + enum: + - appDefinitions + example: appDefinitions + type: string + x-enum-varnames: + - APPDEFINITIONS + CreateAppResponse: + description: The definition of `CreateAppResponse` object. + properties: + data: + $ref: '#/components/schemas/CreateAppResponseData' + type: object + CreateAppResponseData: + description: The definition of `CreateAppResponseData` object. + properties: + id: + description: The `data` `id`. + example: '' + type: string + type: + $ref: '#/components/schemas/CreateAppResponseDataType' + required: + - id + - type + type: object + CreateAppResponseDataType: + default: appDefinitions + description: The definition of `CreateAppResponseDataType` object. + enum: + - appDefinitions + example: appDefinitions + type: string + x-enum-varnames: + - APPDEFINITIONS CreateDataDeletionRequestBody: description: Object needed to create a data deletion request. properties: @@ -6748,6 +7159,44 @@ components: meta: $ref: '#/components/schemas/CSMAgentsMetadata' type: object + CustomConnection: + description: The definition of `CustomConnection` object. + properties: + attributes: + $ref: '#/components/schemas/CustomConnectionAttributes' + id: + description: The `CustomConnection` `id`. + type: string + type: + $ref: '#/components/schemas/CustomConnectionType' + type: object + CustomConnectionAttributes: + description: The definition of `CustomConnectionAttributes` object. + properties: + name: + description: The `attributes` `name`. + type: string + onPremRunner: + $ref: '#/components/schemas/CustomConnectionAttributesOnPremRunner' + type: object + CustomConnectionAttributesOnPremRunner: + description: The definition of `CustomConnectionAttributesOnPremRunner` object. + properties: + id: + description: The `onPremRunner` `id`. + type: string + url: + description: The `onPremRunner` `url`. + type: string + type: object + CustomConnectionType: + default: custom_connections + description: The definition of `CustomConnectionType` object. + enum: + - custom_connections + type: string + x-enum-varnames: + - CUSTOM_CONNECTIONS CustomCostGetResponseMeta: description: Meta for the response from the Get Custom Costs endpoints. properties: @@ -8129,6 +8578,270 @@ components: type: number type: array type: object + DeleteAppResponse: + description: The definition of `DeleteAppResponse` object. + properties: + data: + $ref: '#/components/schemas/DeleteAppResponseData' + type: object + DeleteAppResponseData: + description: The definition of `DeleteAppResponseData` object. + properties: + id: + description: The `data` `id`. + example: '' + type: string + type: + $ref: '#/components/schemas/DeleteAppResponseDataType' + required: + - id + - type + type: object + DeleteAppResponseDataType: + default: appDefinitions + description: The definition of `DeleteAppResponseDataType` object. + enum: + - appDefinitions + example: appDefinitions + type: string + x-enum-varnames: + - APPDEFINITIONS + DeleteAppsRequest: + description: The definition of `DeleteAppsRequest` object. + example: + data: + - id: 29494ddd-ac13-46a7-8558-b05b050ee755 + type: appDefinitions + - id: 71c0d358-eac5-41e3-892d-a7467571b9b0 + type: appDefinitions + - id: 98e7e44d-1562-474a-90f7-3a94e739c006 + type: appDefinitions + properties: + data: + description: The `DeleteAppsRequest` `data`. + items: + $ref: '#/components/schemas/DeleteAppsRequestDataItems' + type: array + type: object + DeleteAppsRequestDataItems: + description: The definition of `DeleteAppsRequestDataItems` object. + properties: + id: + description: The `items` `id`. + example: '' + type: string + type: + $ref: '#/components/schemas/DeleteAppsRequestDataItemsType' + required: + - id + - type + type: object + DeleteAppsRequestDataItemsType: + default: appDefinitions + description: The definition of `DeleteAppsRequestDataItemsType` object. + enum: + - appDefinitions + example: appDefinitions + type: string + x-enum-varnames: + - APPDEFINITIONS + DeleteAppsResponse: + description: The definition of `DeleteAppsResponse` object. + properties: + data: + description: The `DeleteAppsResponse` `data`. + items: + $ref: '#/components/schemas/DeleteAppsResponseDataItems' + type: array + type: object + DeleteAppsResponseDataItems: + description: The definition of `DeleteAppsResponseDataItems` object. + properties: + id: + description: The `items` `id`. + example: '' + type: string + type: + $ref: '#/components/schemas/DeleteAppsResponseDataItemsType' + required: + - id + - type + type: object + DeleteAppsResponseDataItemsType: + default: appDefinitions + description: The definition of `DeleteAppsResponseDataItemsType` object. + enum: + - appDefinitions + example: appDefinitions + type: string + x-enum-varnames: + - APPDEFINITIONS + DeployAppResponse: + description: The definition of `DeployAppResponse` object. + properties: + data: + $ref: '#/components/schemas/DeployAppResponseData' + type: object + DeployAppResponseData: + description: The definition of `DeployAppResponseData` object. + properties: + attributes: + $ref: '#/components/schemas/DeployAppResponseDataAttributes' + id: + description: The `data` `id`. + type: string + meta: + $ref: '#/components/schemas/DeploymentMeta' + type: + $ref: '#/components/schemas/DeployAppResponseDataType' + type: object + DeployAppResponseDataAttributes: + description: The definition of `DeployAppResponseDataAttributes` object. + properties: + app_version_id: + description: The `attributes` `app_version_id`. + type: string + type: object + DeployAppResponseDataType: + default: deployment + description: The definition of `DeployAppResponseDataType` object. + enum: + - deployment + type: string + x-enum-varnames: + - DEPLOYMENT + Deployment: + description: The definition of `Deployment` object. + properties: + attributes: + $ref: '#/components/schemas/DeploymentAttributes' + id: + description: The `Deployment` `id`. + type: string + meta: + $ref: '#/components/schemas/DeploymentMeta' + type: + $ref: '#/components/schemas/DeploymentType' + type: object + DeploymentAttributes: + description: The definition of `DeploymentAttributes` object. + properties: + app_version_id: + description: The `attributes` `app_version_id`. + type: string + type: object + DeploymentIncluded: + description: The definition of `DeploymentIncluded` object. + properties: + attributes: + $ref: '#/components/schemas/DeploymentIncludedAttributes' + id: + description: The `DeploymentIncluded` `id`. + type: string + meta: + $ref: '#/components/schemas/DeploymentIncludedMeta' + type: + $ref: '#/components/schemas/DeploymentIncludedType' + type: object + DeploymentIncludedAttributes: + description: The definition of `DeploymentIncludedAttributes` object. + properties: + app_version_id: + description: The `attributes` `app_version_id`. + type: string + type: object + DeploymentIncludedMeta: + description: The definition of `DeploymentIncludedMeta` object. + properties: + created_at: + description: The `meta` `created_at`. + type: string + user_id: + description: The `meta` `user_id`. + format: int64 + type: integer + user_name: + description: The `meta` `user_name`. + type: string + user_uuid: + description: The `meta` `user_uuid`. + type: string + type: object + DeploymentIncludedType: + default: deployment + description: The definition of `DeploymentIncludedType` object. + enum: + - deployment + type: string + x-enum-varnames: + - DEPLOYMENT + DeploymentMeta: + description: The definition of `DeploymentMeta` object. + properties: + created_at: + description: The `DeploymentMeta` `created_at`. + type: string + user_id: + description: The `DeploymentMeta` `user_id`. + format: int64 + type: integer + user_name: + description: The `DeploymentMeta` `user_name`. + type: string + user_uuid: + description: The `DeploymentMeta` `user_uuid`. + type: string + type: object + DeploymentRelationship: + description: The definition of `DeploymentRelationship` object. + properties: + data: + $ref: '#/components/schemas/DeploymentRelationshipData' + meta: + $ref: '#/components/schemas/DeploymentRelationshipMeta' + type: object + DeploymentRelationshipData: + description: The definition of `DeploymentRelationshipData` object. + properties: + id: + description: The `data` `id`. + type: string + type: + $ref: '#/components/schemas/DeploymentRelationshipDataType' + type: object + DeploymentRelationshipDataType: + default: deployment + description: The definition of `DeploymentRelationshipDataType` object. + enum: + - deployment + type: string + x-enum-varnames: + - DEPLOYMENT + DeploymentRelationshipMeta: + description: The definition of `DeploymentRelationshipMeta` object. + properties: + created_at: + description: The `meta` `created_at`. + type: string + user_id: + description: The `meta` `user_id`. + format: int64 + type: integer + user_name: + description: The `meta` `user_name`. + type: string + user_uuid: + description: The `meta` `user_uuid`. + type: string + type: object + DeploymentType: + default: deployment + description: The definition of `DeploymentType` object. + enum: + - deployment + type: string + x-enum-varnames: + - DEPLOYMENT DetailedFinding: description: A single finding with with message and resource configuration. properties: @@ -8312,6 +9025,40 @@ components: description: The type of the resource. The value should always be device. type: string type: object + DisableAppResponse: + description: The definition of `DisableAppResponse` object. + properties: + data: + $ref: '#/components/schemas/DisableAppResponseData' + type: object + DisableAppResponseData: + description: The definition of `DisableAppResponseData` object. + properties: + attributes: + $ref: '#/components/schemas/DisableAppResponseDataAttributes' + id: + description: The `data` `id`. + type: string + meta: + $ref: '#/components/schemas/DeploymentMeta' + type: + $ref: '#/components/schemas/DisableAppResponseDataType' + type: object + DisableAppResponseDataAttributes: + description: The definition of `DisableAppResponseDataAttributes` object. + properties: + app_version_id: + description: The `attributes` `app_version_id`. + type: string + type: object + DisableAppResponseDataType: + default: deployment + description: The definition of `DisableAppResponseDataType` object. + enum: + - deployment + type: string + x-enum-varnames: + - DEPLOYMENT DomainAllowlist: description: The email domain allowlist for an org. properties: @@ -11092,6 +11839,95 @@ components: type: string x-enum-varnames: - GCP_SERVICE_ACCOUNT + GetAppResponse: + description: The definition of `GetAppResponse` object. + properties: + data: + $ref: '#/components/schemas/GetAppResponseData' + included: + description: The `GetAppResponse` `included`. + items: + $ref: '#/components/schemas/DeploymentIncluded' + type: array + meta: + $ref: '#/components/schemas/AppMeta' + relationship: + $ref: '#/components/schemas/GetAppResponseRelationship' + type: object + GetAppResponseData: + description: The definition of `GetAppResponseData` object. + properties: + attributes: + $ref: '#/components/schemas/GetAppResponseDataAttributes' + id: + description: The `data` `id`. + example: '' + type: string + type: + $ref: '#/components/schemas/GetAppResponseDataType' + required: + - id + - type + - attributes + type: object + GetAppResponseDataAttributes: + description: The definition of `GetAppResponseDataAttributes` object. + properties: + components: + description: The `attributes` `components`. + items: + $ref: '#/components/schemas/ComponentGrid' + type: array + description: + description: The `attributes` `description`. + type: string + embeddedQueries: + description: The `attributes` `embeddedQueries`. + items: + $ref: '#/components/schemas/Query' + type: array + favorite: + description: The `attributes` `favorite`. + type: boolean + inputSchema: + $ref: '#/components/schemas/InputSchema' + name: + description: The `attributes` `name`. + type: string + rootInstanceName: + description: The `attributes` `rootInstanceName`. + type: string + scripts: + description: The `attributes` `scripts`. + items: + $ref: '#/components/schemas/Script' + type: array + tags: + description: The `attributes` `tags`. + items: + type: string + type: array + type: object + GetAppResponseDataType: + default: appDefinitions + description: The definition of `GetAppResponseDataType` object. + enum: + - appDefinitions + example: appDefinitions + type: string + x-enum-varnames: + - APPDEFINITIONS + GetAppResponseRelationship: + description: The definition of `GetAppResponseRelationship` object. + properties: + connections: + description: The `relationship` `connections`. + items: + $ref: '#/components/schemas/CustomConnection' + type: array + deployment: + $ref: '#/components/schemas/DeploymentRelationship' + type: object GetDataDeletionsResponseBody: description: The response from the get data deletion requests endpoint. properties: @@ -13745,6 +14581,77 @@ components: - ONCALL - INCIDENT - RELATION + InputSchema: + description: The definition of `InputSchema` object. + properties: + data: + $ref: '#/components/schemas/InputSchemaData' + type: object + InputSchemaData: + description: The definition of `InputSchemaData` object. + properties: + attributes: + $ref: '#/components/schemas/InputSchemaDataAttributes' + id: + description: The `data` `id`. + type: string + type: + $ref: '#/components/schemas/InputSchemaDataType' + type: object + InputSchemaDataAttributes: + description: The definition of `InputSchemaDataAttributes` object. + properties: + parameters: + description: The `attributes` `parameters`. + items: + $ref: '#/components/schemas/InputSchemaDataAttributesParametersItems' + type: array + type: object + InputSchemaDataAttributesParametersItems: + description: The definition of `InputSchemaDataAttributesParametersItems` object. + properties: + data: + $ref: '#/components/schemas/InputSchemaDataAttributesParametersItemsData' + type: object + InputSchemaDataAttributesParametersItemsData: + description: The definition of `InputSchemaDataAttributesParametersItemsData` + object. + properties: + attributes: + $ref: '#/components/schemas/InputSchemaDataAttributesParametersItemsDataAttributes' + type: object + InputSchemaDataAttributesParametersItemsDataAttributes: + description: The definition of `InputSchemaDataAttributesParametersItemsDataAttributes` + object. + properties: + defaultValue: + description: The `attributes` `defaultValue`. + description: + description: The `attributes` `description`. + type: string + enum: + description: The `attributes` `enum`. + items: + type: string + type: array + label: + description: The `attributes` `label`. + type: string + name: + description: The `attributes` `name`. + type: string + type: + description: The `attributes` `type`. + type: string + type: object + InputSchemaDataType: + default: inputSchema + description: The definition of `InputSchemaDataType` object. + enum: + - inputSchema + type: string + x-enum-varnames: + - INPUTSCHEMA IntakePayloadAccepted: description: The payload accepted for intake. properties: @@ -14130,6 +15037,96 @@ components: meta: $ref: '#/components/schemas/ApplicationKeyResponseMeta' type: object + ListAppsResponse: + description: The definition of `ListAppsResponse` object. + properties: + data: + description: The `ListAppsResponse` `data`. + items: + $ref: '#/components/schemas/ListAppsResponseDataItems' + type: array + included: + description: The `ListAppsResponse` `included`. + items: + $ref: '#/components/schemas/DeploymentIncluded' + type: array + meta: + $ref: '#/components/schemas/ListAppsResponseMeta' + type: object + ListAppsResponseDataItems: + description: The definition of `ListAppsResponseDataItems` object. + properties: + attributes: + $ref: '#/components/schemas/ListAppsResponseDataItemsAttributes' + id: + description: The `items` `id`. + example: '' + type: string + meta: + $ref: '#/components/schemas/AppMeta' + relationships: + $ref: '#/components/schemas/ListAppsResponseDataItemsRelationships' + type: + $ref: '#/components/schemas/ListAppsResponseDataItemsType' + required: + - id + - type + - attributes + type: object + ListAppsResponseDataItemsAttributes: + description: The definition of `ListAppsResponseDataItemsAttributes` object. + properties: + description: + description: The `attributes` `description`. + type: string + favorite: + description: The `attributes` `favorite`. + type: boolean + name: + description: The `attributes` `name`. + type: string + selfService: + description: The `attributes` `selfService`. + type: boolean + tags: + description: The `attributes` `tags`. + items: + type: string + type: array + type: object + ListAppsResponseDataItemsRelationships: + description: The definition of `ListAppsResponseDataItemsRelationships` object. + properties: + deployment: + $ref: '#/components/schemas/DeploymentRelationship' + type: object + ListAppsResponseDataItemsType: + default: appDefinitions + description: The definition of `ListAppsResponseDataItemsType` object. + enum: + - appDefinitions + example: appDefinitions + type: string + x-enum-varnames: + - APPDEFINITIONS + ListAppsResponseMeta: + description: The definition of `ListAppsResponseMeta` object. + properties: + page: + $ref: '#/components/schemas/ListAppsResponseMetaPage' + type: object + ListAppsResponseMetaPage: + description: The definition of `ListAppsResponseMetaPage` object. + properties: + totalCount: + description: The `page` `totalCount`. + format: int64 + type: integer + totalFilteredCount: + description: The `page` `totalFilteredCount`. + format: int64 + type: integer + type: object ListDevicesResponse: description: List devices response. properties: @@ -18908,6 +19905,31 @@ components: $ref: '#/components/schemas/Project' type: array type: object + Query: + description: The definition of `Query` object. + properties: + events: + description: The `Query` `events`. + items: + $ref: '#/components/schemas/AppBuilderEvent' + type: array + id: + description: The `Query` `id`. + example: '' + type: string + name: + description: The `Query` `name`. + example: '' + type: string + properties: + description: The `Query` `properties`. + type: + $ref: '#/components/schemas/QueryType' + required: + - id + - name + - type + type: object QueryFormula: description: A formula for calculation based on one or more queries. properties: @@ -18931,6 +19953,18 @@ components: x-enum-varnames: - ASC - DESC + QueryType: + description: The definition of `QueryType` object. + enum: + - action + - stateVariable + - dataTransform + example: action + type: string + x-enum-varnames: + - ACTION + - STATEVARIABLE + - DATATRANSFORM RUMAggregateBucketValue: description: A bucket value, can be either a timeseries or a single value. oneOf: @@ -21465,6 +22499,44 @@ components: type: string x-enum-varnames: - SCORECARD + Script: + description: The definition of `Script` object. + properties: + data: + $ref: '#/components/schemas/ScriptData' + type: object + ScriptData: + description: The definition of `ScriptData` object. + properties: + attributes: + $ref: '#/components/schemas/ScriptDataAttributes' + id: + description: The `data` `id`. + type: string + type: + $ref: '#/components/schemas/ScriptDataType' + type: object + ScriptDataAttributes: + description: The definition of `ScriptDataAttributes` object. + properties: + name: + description: The `attributes` `name`. + type: string + src: + description: The `attributes` `src`. + type: string + type: + description: The `attributes` `type`. + type: string + type: object + ScriptDataType: + default: scripts + description: The definition of `ScriptDataType` object. + enum: + - scripts + type: string + x-enum-varnames: + - SCRIPTS SecurityFilter: description: The security filter's properties. properties: @@ -27058,6 +28130,197 @@ components: example: min type: string type: object + UpdateAppRequest: + description: The definition of `UpdateAppRequest` object. + example: + data: + attributes: + components: + - events: [] + name: grid0 + properties: + children: + - events: [] + name: gridCell0 + properties: + children: + - events: [] + name: calloutValue0 + properties: + isDisabled: false + isLoading: false + isVisible: true + label: CPU Usage + size: sm + style: vivid_yellow + unit: kB + value: '42' + type: calloutValue + isVisible: 'true' + layout: + default: + height: 8 + width: 2 + x: 0 + y: 0 + type: gridCell + type: grid + description: This is a simple example app + embeddedQueries: [] + name: Example App + rootInstanceName: grid0 + id: 9e20cbaf-68da-45a6-9ccf-54193ac29fa5 + type: appDefinitions + properties: + data: + $ref: '#/components/schemas/UpdateAppRequestData' + type: object + UpdateAppRequestData: + description: The definition of `UpdateAppRequestData` object. + properties: + attributes: + $ref: '#/components/schemas/UpdateAppRequestDataAttributes' + id: + description: The `data` `id`. + type: string + type: + $ref: '#/components/schemas/UpdateAppRequestDataType' + required: + - type + type: object + UpdateAppRequestDataAttributes: + description: The definition of `UpdateAppRequestDataAttributes` object. + properties: + components: + description: The `attributes` `components`. + items: + $ref: '#/components/schemas/ComponentGrid' + type: array + description: + description: The `attributes` `description`. + type: string + embeddedQueries: + description: The `attributes` `embeddedQueries`. + items: + $ref: '#/components/schemas/Query' + type: array + inputSchema: + $ref: '#/components/schemas/InputSchema' + name: + description: The `attributes` `name`. + type: string + rootInstanceName: + description: The `attributes` `rootInstanceName`. + type: string + scripts: + description: The `attributes` `scripts`. + items: + $ref: '#/components/schemas/Script' + type: array + tags: + description: The `attributes` `tags`. + items: + type: string + type: array + type: object + UpdateAppRequestDataType: + default: appDefinitions + description: The definition of `UpdateAppRequestDataType` object. + enum: + - appDefinitions + example: appDefinitions + type: string + x-enum-varnames: + - APPDEFINITIONS + UpdateAppResponse: + description: The definition of `UpdateAppResponse` object. + properties: + data: + $ref: '#/components/schemas/UpdateAppResponseData' + included: + description: The `UpdateAppResponse` `included`. + items: + $ref: '#/components/schemas/DeploymentIncluded' + type: array + meta: + $ref: '#/components/schemas/AppMeta' + relationship: + $ref: '#/components/schemas/UpdateAppResponseRelationship' + type: object + UpdateAppResponseData: + description: The definition of `UpdateAppResponseData` object. + properties: + attributes: + $ref: '#/components/schemas/UpdateAppResponseDataAttributes' + id: + description: The `data` `id`. + example: '' + type: string + type: + $ref: '#/components/schemas/UpdateAppResponseDataType' + required: + - id + - type + - attributes + type: object + UpdateAppResponseDataAttributes: + description: The definition of `UpdateAppResponseDataAttributes` object. + properties: + components: + description: The `attributes` `components`. + items: + $ref: '#/components/schemas/ComponentGrid' + type: array + description: + description: The `attributes` `description`. + type: string + embeddedQueries: + description: The `attributes` `embeddedQueries`. + items: + $ref: '#/components/schemas/Query' + type: array + favorite: + description: The `attributes` `favorite`. + type: boolean + inputSchema: + $ref: '#/components/schemas/InputSchema' + name: + description: The `attributes` `name`. + type: string + rootInstanceName: + description: The `attributes` `rootInstanceName`. + type: string + scripts: + description: The `attributes` `scripts`. + items: + $ref: '#/components/schemas/Script' + type: array + tags: + description: The `attributes` `tags`. + items: + type: string + type: array + type: object + UpdateAppResponseDataType: + default: appDefinitions + description: The definition of `UpdateAppResponseDataType` object. + enum: + - appDefinitions + example: appDefinitions + type: string + x-enum-varnames: + - APPDEFINITIONS + UpdateAppResponseRelationship: + description: The definition of `UpdateAppResponseRelationship` object. + properties: + connections: + description: The `relationship` `connections`. + items: + $ref: '#/components/schemas/CustomConnection' + type: array + deployment: + $ref: '#/components/schemas/DeploymentRelationship' + type: object UpdateOpenAPIResponse: description: Response for `UpdateOpenAPI`. properties: @@ -28816,6 +30079,430 @@ paths: permissions: - apm_retention_filter_write - apm_pipelines_write + /api/v2/app-builder/apps: + delete: + description: Delete multiple apps by ID + operationId: DeleteApps + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteAppsRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteAppsResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Forbidden, e.g. missing permissions to delete one or more apps + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Delete Multiple Apps + tags: + - Apps + x-permission: + operator: OR + permissions: + - apps_write + x-unstable: '**Note**: App Builder API endpoints are still under active development + and may change at any time.' + get: + description: List all apps, with optional filters and sorting + operationId: ListApps + parameters: + - description: The number of apps to return per page + in: query + name: limit + required: false + schema: + format: int64 + type: integer + - description: The page number to return + in: query + name: page + required: false + schema: + format: int64 + type: integer + - description: The `AppsFilter` `user_name`. + in: query + name: filter[user_name] + required: false + schema: + type: string + - description: The `AppsFilter` `user_uuid`. + in: query + name: filter[user_uuid] + required: false + schema: + type: string + - description: The `AppsFilter` `name`. + in: query + name: filter[name] + required: false + schema: + type: string + - description: The `AppsFilter` `query`. + in: query + name: filter[query] + required: false + schema: + type: string + - description: The `AppsFilter` `deployed`. + in: query + name: filter[deployed] + required: false + schema: + type: boolean + - description: The `AppsFilter` `tags`. + in: query + name: filter[tags] + required: false + schema: + type: string + - description: The `AppsFilter` `favorite`. + in: query + name: filter[favorite] + required: false + schema: + type: boolean + - explode: false + in: query + name: sort + required: false + schema: + items: + $ref: '#/components/schemas/AppsSortField' + type: array + style: form + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ListAppsResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Bad Request, e.g. invalid sort parameter + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: List Apps + tags: + - Apps + x-permission: + operator: OR + permissions: + - apps_run + x-unstable: '**Note**: App Builder API endpoints are still under active development + and may change at any time.' + post: + description: Create a new app, returning the app ID + operationId: CreateApp + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateAppRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/CreateAppResponse' + description: App Created + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Forbidden, e.g. missing required permissions to a connection + or workflow used in the app + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Create App + tags: + - Apps + x-permission: + operator: AND + permissions: + - apps_write + - connections_resolve + - workflows_run + x-unstable: '**Note**: App Builder API endpoints are still under active development + and may change at any time.' + /api/v2/app-builder/apps/{app_id}: + delete: + description: Delete an app by ID + operationId: DeleteApp + parameters: + - in: path + name: app_id + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteAppResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Not Found + '410': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Gone + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Delete App + tags: + - Apps + x-permission: + operator: OR + permissions: + - apps_write + x-unstable: '**Note**: App Builder API endpoints are still under active development + and may change at any time.' + get: + description: Get the full definition of an app by ID + operationId: GetApp + parameters: + - in: path + name: app_id + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/GetAppResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get App + tags: + - Apps + x-permission: + operator: AND + permissions: + - apps_run + - connections_read + x-unstable: '**Note**: App Builder API endpoints are still under active development + and may change at any time.' + patch: + description: Update an existing app by ID. Creates a new version of the app + operationId: UpdateApp + parameters: + - in: path + name: app_id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateAppRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateAppResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Forbidden, e.g. missing required permissions to a connection + or workflow used in the app + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Update App + tags: + - Apps + x-permission: + operator: AND + permissions: + - apps_write + - connections_resolve + - workflows_run + x-unstable: '**Note**: App Builder API endpoints are still under active development + and may change at any time.' + /api/v2/app-builder/apps/{app_id}/deployment: + delete: + description: Disable an app by ID + operationId: DisableApp + parameters: + - in: path + name: app_id + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DisableAppResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Disable App + tags: + - App Deployment + x-permission: + operator: OR + permissions: + - apps_write + x-unstable: '**Note**: App Builder API endpoints are still under active development + and may change at any time.' + post: + description: Deploy (publish) an app by ID + operationId: DeployApp + parameters: + - in: path + name: app_id + required: true + schema: + type: string + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/DeployAppResponse' + description: Created + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/AppBuilderError' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Deploy App + tags: + - App Deployment + x-permission: + operator: OR + permissions: + - apps_write + x-unstable: '**Note**: App Builder API endpoints are still under active development + and may change at any time.' /api/v2/application_keys: get: description: List all application keys available for your org @@ -44843,6 +46530,10 @@ tags: externalDocs: url: https://docs.datadoghq.com/integrations/amazon_web_services/#log-collection name: AWS Logs Integration +- description: Deploy and disable apps in App Builder. + name: App Deployment +- description: Create, read, update, and delete apps in App Builder. + name: Apps - description: Search your Audit Logs events over HTTP. name: Audit - description: '[The AuthN Mappings API](https://docs.datadoghq.com/account_management/authn_mapping/?tab=example) diff --git a/examples/v2_app-deployment_DeployApp.rs b/examples/v2_app-deployment_DeployApp.rs new file mode 100644 index 000000000..27dd9dcdd --- /dev/null +++ b/examples/v2_app-deployment_DeployApp.rs @@ -0,0 +1,18 @@ +// Deploy App returns "Created" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_app_deployment::AppDeploymentAPI; + +#[tokio::main] +async fn main() { + // there is a valid "app" in the system + let app_data_id = std::env::var("APP_DATA_ID").unwrap(); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.DeployApp", true); + let api = AppDeploymentAPI::with_config(configuration); + let resp = api.deploy_app(app_data_id.clone()).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_app-deployment_DisableApp.rs b/examples/v2_app-deployment_DisableApp.rs new file mode 100644 index 000000000..d12e7c6c5 --- /dev/null +++ b/examples/v2_app-deployment_DisableApp.rs @@ -0,0 +1,18 @@ +// Disable App returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_app_deployment::AppDeploymentAPI; + +#[tokio::main] +async fn main() { + // there is a valid "app" in the system + let app_data_id = std::env::var("APP_DATA_ID").unwrap(); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.DisableApp", true); + let api = AppDeploymentAPI::with_config(configuration); + let resp = api.disable_app(app_data_id.clone()).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_apps_CreateApp.rs b/examples/v2_apps_CreateApp.rs new file mode 100644 index 000000000..8a7eb8516 --- /dev/null +++ b/examples/v2_apps_CreateApp.rs @@ -0,0 +1,55 @@ +// Create App returns "App Created" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_apps::AppsAPI; +use datadog_api_client::datadogV2::model::Component; +use datadog_api_client::datadogV2::model::ComponentGrid; +use datadog_api_client::datadogV2::model::ComponentGridProperties; +use datadog_api_client::datadogV2::model::ComponentGridType; +use datadog_api_client::datadogV2::model::ComponentProperties; +use datadog_api_client::datadogV2::model::ComponentPropertiesIsVisible; +use datadog_api_client::datadogV2::model::ComponentType; +use datadog_api_client::datadogV2::model::CreateAppRequest; +use datadog_api_client::datadogV2::model::CreateAppRequestData; +use datadog_api_client::datadogV2::model::CreateAppRequestDataAttributes; +use datadog_api_client::datadogV2::model::CreateAppRequestDataType; + +#[tokio::main] +async fn main() { + let body = CreateAppRequest::new().data( + CreateAppRequestData::new(CreateAppRequestDataType::APPDEFINITIONS).attributes( + CreateAppRequestDataAttributes::new() + .components(vec![ComponentGrid::new( + "grid0".to_string(), + ComponentGridProperties::new().children(vec![Component::new( + "gridCell0".to_string(), + ComponentProperties::new() + .children(vec![Component::new( + "calloutValue0".to_string(), + ComponentProperties::new() + .is_visible(ComponentPropertiesIsVisible::Bool(true)), + ComponentType::CALLOUTVALUE, + ) + .events(vec![])]) + .is_visible(ComponentPropertiesIsVisible::String("true".to_string())), + ComponentType::GRIDCELL, + ) + .events(vec![])]), + ComponentGridType::GRID, + ) + .events(vec![])]) + .description("This is a simple example app".to_string()) + .embedded_queries(vec![]) + .name("Example App".to_string()) + .root_instance_name("grid0".to_string()), + ), + ); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.CreateApp", true); + let api = AppsAPI::with_config(configuration); + let resp = api.create_app(body).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_apps_DeleteApp.rs b/examples/v2_apps_DeleteApp.rs new file mode 100644 index 000000000..43eb44227 --- /dev/null +++ b/examples/v2_apps_DeleteApp.rs @@ -0,0 +1,18 @@ +// Delete App returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_apps::AppsAPI; + +#[tokio::main] +async fn main() { + // there is a valid "app" in the system + let app_data_id = std::env::var("APP_DATA_ID").unwrap(); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.DeleteApp", true); + let api = AppsAPI::with_config(configuration); + let resp = api.delete_app(app_data_id.clone()).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_apps_DeleteApps.rs b/examples/v2_apps_DeleteApps.rs new file mode 100644 index 000000000..59491dd2a --- /dev/null +++ b/examples/v2_apps_DeleteApps.rs @@ -0,0 +1,25 @@ +// Delete Multiple Apps returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_apps::AppsAPI; +use datadog_api_client::datadogV2::model::DeleteAppsRequest; +use datadog_api_client::datadogV2::model::DeleteAppsRequestDataItems; +use datadog_api_client::datadogV2::model::DeleteAppsRequestDataItemsType; + +#[tokio::main] +async fn main() { + // there is a valid "app" in the system + let app_data_id = std::env::var("APP_DATA_ID").unwrap(); + let body = DeleteAppsRequest::new().data(vec![DeleteAppsRequestDataItems::new( + app_data_id.clone(), + DeleteAppsRequestDataItemsType::APPDEFINITIONS, + )]); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.DeleteApps", true); + let api = AppsAPI::with_config(configuration); + let resp = api.delete_apps(body).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_apps_GetApp.rs b/examples/v2_apps_GetApp.rs new file mode 100644 index 000000000..0cd550bf5 --- /dev/null +++ b/examples/v2_apps_GetApp.rs @@ -0,0 +1,18 @@ +// Get App returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_apps::AppsAPI; + +#[tokio::main] +async fn main() { + // there is a valid "app" in the system + let app_data_id = std::env::var("APP_DATA_ID").unwrap(); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.GetApp", true); + let api = AppsAPI::with_config(configuration); + let resp = api.get_app(app_data_id.clone()).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_apps_ListApps.rs b/examples/v2_apps_ListApps.rs new file mode 100644 index 000000000..7d6d3bf9d --- /dev/null +++ b/examples/v2_apps_ListApps.rs @@ -0,0 +1,17 @@ +// List Apps returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_apps::AppsAPI; +use datadog_api_client::datadogV2::api_apps::ListAppsOptionalParams; + +#[tokio::main] +async fn main() { + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.ListApps", true); + let api = AppsAPI::with_config(configuration); + let resp = api.list_apps(ListAppsOptionalParams::default()).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_apps_UpdateApp.rs b/examples/v2_apps_UpdateApp.rs new file mode 100644 index 000000000..b04fc833a --- /dev/null +++ b/examples/v2_apps_UpdateApp.rs @@ -0,0 +1,31 @@ +// Update App returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_apps::AppsAPI; +use datadog_api_client::datadogV2::model::UpdateAppRequest; +use datadog_api_client::datadogV2::model::UpdateAppRequestData; +use datadog_api_client::datadogV2::model::UpdateAppRequestDataAttributes; +use datadog_api_client::datadogV2::model::UpdateAppRequestDataType; + +#[tokio::main] +async fn main() { + // there is a valid "app" in the system + let app_data_id = std::env::var("APP_DATA_ID").unwrap(); + let body = UpdateAppRequest::new().data( + UpdateAppRequestData::new(UpdateAppRequestDataType::APPDEFINITIONS) + .attributes( + UpdateAppRequestDataAttributes::new() + .name("Updated Name".to_string()) + .root_instance_name("grid0".to_string()), + ) + .id(app_data_id.clone()), + ); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.UpdateApp", true); + let api = AppsAPI::with_config(configuration); + let resp = api.update_app(app_data_id.clone(), body).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/src/datadog/configuration.rs b/src/datadog/configuration.rs index fd4e835fe..1267592cb 100644 --- a/src/datadog/configuration.rs +++ b/src/datadog/configuration.rs @@ -134,6 +134,14 @@ impl Default for Configuration { ("v2.get_open_api".to_owned(), false), ("v2.list_apis".to_owned(), false), ("v2.update_open_api".to_owned(), false), + ("v2.create_app".to_owned(), false), + ("v2.delete_app".to_owned(), false), + ("v2.delete_apps".to_owned(), false), + ("v2.get_app".to_owned(), false), + ("v2.list_apps".to_owned(), false), + ("v2.update_app".to_owned(), false), + ("v2.deploy_app".to_owned(), false), + ("v2.disable_app".to_owned(), false), ("v2.get_active_billing_dimensions".to_owned(), false), ("v2.get_billing_dimension_mapping".to_owned(), false), ("v2.get_monthly_cost_attribution".to_owned(), false), diff --git a/src/datadogV2/api/api_app_deployment.rs b/src/datadogV2/api/api_app_deployment.rs new file mode 100644 index 000000000..8f61c3185 --- /dev/null +++ b/src/datadogV2/api/api_app_deployment.rs @@ -0,0 +1,316 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use crate::datadog; +use log::warn; +use reqwest::header::{HeaderMap, HeaderValue}; +use serde::{Deserialize, Serialize}; + +/// DeployAppError is a struct for typed errors of method [`AppDeploymentAPI::deploy_app`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DeployAppError { + AppBuilderError(crate::datadogV2::model::AppBuilderError), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// DisableAppError is a struct for typed errors of method [`AppDeploymentAPI::disable_app`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DisableAppError { + AppBuilderError(crate::datadogV2::model::AppBuilderError), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// Deploy and disable apps in App Builder. +#[derive(Debug, Clone)] +pub struct AppDeploymentAPI { + config: datadog::Configuration, + client: reqwest_middleware::ClientWithMiddleware, +} + +impl Default for AppDeploymentAPI { + fn default() -> Self { + Self::with_config(datadog::Configuration::default()) + } +} + +impl AppDeploymentAPI { + pub fn new() -> Self { + Self::default() + } + pub fn with_config(config: datadog::Configuration) -> Self { + let mut reqwest_client_builder = reqwest::Client::builder(); + + if let Some(proxy_url) = &config.proxy_url { + let proxy = reqwest::Proxy::all(proxy_url).expect("Failed to parse proxy URL"); + reqwest_client_builder = reqwest_client_builder.proxy(proxy); + } + + let mut middleware_client_builder = + reqwest_middleware::ClientBuilder::new(reqwest_client_builder.build().unwrap()); + + if config.enable_retry { + struct RetryableStatus; + impl reqwest_retry::RetryableStrategy for RetryableStatus { + fn handle( + &self, + res: &Result, + ) -> Option { + match res { + Ok(success) => reqwest_retry::default_on_request_success(success), + Err(_) => None, + } + } + } + let backoff_policy = reqwest_retry::policies::ExponentialBackoff::builder() + .build_with_max_retries(config.max_retries); + + let retry_middleware = + reqwest_retry::RetryTransientMiddleware::new_with_policy_and_strategy( + backoff_policy, + RetryableStatus, + ); + + middleware_client_builder = middleware_client_builder.with(retry_middleware); + } + + let client = middleware_client_builder.build(); + + Self { config, client } + } + + pub fn with_client_and_config( + config: datadog::Configuration, + client: reqwest_middleware::ClientWithMiddleware, + ) -> Self { + Self { config, client } + } + + /// Deploy (publish) an app by ID + pub async fn deploy_app( + &self, + app_id: String, + ) -> Result> { + match self.deploy_app_with_http_info(app_id).await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Deploy (publish) an app by ID + pub async fn deploy_app_with_http_info( + &self, + app_id: String, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.deploy_app"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.deploy_app' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/app-builder/apps/{app_id}/deployment", + local_configuration.get_operation_host(operation_id), + app_id = datadog::urlencode(app_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::POST, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::(&local_content) + { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Disable an app by ID + pub async fn disable_app( + &self, + app_id: String, + ) -> Result> { + match self.disable_app_with_http_info(app_id).await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Disable an app by ID + pub async fn disable_app_with_http_info( + &self, + app_id: String, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.disable_app"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.disable_app' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/app-builder/apps/{app_id}/deployment", + local_configuration.get_operation_host(operation_id), + app_id = datadog::urlencode(app_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } +} diff --git a/src/datadogV2/api/api_apps.rs b/src/datadogV2/api/api_apps.rs new file mode 100644 index 000000000..3b2eac039 --- /dev/null +++ b/src/datadogV2/api/api_apps.rs @@ -0,0 +1,1078 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use crate::datadog; +use flate2::{ + write::{GzEncoder, ZlibEncoder}, + Compression, +}; +use log::warn; +use reqwest::header::{HeaderMap, HeaderValue}; +use serde::{Deserialize, Serialize}; +use std::io::Write; + +/// ListAppsOptionalParams is a struct for passing parameters to the method [`AppsAPI::list_apps`] +#[non_exhaustive] +#[derive(Clone, Default, Debug)] +pub struct ListAppsOptionalParams { + /// The number of apps to return per page + pub limit: Option, + /// The page number to return + pub page: Option, + /// The `AppsFilter` `user_name`. + pub filter_user_name: Option, + /// The `AppsFilter` `user_uuid`. + pub filter_user_uuid: Option, + /// The `AppsFilter` `name`. + pub filter_name: Option, + /// The `AppsFilter` `query`. + pub filter_query: Option, + /// The `AppsFilter` `deployed`. + pub filter_deployed: Option, + /// The `AppsFilter` `tags`. + pub filter_tags: Option, + /// The `AppsFilter` `favorite`. + pub filter_favorite: Option, + pub sort: Option>, +} + +impl ListAppsOptionalParams { + /// The number of apps to return per page + pub fn limit(mut self, value: i64) -> Self { + self.limit = Some(value); + self + } + /// The page number to return + pub fn page(mut self, value: i64) -> Self { + self.page = Some(value); + self + } + /// The `AppsFilter` `user_name`. + pub fn filter_user_name(mut self, value: String) -> Self { + self.filter_user_name = Some(value); + self + } + /// The `AppsFilter` `user_uuid`. + pub fn filter_user_uuid(mut self, value: String) -> Self { + self.filter_user_uuid = Some(value); + self + } + /// The `AppsFilter` `name`. + pub fn filter_name(mut self, value: String) -> Self { + self.filter_name = Some(value); + self + } + /// The `AppsFilter` `query`. + pub fn filter_query(mut self, value: String) -> Self { + self.filter_query = Some(value); + self + } + /// The `AppsFilter` `deployed`. + pub fn filter_deployed(mut self, value: bool) -> Self { + self.filter_deployed = Some(value); + self + } + /// The `AppsFilter` `tags`. + pub fn filter_tags(mut self, value: String) -> Self { + self.filter_tags = Some(value); + self + } + /// The `AppsFilter` `favorite`. + pub fn filter_favorite(mut self, value: bool) -> Self { + self.filter_favorite = Some(value); + self + } + pub fn sort(mut self, value: Vec) -> Self { + self.sort = Some(value); + self + } +} + +/// CreateAppError is a struct for typed errors of method [`AppsAPI::create_app`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum CreateAppError { + AppBuilderError(crate::datadogV2::model::AppBuilderError), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// DeleteAppError is a struct for typed errors of method [`AppsAPI::delete_app`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DeleteAppError { + AppBuilderError(crate::datadogV2::model::AppBuilderError), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// DeleteAppsError is a struct for typed errors of method [`AppsAPI::delete_apps`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DeleteAppsError { + AppBuilderError(crate::datadogV2::model::AppBuilderError), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// GetAppError is a struct for typed errors of method [`AppsAPI::get_app`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetAppError { + AppBuilderError(crate::datadogV2::model::AppBuilderError), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// ListAppsError is a struct for typed errors of method [`AppsAPI::list_apps`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ListAppsError { + AppBuilderError(crate::datadogV2::model::AppBuilderError), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// UpdateAppError is a struct for typed errors of method [`AppsAPI::update_app`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum UpdateAppError { + AppBuilderError(crate::datadogV2::model::AppBuilderError), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// Create, read, update, and delete apps in App Builder. +#[derive(Debug, Clone)] +pub struct AppsAPI { + config: datadog::Configuration, + client: reqwest_middleware::ClientWithMiddleware, +} + +impl Default for AppsAPI { + fn default() -> Self { + Self::with_config(datadog::Configuration::default()) + } +} + +impl AppsAPI { + pub fn new() -> Self { + Self::default() + } + pub fn with_config(config: datadog::Configuration) -> Self { + let mut reqwest_client_builder = reqwest::Client::builder(); + + if let Some(proxy_url) = &config.proxy_url { + let proxy = reqwest::Proxy::all(proxy_url).expect("Failed to parse proxy URL"); + reqwest_client_builder = reqwest_client_builder.proxy(proxy); + } + + let mut middleware_client_builder = + reqwest_middleware::ClientBuilder::new(reqwest_client_builder.build().unwrap()); + + if config.enable_retry { + struct RetryableStatus; + impl reqwest_retry::RetryableStrategy for RetryableStatus { + fn handle( + &self, + res: &Result, + ) -> Option { + match res { + Ok(success) => reqwest_retry::default_on_request_success(success), + Err(_) => None, + } + } + } + let backoff_policy = reqwest_retry::policies::ExponentialBackoff::builder() + .build_with_max_retries(config.max_retries); + + let retry_middleware = + reqwest_retry::RetryTransientMiddleware::new_with_policy_and_strategy( + backoff_policy, + RetryableStatus, + ); + + middleware_client_builder = middleware_client_builder.with(retry_middleware); + } + + let client = middleware_client_builder.build(); + + Self { config, client } + } + + pub fn with_client_and_config( + config: datadog::Configuration, + client: reqwest_middleware::ClientWithMiddleware, + ) -> Self { + Self { config, client } + } + + /// Create a new app, returning the app ID + pub async fn create_app( + &self, + body: crate::datadogV2::model::CreateAppRequest, + ) -> Result> { + match self.create_app_with_http_info(body).await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Create a new app, returning the app ID + pub async fn create_app_with_http_info( + &self, + body: crate::datadogV2::model::CreateAppRequest, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.create_app"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.create_app' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/app-builder/apps", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::POST, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::(&local_content) + { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Delete an app by ID + pub async fn delete_app( + &self, + app_id: String, + ) -> Result> { + match self.delete_app_with_http_info(app_id).await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Delete an app by ID + pub async fn delete_app_with_http_info( + &self, + app_id: String, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.delete_app"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.delete_app' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/app-builder/apps/{app_id}", + local_configuration.get_operation_host(operation_id), + app_id = datadog::urlencode(app_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::(&local_content) + { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Delete multiple apps by ID + pub async fn delete_apps( + &self, + body: crate::datadogV2::model::DeleteAppsRequest, + ) -> Result> { + match self.delete_apps_with_http_info(body).await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Delete multiple apps by ID + pub async fn delete_apps_with_http_info( + &self, + body: crate::datadogV2::model::DeleteAppsRequest, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.delete_apps"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.delete_apps' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/app-builder/apps", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Get the full definition of an app by ID + pub async fn get_app( + &self, + app_id: String, + ) -> Result> { + match self.get_app_with_http_info(app_id).await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Get the full definition of an app by ID + pub async fn get_app_with_http_info( + &self, + app_id: String, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.get_app"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.get_app' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/app-builder/apps/{app_id}", + local_configuration.get_operation_host(operation_id), + app_id = datadog::urlencode(app_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::(&local_content) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// List all apps, with optional filters and sorting + pub async fn list_apps( + &self, + params: ListAppsOptionalParams, + ) -> Result> { + match self.list_apps_with_http_info(params).await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// List all apps, with optional filters and sorting + pub async fn list_apps_with_http_info( + &self, + params: ListAppsOptionalParams, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.list_apps"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.list_apps' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + // unbox and build optional parameters + let limit = params.limit; + let page = params.page; + let filter_user_name = params.filter_user_name; + let filter_user_uuid = params.filter_user_uuid; + let filter_name = params.filter_name; + let filter_query = params.filter_query; + let filter_deployed = params.filter_deployed; + let filter_tags = params.filter_tags; + let filter_favorite = params.filter_favorite; + let sort = params.sort; + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/app-builder/apps", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + + if let Some(ref local_query_param) = limit { + local_req_builder = + local_req_builder.query(&[("limit", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = page { + local_req_builder = + local_req_builder.query(&[("page", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_user_name { + local_req_builder = + local_req_builder.query(&[("filter[user_name]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_user_uuid { + local_req_builder = + local_req_builder.query(&[("filter[user_uuid]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_name { + local_req_builder = + local_req_builder.query(&[("filter[name]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_query { + local_req_builder = + local_req_builder.query(&[("filter[query]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_deployed { + local_req_builder = + local_req_builder.query(&[("filter[deployed]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_tags { + local_req_builder = + local_req_builder.query(&[("filter[tags]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_favorite { + local_req_builder = + local_req_builder.query(&[("filter[favorite]", &local_query_param.to_string())]); + }; + if let Some(ref local) = sort { + local_req_builder = local_req_builder.query(&[( + "sort", + &local + .iter() + .map(|p| p.to_string()) + .collect::>() + .join(",") + .to_string(), + )]); + }; + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::(&local_content) + { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Update an existing app by ID. Creates a new version of the app + pub async fn update_app( + &self, + app_id: String, + body: crate::datadogV2::model::UpdateAppRequest, + ) -> Result> { + match self.update_app_with_http_info(app_id, body).await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Update an existing app by ID. Creates a new version of the app + pub async fn update_app_with_http_info( + &self, + app_id: String, + body: crate::datadogV2::model::UpdateAppRequest, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.update_app"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.update_app' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/app-builder/apps/{app_id}", + local_configuration.get_operation_host(operation_id), + app_id = datadog::urlencode(app_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::(&local_content) + { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } +} diff --git a/src/datadogV2/api/mod.rs b/src/datadogV2/api/mod.rs index 50f53757d..f69132c08 100644 --- a/src/datadogV2/api/mod.rs +++ b/src/datadogV2/api/mod.rs @@ -4,6 +4,8 @@ pub mod api_api_management; pub mod api_apm_retention_filters; +pub mod api_app_deployment; +pub mod api_apps; pub mod api_audit; pub mod api_authn_mappings; pub mod api_aws_integration; diff --git a/src/datadogV2/mod.rs b/src/datadogV2/mod.rs index f1a57ee38..a8ca64c41 100644 --- a/src/datadogV2/mod.rs +++ b/src/datadogV2/mod.rs @@ -5,6 +5,8 @@ pub mod api; pub use self::api::api_api_management; pub use self::api::api_apm_retention_filters; +pub use self::api::api_app_deployment; +pub use self::api::api_apps; pub use self::api::api_audit; pub use self::api::api_authn_mappings; pub use self::api::api_aws_integration; diff --git a/src/datadogV2/model/mod.rs b/src/datadogV2/model/mod.rs index 7a79c7644..1275261b9 100644 --- a/src/datadogV2/model/mod.rs +++ b/src/datadogV2/model/mod.rs @@ -186,6 +186,180 @@ pub mod model_retention_filter_update_data; pub use self::model_retention_filter_update_data::RetentionFilterUpdateData; pub mod model_retention_filter_update_attributes; pub use self::model_retention_filter_update_attributes::RetentionFilterUpdateAttributes; +pub mod model_delete_apps_request; +pub use self::model_delete_apps_request::DeleteAppsRequest; +pub mod model_delete_apps_request_data_items; +pub use self::model_delete_apps_request_data_items::DeleteAppsRequestDataItems; +pub mod model_delete_apps_request_data_items_type; +pub use self::model_delete_apps_request_data_items_type::DeleteAppsRequestDataItemsType; +pub mod model_delete_apps_response; +pub use self::model_delete_apps_response::DeleteAppsResponse; +pub mod model_delete_apps_response_data_items; +pub use self::model_delete_apps_response_data_items::DeleteAppsResponseDataItems; +pub mod model_delete_apps_response_data_items_type; +pub use self::model_delete_apps_response_data_items_type::DeleteAppsResponseDataItemsType; +pub mod model_app_builder_error; +pub use self::model_app_builder_error::AppBuilderError; +pub mod model_app_builder_error_errors_items; +pub use self::model_app_builder_error_errors_items::AppBuilderErrorErrorsItems; +pub mod model_app_builder_error_errors_items_source; +pub use self::model_app_builder_error_errors_items_source::AppBuilderErrorErrorsItemsSource; +pub mod model_apps_sort_field; +pub use self::model_apps_sort_field::AppsSortField; +pub mod model_list_apps_response; +pub use self::model_list_apps_response::ListAppsResponse; +pub mod model_list_apps_response_data_items; +pub use self::model_list_apps_response_data_items::ListAppsResponseDataItems; +pub mod model_list_apps_response_data_items_attributes; +pub use self::model_list_apps_response_data_items_attributes::ListAppsResponseDataItemsAttributes; +pub mod model_app_meta; +pub use self::model_app_meta::AppMeta; +pub mod model_list_apps_response_data_items_relationships; +pub use self::model_list_apps_response_data_items_relationships::ListAppsResponseDataItemsRelationships; +pub mod model_deployment_relationship; +pub use self::model_deployment_relationship::DeploymentRelationship; +pub mod model_deployment_relationship_data; +pub use self::model_deployment_relationship_data::DeploymentRelationshipData; +pub mod model_deployment_relationship_data_type; +pub use self::model_deployment_relationship_data_type::DeploymentRelationshipDataType; +pub mod model_deployment_relationship_meta; +pub use self::model_deployment_relationship_meta::DeploymentRelationshipMeta; +pub mod model_list_apps_response_data_items_type; +pub use self::model_list_apps_response_data_items_type::ListAppsResponseDataItemsType; +pub mod model_deployment_included; +pub use self::model_deployment_included::DeploymentIncluded; +pub mod model_deployment_included_attributes; +pub use self::model_deployment_included_attributes::DeploymentIncludedAttributes; +pub mod model_deployment_included_meta; +pub use self::model_deployment_included_meta::DeploymentIncludedMeta; +pub mod model_deployment_included_type; +pub use self::model_deployment_included_type::DeploymentIncludedType; +pub mod model_list_apps_response_meta; +pub use self::model_list_apps_response_meta::ListAppsResponseMeta; +pub mod model_list_apps_response_meta_page; +pub use self::model_list_apps_response_meta_page::ListAppsResponseMetaPage; +pub mod model_create_app_request; +pub use self::model_create_app_request::CreateAppRequest; +pub mod model_create_app_request_data; +pub use self::model_create_app_request_data::CreateAppRequestData; +pub mod model_create_app_request_data_attributes; +pub use self::model_create_app_request_data_attributes::CreateAppRequestDataAttributes; +pub mod model_component_grid; +pub use self::model_component_grid::ComponentGrid; +pub mod model_app_builder_event; +pub use self::model_app_builder_event::AppBuilderEvent; +pub mod model_app_builder_event_name; +pub use self::model_app_builder_event_name::AppBuilderEventName; +pub mod model_app_builder_event_type; +pub use self::model_app_builder_event_type::AppBuilderEventType; +pub mod model_component_grid_properties; +pub use self::model_component_grid_properties::ComponentGridProperties; +pub mod model_component; +pub use self::model_component::Component; +pub mod model_component_properties; +pub use self::model_component_properties::ComponentProperties; +pub mod model_component_properties_is_visible; +pub use self::model_component_properties_is_visible::ComponentPropertiesIsVisible; +pub mod model_component_type; +pub use self::model_component_type::ComponentType; +pub mod model_component_grid_properties_is_visible; +pub use self::model_component_grid_properties_is_visible::ComponentGridPropertiesIsVisible; +pub mod model_component_grid_type; +pub use self::model_component_grid_type::ComponentGridType; +pub mod model_query; +pub use self::model_query::Query; +pub mod model_query_type; +pub use self::model_query_type::QueryType; +pub mod model_input_schema; +pub use self::model_input_schema::InputSchema; +pub mod model_input_schema_data; +pub use self::model_input_schema_data::InputSchemaData; +pub mod model_input_schema_data_attributes; +pub use self::model_input_schema_data_attributes::InputSchemaDataAttributes; +pub mod model_input_schema_data_attributes_parameters_items; +pub use self::model_input_schema_data_attributes_parameters_items::InputSchemaDataAttributesParametersItems; +pub mod model_input_schema_data_attributes_parameters_items_data; +pub use self::model_input_schema_data_attributes_parameters_items_data::InputSchemaDataAttributesParametersItemsData; +pub mod model_input_schema_data_attributes_parameters_items_data_attributes; +pub use self::model_input_schema_data_attributes_parameters_items_data_attributes::InputSchemaDataAttributesParametersItemsDataAttributes; +pub mod model_input_schema_data_type; +pub use self::model_input_schema_data_type::InputSchemaDataType; +pub mod model_script; +pub use self::model_script::Script; +pub mod model_script_data; +pub use self::model_script_data::ScriptData; +pub mod model_script_data_attributes; +pub use self::model_script_data_attributes::ScriptDataAttributes; +pub mod model_script_data_type; +pub use self::model_script_data_type::ScriptDataType; +pub mod model_create_app_request_data_type; +pub use self::model_create_app_request_data_type::CreateAppRequestDataType; +pub mod model_create_app_response; +pub use self::model_create_app_response::CreateAppResponse; +pub mod model_create_app_response_data; +pub use self::model_create_app_response_data::CreateAppResponseData; +pub mod model_create_app_response_data_type; +pub use self::model_create_app_response_data_type::CreateAppResponseDataType; +pub mod model_delete_app_response; +pub use self::model_delete_app_response::DeleteAppResponse; +pub mod model_delete_app_response_data; +pub use self::model_delete_app_response_data::DeleteAppResponseData; +pub mod model_delete_app_response_data_type; +pub use self::model_delete_app_response_data_type::DeleteAppResponseDataType; +pub mod model_get_app_response; +pub use self::model_get_app_response::GetAppResponse; +pub mod model_get_app_response_data; +pub use self::model_get_app_response_data::GetAppResponseData; +pub mod model_get_app_response_data_attributes; +pub use self::model_get_app_response_data_attributes::GetAppResponseDataAttributes; +pub mod model_get_app_response_data_type; +pub use self::model_get_app_response_data_type::GetAppResponseDataType; +pub mod model_get_app_response_relationship; +pub use self::model_get_app_response_relationship::GetAppResponseRelationship; +pub mod model_custom_connection; +pub use self::model_custom_connection::CustomConnection; +pub mod model_custom_connection_attributes; +pub use self::model_custom_connection_attributes::CustomConnectionAttributes; +pub mod model_custom_connection_attributes_on_prem_runner; +pub use self::model_custom_connection_attributes_on_prem_runner::CustomConnectionAttributesOnPremRunner; +pub mod model_custom_connection_type; +pub use self::model_custom_connection_type::CustomConnectionType; +pub mod model_update_app_request; +pub use self::model_update_app_request::UpdateAppRequest; +pub mod model_update_app_request_data; +pub use self::model_update_app_request_data::UpdateAppRequestData; +pub mod model_update_app_request_data_attributes; +pub use self::model_update_app_request_data_attributes::UpdateAppRequestDataAttributes; +pub mod model_update_app_request_data_type; +pub use self::model_update_app_request_data_type::UpdateAppRequestDataType; +pub mod model_update_app_response; +pub use self::model_update_app_response::UpdateAppResponse; +pub mod model_update_app_response_data; +pub use self::model_update_app_response_data::UpdateAppResponseData; +pub mod model_update_app_response_data_attributes; +pub use self::model_update_app_response_data_attributes::UpdateAppResponseDataAttributes; +pub mod model_update_app_response_data_type; +pub use self::model_update_app_response_data_type::UpdateAppResponseDataType; +pub mod model_update_app_response_relationship; +pub use self::model_update_app_response_relationship::UpdateAppResponseRelationship; +pub mod model_disable_app_response; +pub use self::model_disable_app_response::DisableAppResponse; +pub mod model_disable_app_response_data; +pub use self::model_disable_app_response_data::DisableAppResponseData; +pub mod model_disable_app_response_data_attributes; +pub use self::model_disable_app_response_data_attributes::DisableAppResponseDataAttributes; +pub mod model_deployment_meta; +pub use self::model_deployment_meta::DeploymentMeta; +pub mod model_disable_app_response_data_type; +pub use self::model_disable_app_response_data_type::DisableAppResponseDataType; +pub mod model_deploy_app_response; +pub use self::model_deploy_app_response::DeployAppResponse; +pub mod model_deploy_app_response_data; +pub use self::model_deploy_app_response_data::DeployAppResponseData; +pub mod model_deploy_app_response_data_attributes; +pub use self::model_deploy_app_response_data_attributes::DeployAppResponseDataAttributes; +pub mod model_deploy_app_response_data_type; +pub use self::model_deploy_app_response_data_type::DeployAppResponseDataType; pub mod model_application_keys_sort; pub use self::model_application_keys_sort::ApplicationKeysSort; pub mod model_list_application_keys_response; diff --git a/src/datadogV2/model/model_app_builder_error.rs b/src/datadogV2/model/model_app_builder_error.rs new file mode 100644 index 000000000..8b2154205 --- /dev/null +++ b/src/datadogV2/model/model_app_builder_error.rs @@ -0,0 +1,109 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `AppBuilderError` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AppBuilderError { + /// The `AppBuilderError` `errors`. + #[serde(rename = "errors")] + pub errors: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AppBuilderError { + pub fn new() -> AppBuilderError { + AppBuilderError { + errors: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn errors( + mut self, + value: Vec, + ) -> Self { + self.errors = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for AppBuilderError { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for AppBuilderError { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AppBuilderErrorVisitor; + impl<'a> Visitor<'a> for AppBuilderErrorVisitor { + type Value = AppBuilderError; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut errors: Option> = + None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "errors" => { + if v.is_null() { + continue; + } + errors = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = AppBuilderError { + errors, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AppBuilderErrorVisitor) + } +} diff --git a/src/datadogV2/model/model_app_builder_error_errors_items.rs b/src/datadogV2/model/model_app_builder_error_errors_items.rs new file mode 100644 index 000000000..bd9285ad5 --- /dev/null +++ b/src/datadogV2/model/model_app_builder_error_errors_items.rs @@ -0,0 +1,126 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `AppBuilderErrorErrorsItems` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AppBuilderErrorErrorsItems { + /// The `items` `detail`. + #[serde(rename = "detail")] + pub detail: Option, + /// The definition of `AppBuilderErrorErrorsItemsSource` object. + #[serde(rename = "source")] + pub source: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AppBuilderErrorErrorsItems { + pub fn new() -> AppBuilderErrorErrorsItems { + AppBuilderErrorErrorsItems { + detail: None, + source: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn detail(mut self, value: String) -> Self { + self.detail = Some(value); + self + } + + pub fn source( + mut self, + value: crate::datadogV2::model::AppBuilderErrorErrorsItemsSource, + ) -> Self { + self.source = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for AppBuilderErrorErrorsItems { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for AppBuilderErrorErrorsItems { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AppBuilderErrorErrorsItemsVisitor; + impl<'a> Visitor<'a> for AppBuilderErrorErrorsItemsVisitor { + type Value = AppBuilderErrorErrorsItems; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut detail: Option = None; + let mut source: Option = + None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "detail" => { + if v.is_null() { + continue; + } + detail = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "source" => { + if v.is_null() { + continue; + } + source = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = AppBuilderErrorErrorsItems { + detail, + source, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AppBuilderErrorErrorsItemsVisitor) + } +} diff --git a/src/datadogV2/model/model_app_builder_error_errors_items_source.rs b/src/datadogV2/model/model_app_builder_error_errors_items_source.rs new file mode 100644 index 000000000..349e671b2 --- /dev/null +++ b/src/datadogV2/model/model_app_builder_error_errors_items_source.rs @@ -0,0 +1,122 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `AppBuilderErrorErrorsItemsSource` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AppBuilderErrorErrorsItemsSource { + /// The `source` `parameter`. + #[serde(rename = "parameter")] + pub parameter: Option, + /// The `source` `pointer`. + #[serde(rename = "pointer")] + pub pointer: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AppBuilderErrorErrorsItemsSource { + pub fn new() -> AppBuilderErrorErrorsItemsSource { + AppBuilderErrorErrorsItemsSource { + parameter: None, + pointer: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn parameter(mut self, value: String) -> Self { + self.parameter = Some(value); + self + } + + pub fn pointer(mut self, value: String) -> Self { + self.pointer = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for AppBuilderErrorErrorsItemsSource { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for AppBuilderErrorErrorsItemsSource { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AppBuilderErrorErrorsItemsSourceVisitor; + impl<'a> Visitor<'a> for AppBuilderErrorErrorsItemsSourceVisitor { + type Value = AppBuilderErrorErrorsItemsSource; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut parameter: Option = None; + let mut pointer: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "parameter" => { + if v.is_null() { + continue; + } + parameter = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "pointer" => { + if v.is_null() { + continue; + } + pointer = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = AppBuilderErrorErrorsItemsSource { + parameter, + pointer, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AppBuilderErrorErrorsItemsSourceVisitor) + } +} diff --git a/src/datadogV2/model/model_app_builder_event.rs b/src/datadogV2/model/model_app_builder_event.rs new file mode 100644 index 000000000..8762b3324 --- /dev/null +++ b/src/datadogV2/model/model_app_builder_event.rs @@ -0,0 +1,138 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `AppBuilderEvent` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AppBuilderEvent { + /// The triggering action for the event. + #[serde(rename = "name")] + pub name: Option, + /// The response to the event. + #[serde(rename = "type")] + pub type_: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AppBuilderEvent { + pub fn new() -> AppBuilderEvent { + AppBuilderEvent { + name: None, + type_: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn name(mut self, value: crate::datadogV2::model::AppBuilderEventName) -> Self { + self.name = Some(value); + self + } + + pub fn type_(mut self, value: crate::datadogV2::model::AppBuilderEventType) -> Self { + self.type_ = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for AppBuilderEvent { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for AppBuilderEvent { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AppBuilderEventVisitor; + impl<'a> Visitor<'a> for AppBuilderEventVisitor { + type Value = AppBuilderEvent; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut name: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _name) = name { + match _name { + crate::datadogV2::model::AppBuilderEventName::UnparsedObject(_name) => { + _unparsed = true; + }, + _ => {} + } + } + } + "type" => { + if v.is_null() { + continue; + } + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::AppBuilderEventType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = AppBuilderEvent { + name, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AppBuilderEventVisitor) + } +} diff --git a/src/datadogV2/model/model_app_builder_event_name.rs b/src/datadogV2/model/model_app_builder_event_name.rs new file mode 100644 index 000000000..88daca544 --- /dev/null +++ b/src/datadogV2/model/model_app_builder_event_name.rs @@ -0,0 +1,75 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum AppBuilderEventName { + PAGECHANGE, + TABLEROWCLICK, + TABLEROWBUTTONCLICK, + CHANGE, + SUBMIT, + CLICK, + TOGGLEOPEN, + CLOSE, + OPEN, + EXECUTIONFINISHED, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for AppBuilderEventName { + fn to_string(&self) -> String { + match self { + Self::PAGECHANGE => String::from("pageChange"), + Self::TABLEROWCLICK => String::from("tableRowClick"), + Self::TABLEROWBUTTONCLICK => String::from("_tableRowButtonClick"), + Self::CHANGE => String::from("change"), + Self::SUBMIT => String::from("submit"), + Self::CLICK => String::from("click"), + Self::TOGGLEOPEN => String::from("toggleOpen"), + Self::CLOSE => String::from("close"), + Self::OPEN => String::from("open"), + Self::EXECUTIONFINISHED => String::from("executionFinished"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for AppBuilderEventName { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for AppBuilderEventName { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "pageChange" => Self::PAGECHANGE, + "tableRowClick" => Self::TABLEROWCLICK, + "_tableRowButtonClick" => Self::TABLEROWBUTTONCLICK, + "change" => Self::CHANGE, + "submit" => Self::SUBMIT, + "click" => Self::CLICK, + "toggleOpen" => Self::TOGGLEOPEN, + "close" => Self::CLOSE, + "open" => Self::OPEN, + "executionFinished" => Self::EXECUTIONFINISHED, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_app_builder_event_type.rs b/src/datadogV2/model/model_app_builder_event_type.rs new file mode 100644 index 000000000..91c817a54 --- /dev/null +++ b/src/datadogV2/model/model_app_builder_event_type.rs @@ -0,0 +1,69 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum AppBuilderEventType { + CUSTOM, + SETCOMPONENTSTATE, + TRIGGERQUERY, + OPENMODAL, + CLOSEMODAL, + OPENURL, + DOWNLOADFILE, + SETSTATEVARIABLEVALUE, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for AppBuilderEventType { + fn to_string(&self) -> String { + match self { + Self::CUSTOM => String::from("custom"), + Self::SETCOMPONENTSTATE => String::from("setComponentState"), + Self::TRIGGERQUERY => String::from("triggerQuery"), + Self::OPENMODAL => String::from("openModal"), + Self::CLOSEMODAL => String::from("closeModal"), + Self::OPENURL => String::from("openUrl"), + Self::DOWNLOADFILE => String::from("downloadFile"), + Self::SETSTATEVARIABLEVALUE => String::from("setStateVariableValue"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for AppBuilderEventType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for AppBuilderEventType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "custom" => Self::CUSTOM, + "setComponentState" => Self::SETCOMPONENTSTATE, + "triggerQuery" => Self::TRIGGERQUERY, + "openModal" => Self::OPENMODAL, + "closeModal" => Self::CLOSEMODAL, + "openUrl" => Self::OPENURL, + "downloadFile" => Self::DOWNLOADFILE, + "setStateVariableValue" => Self::SETSTATEVARIABLEVALUE, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_app_meta.rs b/src/datadogV2/model/model_app_meta.rs new file mode 100644 index 000000000..8a64153c1 --- /dev/null +++ b/src/datadogV2/model/model_app_meta.rs @@ -0,0 +1,260 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `AppMeta` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AppMeta { + /// The `AppMeta` `created_at`. + #[serde(rename = "created_at")] + pub created_at: Option, + /// The `AppMeta` `deleted_at`. + #[serde(rename = "deleted_at")] + pub deleted_at: Option, + /// The `AppMeta` `org_id`. + #[serde(rename = "org_id")] + pub org_id: Option, + /// The `AppMeta` `run_as_user`. + #[serde(rename = "run_as_user")] + pub run_as_user: Option, + /// The `AppMeta` `updated_at`. + #[serde(rename = "updated_at")] + pub updated_at: Option, + /// The `AppMeta` `updated_since_deployment`. + #[serde(rename = "updated_since_deployment")] + pub updated_since_deployment: Option, + /// The `AppMeta` `user_id`. + #[serde(rename = "user_id")] + pub user_id: Option, + /// The `AppMeta` `user_name`. + #[serde(rename = "user_name")] + pub user_name: Option, + /// The `AppMeta` `user_uuid`. + #[serde(rename = "user_uuid")] + pub user_uuid: Option, + /// The `AppMeta` `version`. + #[serde(rename = "version")] + pub version: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AppMeta { + pub fn new() -> AppMeta { + AppMeta { + created_at: None, + deleted_at: None, + org_id: None, + run_as_user: None, + updated_at: None, + updated_since_deployment: None, + user_id: None, + user_name: None, + user_uuid: None, + version: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn created_at(mut self, value: String) -> Self { + self.created_at = Some(value); + self + } + + pub fn deleted_at(mut self, value: String) -> Self { + self.deleted_at = Some(value); + self + } + + pub fn org_id(mut self, value: i64) -> Self { + self.org_id = Some(value); + self + } + + pub fn run_as_user(mut self, value: String) -> Self { + self.run_as_user = Some(value); + self + } + + pub fn updated_at(mut self, value: String) -> Self { + self.updated_at = Some(value); + self + } + + pub fn updated_since_deployment(mut self, value: bool) -> Self { + self.updated_since_deployment = Some(value); + self + } + + pub fn user_id(mut self, value: i64) -> Self { + self.user_id = Some(value); + self + } + + pub fn user_name(mut self, value: String) -> Self { + self.user_name = Some(value); + self + } + + pub fn user_uuid(mut self, value: String) -> Self { + self.user_uuid = Some(value); + self + } + + pub fn version(mut self, value: i64) -> Self { + self.version = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for AppMeta { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for AppMeta { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AppMetaVisitor; + impl<'a> Visitor<'a> for AppMetaVisitor { + type Value = AppMeta; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut created_at: Option = None; + let mut deleted_at: Option = None; + let mut org_id: Option = None; + let mut run_as_user: Option = None; + let mut updated_at: Option = None; + let mut updated_since_deployment: Option = None; + let mut user_id: Option = None; + let mut user_name: Option = None; + let mut user_uuid: Option = None; + let mut version: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "created_at" => { + if v.is_null() { + continue; + } + created_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "deleted_at" => { + if v.is_null() { + continue; + } + deleted_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "org_id" => { + if v.is_null() { + continue; + } + org_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "run_as_user" => { + if v.is_null() { + continue; + } + run_as_user = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "updated_at" => { + if v.is_null() { + continue; + } + updated_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "updated_since_deployment" => { + if v.is_null() { + continue; + } + updated_since_deployment = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "user_id" => { + if v.is_null() { + continue; + } + user_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "user_name" => { + if v.is_null() { + continue; + } + user_name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "user_uuid" => { + if v.is_null() { + continue; + } + user_uuid = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "version" => { + if v.is_null() { + continue; + } + version = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = AppMeta { + created_at, + deleted_at, + org_id, + run_as_user, + updated_at, + updated_since_deployment, + user_id, + user_name, + user_uuid, + version, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AppMetaVisitor) + } +} diff --git a/src/datadogV2/model/model_apps_sort_field.rs b/src/datadogV2/model/model_apps_sort_field.rs new file mode 100644 index 000000000..11b0f0a15 --- /dev/null +++ b/src/datadogV2/model/model_apps_sort_field.rs @@ -0,0 +1,69 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum AppsSortField { + NAME, + CREATED_AT, + UPDATED_AT, + USER_NAME, + NAME_DESC, + CREATED_AT_DESC, + UPDATED_AT_DESC, + USER_NAME_DESC, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for AppsSortField { + fn to_string(&self) -> String { + match self { + Self::NAME => String::from("name"), + Self::CREATED_AT => String::from("created_at"), + Self::UPDATED_AT => String::from("updated_at"), + Self::USER_NAME => String::from("user_name"), + Self::NAME_DESC => String::from("-name"), + Self::CREATED_AT_DESC => String::from("-created_at"), + Self::UPDATED_AT_DESC => String::from("-updated_at"), + Self::USER_NAME_DESC => String::from("-user_name"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for AppsSortField { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for AppsSortField { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "name" => Self::NAME, + "created_at" => Self::CREATED_AT, + "updated_at" => Self::UPDATED_AT, + "user_name" => Self::USER_NAME, + "-name" => Self::NAME_DESC, + "-created_at" => Self::CREATED_AT_DESC, + "-updated_at" => Self::UPDATED_AT_DESC, + "-user_name" => Self::USER_NAME_DESC, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_component.rs b/src/datadogV2/model/model_component.rs new file mode 100644 index 000000000..67731fcf0 --- /dev/null +++ b/src/datadogV2/model/model_component.rs @@ -0,0 +1,157 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `Component` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct Component { + /// The `Component` `events`. + #[serde(rename = "events")] + pub events: Option>, + /// The `Component` `id`. + #[serde(rename = "id", default, with = "::serde_with::rust::double_option")] + pub id: Option>, + /// The `Component` `name`. + #[serde(rename = "name")] + pub name: String, + /// The definition of `ComponentProperties` object. + #[serde(rename = "properties")] + pub properties: crate::datadogV2::model::ComponentProperties, + /// The definition of `ComponentType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::ComponentType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl Component { + pub fn new( + name: String, + properties: crate::datadogV2::model::ComponentProperties, + type_: crate::datadogV2::model::ComponentType, + ) -> Component { + Component { + events: None, + id: None, + name, + properties, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn events(mut self, value: Vec) -> Self { + self.events = Some(value); + self + } + + pub fn id(mut self, value: Option) -> Self { + self.id = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for Component { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ComponentVisitor; + impl<'a> Visitor<'a> for ComponentVisitor { + type Value = Component; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut events: Option> = None; + let mut id: Option> = None; + let mut name: Option = None; + let mut properties: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "events" => { + if v.is_null() { + continue; + } + events = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "properties" => { + properties = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::ComponentType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let name = name.ok_or_else(|| M::Error::missing_field("name"))?; + let properties = properties.ok_or_else(|| M::Error::missing_field("properties"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = Component { + events, + id, + name, + properties, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ComponentVisitor) + } +} diff --git a/src/datadogV2/model/model_component_grid.rs b/src/datadogV2/model/model_component_grid.rs new file mode 100644 index 000000000..d06c4a3fc --- /dev/null +++ b/src/datadogV2/model/model_component_grid.rs @@ -0,0 +1,160 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `ComponentGrid` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ComponentGrid { + /// The `ComponentGrid` `events`. + #[serde(rename = "events")] + pub events: Option>, + /// The `ComponentGrid` `id`. + #[serde(rename = "id")] + pub id: Option, + /// The `ComponentGrid` `name`. + #[serde(rename = "name")] + pub name: String, + /// The definition of `ComponentGridProperties` object. + #[serde(rename = "properties")] + pub properties: crate::datadogV2::model::ComponentGridProperties, + /// The definition of `ComponentGridType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::ComponentGridType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ComponentGrid { + pub fn new( + name: String, + properties: crate::datadogV2::model::ComponentGridProperties, + type_: crate::datadogV2::model::ComponentGridType, + ) -> ComponentGrid { + ComponentGrid { + events: None, + id: None, + name, + properties, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn events(mut self, value: Vec) -> Self { + self.events = Some(value); + self + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for ComponentGrid { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ComponentGridVisitor; + impl<'a> Visitor<'a> for ComponentGridVisitor { + type Value = ComponentGrid; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut events: Option> = None; + let mut id: Option = None; + let mut name: Option = None; + let mut properties: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "events" => { + if v.is_null() { + continue; + } + events = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "properties" => { + properties = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::ComponentGridType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let name = name.ok_or_else(|| M::Error::missing_field("name"))?; + let properties = properties.ok_or_else(|| M::Error::missing_field("properties"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = ComponentGrid { + events, + id, + name, + properties, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ComponentGridVisitor) + } +} diff --git a/src/datadogV2/model/model_component_grid_properties.rs b/src/datadogV2/model/model_component_grid_properties.rs new file mode 100644 index 000000000..205671655 --- /dev/null +++ b/src/datadogV2/model/model_component_grid_properties.rs @@ -0,0 +1,153 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `ComponentGridProperties` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ComponentGridProperties { + /// The `ComponentGridProperties` `backgroundColor`. + #[serde(rename = "backgroundColor")] + pub background_color: Option, + /// The `ComponentGridProperties` `children`. + #[serde(rename = "children")] + pub children: Option>, + /// The definition of `ComponentGridPropertiesIsVisible` object. + #[serde(rename = "isVisible")] + pub is_visible: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ComponentGridProperties { + pub fn new() -> ComponentGridProperties { + ComponentGridProperties { + background_color: None, + children: None, + is_visible: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn background_color(mut self, value: String) -> Self { + self.background_color = Some(value); + self + } + + pub fn children(mut self, value: Vec) -> Self { + self.children = Some(value); + self + } + + pub fn is_visible( + mut self, + value: crate::datadogV2::model::ComponentGridPropertiesIsVisible, + ) -> Self { + self.is_visible = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for ComponentGridProperties { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for ComponentGridProperties { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ComponentGridPropertiesVisitor; + impl<'a> Visitor<'a> for ComponentGridPropertiesVisitor { + type Value = ComponentGridProperties; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut background_color: Option = None; + let mut children: Option> = None; + let mut is_visible: Option< + crate::datadogV2::model::ComponentGridPropertiesIsVisible, + > = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "backgroundColor" => { + if v.is_null() { + continue; + } + background_color = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "children" => { + if v.is_null() { + continue; + } + children = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "isVisible" => { + if v.is_null() { + continue; + } + is_visible = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _is_visible) = is_visible { + match _is_visible { + crate::datadogV2::model::ComponentGridPropertiesIsVisible::UnparsedObject(_is_visible) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = ComponentGridProperties { + background_color, + children, + is_visible, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ComponentGridPropertiesVisitor) + } +} diff --git a/src/datadogV2/model/model_component_grid_properties_is_visible.rs b/src/datadogV2/model/model_component_grid_properties_is_visible.rs new file mode 100644 index 000000000..fa6e0598e --- /dev/null +++ b/src/datadogV2/model/model_component_grid_properties_is_visible.rs @@ -0,0 +1,33 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of `ComponentGridPropertiesIsVisible` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum ComponentGridPropertiesIsVisible { + String(String), + Bool(bool), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for ComponentGridPropertiesIsVisible { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::(value.clone()) { + return Ok(ComponentGridPropertiesIsVisible::String(_v)); + } + if let Ok(_v) = serde_json::from_value::(value.clone()) { + return Ok(ComponentGridPropertiesIsVisible::Bool(_v)); + } + + return Ok(ComponentGridPropertiesIsVisible::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_component_grid_type.rs b/src/datadogV2/model/model_component_grid_type.rs new file mode 100644 index 000000000..59641f31e --- /dev/null +++ b/src/datadogV2/model/model_component_grid_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum ComponentGridType { + GRID, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for ComponentGridType { + fn to_string(&self) -> String { + match self { + Self::GRID => String::from("grid"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for ComponentGridType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for ComponentGridType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "grid" => Self::GRID, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_component_properties.rs b/src/datadogV2/model/model_component_properties.rs new file mode 100644 index 000000000..7813dffed --- /dev/null +++ b/src/datadogV2/model/model_component_properties.rs @@ -0,0 +1,134 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `ComponentProperties` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ComponentProperties { + /// The `ComponentProperties` `children`. + #[serde(rename = "children")] + pub children: Option>, + /// The definition of `ComponentPropertiesIsVisible` object. + #[serde(rename = "isVisible")] + pub is_visible: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ComponentProperties { + pub fn new() -> ComponentProperties { + ComponentProperties { + children: None, + is_visible: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn children(mut self, value: Vec) -> Self { + self.children = Some(value); + self + } + + pub fn is_visible( + mut self, + value: crate::datadogV2::model::ComponentPropertiesIsVisible, + ) -> Self { + self.is_visible = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for ComponentProperties { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for ComponentProperties { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ComponentPropertiesVisitor; + impl<'a> Visitor<'a> for ComponentPropertiesVisitor { + type Value = ComponentProperties; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut children: Option> = None; + let mut is_visible: Option = + None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "children" => { + if v.is_null() { + continue; + } + children = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "isVisible" => { + if v.is_null() { + continue; + } + is_visible = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _is_visible) = is_visible { + match _is_visible { + crate::datadogV2::model::ComponentPropertiesIsVisible::UnparsedObject(_is_visible) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = ComponentProperties { + children, + is_visible, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ComponentPropertiesVisitor) + } +} diff --git a/src/datadogV2/model/model_component_properties_is_visible.rs b/src/datadogV2/model/model_component_properties_is_visible.rs new file mode 100644 index 000000000..b41d7b227 --- /dev/null +++ b/src/datadogV2/model/model_component_properties_is_visible.rs @@ -0,0 +1,33 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::{Deserialize, Deserializer, Serialize}; + +/// The definition of `ComponentPropertiesIsVisible` object. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum ComponentPropertiesIsVisible { + Bool(bool), + String(String), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for ComponentPropertiesIsVisible { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::(value.clone()) { + return Ok(ComponentPropertiesIsVisible::Bool(_v)); + } + if let Ok(_v) = serde_json::from_value::(value.clone()) { + return Ok(ComponentPropertiesIsVisible::String(_v)); + } + + return Ok(ComponentPropertiesIsVisible::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_component_type.rs b/src/datadogV2/model/model_component_type.rs new file mode 100644 index 000000000..7d8c554c0 --- /dev/null +++ b/src/datadogV2/model/model_component_type.rs @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum ComponentType { + TABLE, + TEXTINPUT, + TEXTAREA, + BUTTON, + TEXT, + SELECT, + MODAL, + SCHEMAFORM, + CHECKBOX, + TABS, + VEGACHART, + RADIOBUTTONS, + NUMBERINPUT, + FILEINPUT, + JSONINPUT, + GRIDCELL, + DATERANGEPICKER, + SEARCH, + CONTAINER, + CALLOUTVALUE, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for ComponentType { + fn to_string(&self) -> String { + match self { + Self::TABLE => String::from("table"), + Self::TEXTINPUT => String::from("textInput"), + Self::TEXTAREA => String::from("textArea"), + Self::BUTTON => String::from("button"), + Self::TEXT => String::from("text"), + Self::SELECT => String::from("select"), + Self::MODAL => String::from("modal"), + Self::SCHEMAFORM => String::from("schemaForm"), + Self::CHECKBOX => String::from("checkbox"), + Self::TABS => String::from("tabs"), + Self::VEGACHART => String::from("vegaChart"), + Self::RADIOBUTTONS => String::from("radioButtons"), + Self::NUMBERINPUT => String::from("numberInput"), + Self::FILEINPUT => String::from("fileInput"), + Self::JSONINPUT => String::from("jsonInput"), + Self::GRIDCELL => String::from("gridCell"), + Self::DATERANGEPICKER => String::from("dateRangePicker"), + Self::SEARCH => String::from("search"), + Self::CONTAINER => String::from("container"), + Self::CALLOUTVALUE => String::from("calloutValue"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for ComponentType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for ComponentType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "table" => Self::TABLE, + "textInput" => Self::TEXTINPUT, + "textArea" => Self::TEXTAREA, + "button" => Self::BUTTON, + "text" => Self::TEXT, + "select" => Self::SELECT, + "modal" => Self::MODAL, + "schemaForm" => Self::SCHEMAFORM, + "checkbox" => Self::CHECKBOX, + "tabs" => Self::TABS, + "vegaChart" => Self::VEGACHART, + "radioButtons" => Self::RADIOBUTTONS, + "numberInput" => Self::NUMBERINPUT, + "fileInput" => Self::FILEINPUT, + "jsonInput" => Self::JSONINPUT, + "gridCell" => Self::GRIDCELL, + "dateRangePicker" => Self::DATERANGEPICKER, + "search" => Self::SEARCH, + "container" => Self::CONTAINER, + "calloutValue" => Self::CALLOUTVALUE, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_create_app_request.rs b/src/datadogV2/model/model_create_app_request.rs new file mode 100644 index 000000000..a7d69ddbe --- /dev/null +++ b/src/datadogV2/model/model_create_app_request.rs @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `CreateAppRequest` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct CreateAppRequest { + /// The definition of `CreateAppRequestData` object. + #[serde(rename = "data")] + pub data: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl CreateAppRequest { + pub fn new() -> CreateAppRequest { + CreateAppRequest { + data: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: crate::datadogV2::model::CreateAppRequestData) -> Self { + self.data = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for CreateAppRequest { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for CreateAppRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct CreateAppRequestVisitor; + impl<'a> Visitor<'a> for CreateAppRequestVisitor { + type Value = CreateAppRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = CreateAppRequest { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(CreateAppRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_create_app_request_data.rs b/src/datadogV2/model/model_create_app_request_data.rs new file mode 100644 index 000000000..0573de1e6 --- /dev/null +++ b/src/datadogV2/model/model_create_app_request_data.rs @@ -0,0 +1,122 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `CreateAppRequestData` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct CreateAppRequestData { + /// The definition of `CreateAppRequestDataAttributes` object. + #[serde(rename = "attributes")] + pub attributes: Option, + /// The definition of `CreateAppRequestDataType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::CreateAppRequestDataType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl CreateAppRequestData { + pub fn new(type_: crate::datadogV2::model::CreateAppRequestDataType) -> CreateAppRequestData { + CreateAppRequestData { + attributes: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes( + mut self, + value: crate::datadogV2::model::CreateAppRequestDataAttributes, + ) -> Self { + self.attributes = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for CreateAppRequestData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct CreateAppRequestDataVisitor; + impl<'a> Visitor<'a> for CreateAppRequestDataVisitor { + type Value = CreateAppRequestData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::CreateAppRequestDataAttributes, + > = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + if v.is_null() { + continue; + } + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::CreateAppRequestDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = CreateAppRequestData { + attributes, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(CreateAppRequestDataVisitor) + } +} diff --git a/src/datadogV2/model/model_create_app_request_data_attributes.rs b/src/datadogV2/model/model_create_app_request_data_attributes.rs new file mode 100644 index 000000000..9d50c24ed --- /dev/null +++ b/src/datadogV2/model/model_create_app_request_data_attributes.rs @@ -0,0 +1,228 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `CreateAppRequestDataAttributes` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct CreateAppRequestDataAttributes { + /// The `attributes` `components`. + #[serde(rename = "components")] + pub components: Option>, + /// The `attributes` `description`. + #[serde(rename = "description")] + pub description: Option, + /// The `attributes` `embeddedQueries`. + #[serde(rename = "embeddedQueries")] + pub embedded_queries: Option>, + /// The definition of `InputSchema` object. + #[serde(rename = "inputSchema")] + pub input_schema: Option, + /// The `attributes` `name`. + #[serde(rename = "name")] + pub name: Option, + /// The `attributes` `rootInstanceName`. + #[serde(rename = "rootInstanceName")] + pub root_instance_name: Option, + /// The `attributes` `scripts`. + #[serde(rename = "scripts")] + pub scripts: Option>, + /// The `attributes` `tags`. + #[serde(rename = "tags")] + pub tags: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl CreateAppRequestDataAttributes { + pub fn new() -> CreateAppRequestDataAttributes { + CreateAppRequestDataAttributes { + components: None, + description: None, + embedded_queries: None, + input_schema: None, + name: None, + root_instance_name: None, + scripts: None, + tags: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn components(mut self, value: Vec) -> Self { + self.components = Some(value); + self + } + + pub fn description(mut self, value: String) -> Self { + self.description = Some(value); + self + } + + pub fn embedded_queries(mut self, value: Vec) -> Self { + self.embedded_queries = Some(value); + self + } + + pub fn input_schema(mut self, value: crate::datadogV2::model::InputSchema) -> Self { + self.input_schema = Some(value); + self + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn root_instance_name(mut self, value: String) -> Self { + self.root_instance_name = Some(value); + self + } + + pub fn scripts(mut self, value: Vec) -> Self { + self.scripts = Some(value); + self + } + + pub fn tags(mut self, value: Vec) -> Self { + self.tags = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for CreateAppRequestDataAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for CreateAppRequestDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct CreateAppRequestDataAttributesVisitor; + impl<'a> Visitor<'a> for CreateAppRequestDataAttributesVisitor { + type Value = CreateAppRequestDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut components: Option> = None; + let mut description: Option = None; + let mut embedded_queries: Option> = None; + let mut input_schema: Option = None; + let mut name: Option = None; + let mut root_instance_name: Option = None; + let mut scripts: Option> = None; + let mut tags: Option> = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "components" => { + if v.is_null() { + continue; + } + components = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "description" => { + if v.is_null() { + continue; + } + description = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "embeddedQueries" => { + if v.is_null() { + continue; + } + embedded_queries = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "inputSchema" => { + if v.is_null() { + continue; + } + input_schema = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "rootInstanceName" => { + if v.is_null() { + continue; + } + root_instance_name = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "scripts" => { + if v.is_null() { + continue; + } + scripts = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "tags" => { + if v.is_null() { + continue; + } + tags = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = CreateAppRequestDataAttributes { + components, + description, + embedded_queries, + input_schema, + name, + root_instance_name, + scripts, + tags, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(CreateAppRequestDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_create_app_request_data_type.rs b/src/datadogV2/model/model_create_app_request_data_type.rs new file mode 100644 index 000000000..b2c40b965 --- /dev/null +++ b/src/datadogV2/model/model_create_app_request_data_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum CreateAppRequestDataType { + APPDEFINITIONS, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for CreateAppRequestDataType { + fn to_string(&self) -> String { + match self { + Self::APPDEFINITIONS => String::from("appDefinitions"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for CreateAppRequestDataType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for CreateAppRequestDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "appDefinitions" => Self::APPDEFINITIONS, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_create_app_response.rs b/src/datadogV2/model/model_create_app_response.rs new file mode 100644 index 000000000..47a75ea42 --- /dev/null +++ b/src/datadogV2/model/model_create_app_response.rs @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `CreateAppResponse` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct CreateAppResponse { + /// The definition of `CreateAppResponseData` object. + #[serde(rename = "data")] + pub data: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl CreateAppResponse { + pub fn new() -> CreateAppResponse { + CreateAppResponse { + data: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: crate::datadogV2::model::CreateAppResponseData) -> Self { + self.data = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for CreateAppResponse { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for CreateAppResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct CreateAppResponseVisitor; + impl<'a> Visitor<'a> for CreateAppResponseVisitor { + type Value = CreateAppResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = CreateAppResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(CreateAppResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_create_app_response_data.rs b/src/datadogV2/model/model_create_app_response_data.rs new file mode 100644 index 000000000..34f5847d7 --- /dev/null +++ b/src/datadogV2/model/model_create_app_response_data.rs @@ -0,0 +1,113 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `CreateAppResponseData` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct CreateAppResponseData { + /// The `data` `id`. + #[serde(rename = "id")] + pub id: String, + /// The definition of `CreateAppResponseDataType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::CreateAppResponseDataType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl CreateAppResponseData { + pub fn new( + id: String, + type_: crate::datadogV2::model::CreateAppResponseDataType, + ) -> CreateAppResponseData { + CreateAppResponseData { + id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for CreateAppResponseData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct CreateAppResponseDataVisitor; + impl<'a> Visitor<'a> for CreateAppResponseDataVisitor { + type Value = CreateAppResponseData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::CreateAppResponseDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = CreateAppResponseData { + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(CreateAppResponseDataVisitor) + } +} diff --git a/src/datadogV2/model/model_create_app_response_data_type.rs b/src/datadogV2/model/model_create_app_response_data_type.rs new file mode 100644 index 000000000..25781c3b9 --- /dev/null +++ b/src/datadogV2/model/model_create_app_response_data_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum CreateAppResponseDataType { + APPDEFINITIONS, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for CreateAppResponseDataType { + fn to_string(&self) -> String { + match self { + Self::APPDEFINITIONS => String::from("appDefinitions"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for CreateAppResponseDataType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for CreateAppResponseDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "appDefinitions" => Self::APPDEFINITIONS, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_custom_connection.rs b/src/datadogV2/model/model_custom_connection.rs new file mode 100644 index 000000000..5d64d7ed1 --- /dev/null +++ b/src/datadogV2/model/model_custom_connection.rs @@ -0,0 +1,151 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `CustomConnection` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct CustomConnection { + /// The definition of `CustomConnectionAttributes` object. + #[serde(rename = "attributes")] + pub attributes: Option, + /// The `CustomConnection` `id`. + #[serde(rename = "id")] + pub id: Option, + /// The definition of `CustomConnectionType` object. + #[serde(rename = "type")] + pub type_: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl CustomConnection { + pub fn new() -> CustomConnection { + CustomConnection { + attributes: None, + id: None, + type_: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes( + mut self, + value: crate::datadogV2::model::CustomConnectionAttributes, + ) -> Self { + self.attributes = Some(value); + self + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn type_(mut self, value: crate::datadogV2::model::CustomConnectionType) -> Self { + self.type_ = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for CustomConnection { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for CustomConnection { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct CustomConnectionVisitor; + impl<'a> Visitor<'a> for CustomConnectionVisitor { + type Value = CustomConnection; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option = + None; + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + if v.is_null() { + continue; + } + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + if v.is_null() { + continue; + } + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::CustomConnectionType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = CustomConnection { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(CustomConnectionVisitor) + } +} diff --git a/src/datadogV2/model/model_custom_connection_attributes.rs b/src/datadogV2/model/model_custom_connection_attributes.rs new file mode 100644 index 000000000..1cb64459b --- /dev/null +++ b/src/datadogV2/model/model_custom_connection_attributes.rs @@ -0,0 +1,128 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `CustomConnectionAttributes` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct CustomConnectionAttributes { + /// The `attributes` `name`. + #[serde(rename = "name")] + pub name: Option, + /// The definition of `CustomConnectionAttributesOnPremRunner` object. + #[serde(rename = "onPremRunner")] + pub on_prem_runner: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl CustomConnectionAttributes { + pub fn new() -> CustomConnectionAttributes { + CustomConnectionAttributes { + name: None, + on_prem_runner: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn on_prem_runner( + mut self, + value: crate::datadogV2::model::CustomConnectionAttributesOnPremRunner, + ) -> Self { + self.on_prem_runner = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for CustomConnectionAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for CustomConnectionAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct CustomConnectionAttributesVisitor; + impl<'a> Visitor<'a> for CustomConnectionAttributesVisitor { + type Value = CustomConnectionAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut name: Option = None; + let mut on_prem_runner: Option< + crate::datadogV2::model::CustomConnectionAttributesOnPremRunner, + > = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "onPremRunner" => { + if v.is_null() { + continue; + } + on_prem_runner = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = CustomConnectionAttributes { + name, + on_prem_runner, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(CustomConnectionAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_custom_connection_attributes_on_prem_runner.rs b/src/datadogV2/model/model_custom_connection_attributes_on_prem_runner.rs new file mode 100644 index 000000000..5521b174a --- /dev/null +++ b/src/datadogV2/model/model_custom_connection_attributes_on_prem_runner.rs @@ -0,0 +1,122 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `CustomConnectionAttributesOnPremRunner` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct CustomConnectionAttributesOnPremRunner { + /// The `onPremRunner` `id`. + #[serde(rename = "id")] + pub id: Option, + /// The `onPremRunner` `url`. + #[serde(rename = "url")] + pub url: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl CustomConnectionAttributesOnPremRunner { + pub fn new() -> CustomConnectionAttributesOnPremRunner { + CustomConnectionAttributesOnPremRunner { + id: None, + url: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn url(mut self, value: String) -> Self { + self.url = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for CustomConnectionAttributesOnPremRunner { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for CustomConnectionAttributesOnPremRunner { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct CustomConnectionAttributesOnPremRunnerVisitor; + impl<'a> Visitor<'a> for CustomConnectionAttributesOnPremRunnerVisitor { + type Value = CustomConnectionAttributesOnPremRunner; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut id: Option = None; + let mut url: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "url" => { + if v.is_null() { + continue; + } + url = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = CustomConnectionAttributesOnPremRunner { + id, + url, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(CustomConnectionAttributesOnPremRunnerVisitor) + } +} diff --git a/src/datadogV2/model/model_custom_connection_type.rs b/src/datadogV2/model/model_custom_connection_type.rs new file mode 100644 index 000000000..f344d7f31 --- /dev/null +++ b/src/datadogV2/model/model_custom_connection_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum CustomConnectionType { + CUSTOM_CONNECTIONS, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for CustomConnectionType { + fn to_string(&self) -> String { + match self { + Self::CUSTOM_CONNECTIONS => String::from("custom_connections"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for CustomConnectionType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for CustomConnectionType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "custom_connections" => Self::CUSTOM_CONNECTIONS, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_delete_app_response.rs b/src/datadogV2/model/model_delete_app_response.rs new file mode 100644 index 000000000..b98e07724 --- /dev/null +++ b/src/datadogV2/model/model_delete_app_response.rs @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DeleteAppResponse` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DeleteAppResponse { + /// The definition of `DeleteAppResponseData` object. + #[serde(rename = "data")] + pub data: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DeleteAppResponse { + pub fn new() -> DeleteAppResponse { + DeleteAppResponse { + data: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: crate::datadogV2::model::DeleteAppResponseData) -> Self { + self.data = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for DeleteAppResponse { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for DeleteAppResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DeleteAppResponseVisitor; + impl<'a> Visitor<'a> for DeleteAppResponseVisitor { + type Value = DeleteAppResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = DeleteAppResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DeleteAppResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_delete_app_response_data.rs b/src/datadogV2/model/model_delete_app_response_data.rs new file mode 100644 index 000000000..100eb7a93 --- /dev/null +++ b/src/datadogV2/model/model_delete_app_response_data.rs @@ -0,0 +1,113 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DeleteAppResponseData` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DeleteAppResponseData { + /// The `data` `id`. + #[serde(rename = "id")] + pub id: String, + /// The definition of `DeleteAppResponseDataType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::DeleteAppResponseDataType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DeleteAppResponseData { + pub fn new( + id: String, + type_: crate::datadogV2::model::DeleteAppResponseDataType, + ) -> DeleteAppResponseData { + DeleteAppResponseData { + id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for DeleteAppResponseData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DeleteAppResponseDataVisitor; + impl<'a> Visitor<'a> for DeleteAppResponseDataVisitor { + type Value = DeleteAppResponseData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::DeleteAppResponseDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = DeleteAppResponseData { + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DeleteAppResponseDataVisitor) + } +} diff --git a/src/datadogV2/model/model_delete_app_response_data_type.rs b/src/datadogV2/model/model_delete_app_response_data_type.rs new file mode 100644 index 000000000..fd3cff12d --- /dev/null +++ b/src/datadogV2/model/model_delete_app_response_data_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum DeleteAppResponseDataType { + APPDEFINITIONS, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for DeleteAppResponseDataType { + fn to_string(&self) -> String { + match self { + Self::APPDEFINITIONS => String::from("appDefinitions"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for DeleteAppResponseDataType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for DeleteAppResponseDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "appDefinitions" => Self::APPDEFINITIONS, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_delete_apps_request.rs b/src/datadogV2/model/model_delete_apps_request.rs new file mode 100644 index 000000000..e70e28151 --- /dev/null +++ b/src/datadogV2/model/model_delete_apps_request.rs @@ -0,0 +1,106 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DeleteAppsRequest` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DeleteAppsRequest { + /// The `DeleteAppsRequest` `data`. + #[serde(rename = "data")] + pub data: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DeleteAppsRequest { + pub fn new() -> DeleteAppsRequest { + DeleteAppsRequest { + data: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: Vec) -> Self { + self.data = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for DeleteAppsRequest { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for DeleteAppsRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DeleteAppsRequestVisitor; + impl<'a> Visitor<'a> for DeleteAppsRequestVisitor { + type Value = DeleteAppsRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option> = + None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = DeleteAppsRequest { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DeleteAppsRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_delete_apps_request_data_items.rs b/src/datadogV2/model/model_delete_apps_request_data_items.rs new file mode 100644 index 000000000..24652ede1 --- /dev/null +++ b/src/datadogV2/model/model_delete_apps_request_data_items.rs @@ -0,0 +1,114 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DeleteAppsRequestDataItems` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DeleteAppsRequestDataItems { + /// The `items` `id`. + #[serde(rename = "id")] + pub id: String, + /// The definition of `DeleteAppsRequestDataItemsType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::DeleteAppsRequestDataItemsType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DeleteAppsRequestDataItems { + pub fn new( + id: String, + type_: crate::datadogV2::model::DeleteAppsRequestDataItemsType, + ) -> DeleteAppsRequestDataItems { + DeleteAppsRequestDataItems { + id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for DeleteAppsRequestDataItems { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DeleteAppsRequestDataItemsVisitor; + impl<'a> Visitor<'a> for DeleteAppsRequestDataItemsVisitor { + type Value = DeleteAppsRequestDataItems; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut id: Option = None; + let mut type_: Option = + None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::DeleteAppsRequestDataItemsType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = DeleteAppsRequestDataItems { + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DeleteAppsRequestDataItemsVisitor) + } +} diff --git a/src/datadogV2/model/model_delete_apps_request_data_items_type.rs b/src/datadogV2/model/model_delete_apps_request_data_items_type.rs new file mode 100644 index 000000000..c322ea9a1 --- /dev/null +++ b/src/datadogV2/model/model_delete_apps_request_data_items_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum DeleteAppsRequestDataItemsType { + APPDEFINITIONS, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for DeleteAppsRequestDataItemsType { + fn to_string(&self) -> String { + match self { + Self::APPDEFINITIONS => String::from("appDefinitions"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for DeleteAppsRequestDataItemsType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for DeleteAppsRequestDataItemsType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "appDefinitions" => Self::APPDEFINITIONS, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_delete_apps_response.rs b/src/datadogV2/model/model_delete_apps_response.rs new file mode 100644 index 000000000..b3dfe257c --- /dev/null +++ b/src/datadogV2/model/model_delete_apps_response.rs @@ -0,0 +1,109 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DeleteAppsResponse` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DeleteAppsResponse { + /// The `DeleteAppsResponse` `data`. + #[serde(rename = "data")] + pub data: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DeleteAppsResponse { + pub fn new() -> DeleteAppsResponse { + DeleteAppsResponse { + data: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data( + mut self, + value: Vec, + ) -> Self { + self.data = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for DeleteAppsResponse { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for DeleteAppsResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DeleteAppsResponseVisitor; + impl<'a> Visitor<'a> for DeleteAppsResponseVisitor { + type Value = DeleteAppsResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option> = + None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = DeleteAppsResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DeleteAppsResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_delete_apps_response_data_items.rs b/src/datadogV2/model/model_delete_apps_response_data_items.rs new file mode 100644 index 000000000..75444b835 --- /dev/null +++ b/src/datadogV2/model/model_delete_apps_response_data_items.rs @@ -0,0 +1,114 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DeleteAppsResponseDataItems` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DeleteAppsResponseDataItems { + /// The `items` `id`. + #[serde(rename = "id")] + pub id: String, + /// The definition of `DeleteAppsResponseDataItemsType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::DeleteAppsResponseDataItemsType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DeleteAppsResponseDataItems { + pub fn new( + id: String, + type_: crate::datadogV2::model::DeleteAppsResponseDataItemsType, + ) -> DeleteAppsResponseDataItems { + DeleteAppsResponseDataItems { + id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for DeleteAppsResponseDataItems { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DeleteAppsResponseDataItemsVisitor; + impl<'a> Visitor<'a> for DeleteAppsResponseDataItemsVisitor { + type Value = DeleteAppsResponseDataItems; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut id: Option = None; + let mut type_: Option = + None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::DeleteAppsResponseDataItemsType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = DeleteAppsResponseDataItems { + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DeleteAppsResponseDataItemsVisitor) + } +} diff --git a/src/datadogV2/model/model_delete_apps_response_data_items_type.rs b/src/datadogV2/model/model_delete_apps_response_data_items_type.rs new file mode 100644 index 000000000..c563ee48d --- /dev/null +++ b/src/datadogV2/model/model_delete_apps_response_data_items_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum DeleteAppsResponseDataItemsType { + APPDEFINITIONS, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for DeleteAppsResponseDataItemsType { + fn to_string(&self) -> String { + match self { + Self::APPDEFINITIONS => String::from("appDefinitions"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for DeleteAppsResponseDataItemsType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for DeleteAppsResponseDataItemsType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "appDefinitions" => Self::APPDEFINITIONS, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_deploy_app_response.rs b/src/datadogV2/model/model_deploy_app_response.rs new file mode 100644 index 000000000..35fc712dc --- /dev/null +++ b/src/datadogV2/model/model_deploy_app_response.rs @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DeployAppResponse` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DeployAppResponse { + /// The definition of `DeployAppResponseData` object. + #[serde(rename = "data")] + pub data: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DeployAppResponse { + pub fn new() -> DeployAppResponse { + DeployAppResponse { + data: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: crate::datadogV2::model::DeployAppResponseData) -> Self { + self.data = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for DeployAppResponse { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for DeployAppResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DeployAppResponseVisitor; + impl<'a> Visitor<'a> for DeployAppResponseVisitor { + type Value = DeployAppResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = DeployAppResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DeployAppResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_deploy_app_response_data.rs b/src/datadogV2/model/model_deploy_app_response_data.rs new file mode 100644 index 000000000..a36623b34 --- /dev/null +++ b/src/datadogV2/model/model_deploy_app_response_data.rs @@ -0,0 +1,169 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DeployAppResponseData` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DeployAppResponseData { + /// The definition of `DeployAppResponseDataAttributes` object. + #[serde(rename = "attributes")] + pub attributes: Option, + /// The `data` `id`. + #[serde(rename = "id")] + pub id: Option, + /// The definition of `DeploymentMeta` object. + #[serde(rename = "meta")] + pub meta: Option, + /// The definition of `DeployAppResponseDataType` object. + #[serde(rename = "type")] + pub type_: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DeployAppResponseData { + pub fn new() -> DeployAppResponseData { + DeployAppResponseData { + attributes: None, + id: None, + meta: None, + type_: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes( + mut self, + value: crate::datadogV2::model::DeployAppResponseDataAttributes, + ) -> Self { + self.attributes = Some(value); + self + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn meta(mut self, value: crate::datadogV2::model::DeploymentMeta) -> Self { + self.meta = Some(value); + self + } + + pub fn type_(mut self, value: crate::datadogV2::model::DeployAppResponseDataType) -> Self { + self.type_ = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for DeployAppResponseData { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for DeployAppResponseData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DeployAppResponseDataVisitor; + impl<'a> Visitor<'a> for DeployAppResponseDataVisitor { + type Value = DeployAppResponseData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::DeployAppResponseDataAttributes, + > = None; + let mut id: Option = None; + let mut meta: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + if v.is_null() { + continue; + } + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "meta" => { + if v.is_null() { + continue; + } + meta = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + if v.is_null() { + continue; + } + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::DeployAppResponseDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = DeployAppResponseData { + attributes, + id, + meta, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DeployAppResponseDataVisitor) + } +} diff --git a/src/datadogV2/model/model_deploy_app_response_data_attributes.rs b/src/datadogV2/model/model_deploy_app_response_data_attributes.rs new file mode 100644 index 000000000..99124000c --- /dev/null +++ b/src/datadogV2/model/model_deploy_app_response_data_attributes.rs @@ -0,0 +1,106 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DeployAppResponseDataAttributes` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DeployAppResponseDataAttributes { + /// The `attributes` `app_version_id`. + #[serde(rename = "app_version_id")] + pub app_version_id: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DeployAppResponseDataAttributes { + pub fn new() -> DeployAppResponseDataAttributes { + DeployAppResponseDataAttributes { + app_version_id: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn app_version_id(mut self, value: String) -> Self { + self.app_version_id = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for DeployAppResponseDataAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for DeployAppResponseDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DeployAppResponseDataAttributesVisitor; + impl<'a> Visitor<'a> for DeployAppResponseDataAttributesVisitor { + type Value = DeployAppResponseDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut app_version_id: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "app_version_id" => { + if v.is_null() { + continue; + } + app_version_id = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = DeployAppResponseDataAttributes { + app_version_id, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DeployAppResponseDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_deploy_app_response_data_type.rs b/src/datadogV2/model/model_deploy_app_response_data_type.rs new file mode 100644 index 000000000..9c1db1742 --- /dev/null +++ b/src/datadogV2/model/model_deploy_app_response_data_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum DeployAppResponseDataType { + DEPLOYMENT, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for DeployAppResponseDataType { + fn to_string(&self) -> String { + match self { + Self::DEPLOYMENT => String::from("deployment"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for DeployAppResponseDataType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for DeployAppResponseDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "deployment" => Self::DEPLOYMENT, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_deployment_included.rs b/src/datadogV2/model/model_deployment_included.rs new file mode 100644 index 000000000..7efa458f6 --- /dev/null +++ b/src/datadogV2/model/model_deployment_included.rs @@ -0,0 +1,168 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DeploymentIncluded` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DeploymentIncluded { + /// The definition of `DeploymentIncludedAttributes` object. + #[serde(rename = "attributes")] + pub attributes: Option, + /// The `DeploymentIncluded` `id`. + #[serde(rename = "id")] + pub id: Option, + /// The definition of `DeploymentIncludedMeta` object. + #[serde(rename = "meta")] + pub meta: Option, + /// The definition of `DeploymentIncludedType` object. + #[serde(rename = "type")] + pub type_: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DeploymentIncluded { + pub fn new() -> DeploymentIncluded { + DeploymentIncluded { + attributes: None, + id: None, + meta: None, + type_: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes( + mut self, + value: crate::datadogV2::model::DeploymentIncludedAttributes, + ) -> Self { + self.attributes = Some(value); + self + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn meta(mut self, value: crate::datadogV2::model::DeploymentIncludedMeta) -> Self { + self.meta = Some(value); + self + } + + pub fn type_(mut self, value: crate::datadogV2::model::DeploymentIncludedType) -> Self { + self.type_ = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for DeploymentIncluded { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for DeploymentIncluded { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DeploymentIncludedVisitor; + impl<'a> Visitor<'a> for DeploymentIncludedVisitor { + type Value = DeploymentIncluded; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option = + None; + let mut id: Option = None; + let mut meta: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + if v.is_null() { + continue; + } + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "meta" => { + if v.is_null() { + continue; + } + meta = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + if v.is_null() { + continue; + } + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::DeploymentIncludedType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = DeploymentIncluded { + attributes, + id, + meta, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DeploymentIncludedVisitor) + } +} diff --git a/src/datadogV2/model/model_deployment_included_attributes.rs b/src/datadogV2/model/model_deployment_included_attributes.rs new file mode 100644 index 000000000..f4a6d4273 --- /dev/null +++ b/src/datadogV2/model/model_deployment_included_attributes.rs @@ -0,0 +1,106 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DeploymentIncludedAttributes` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DeploymentIncludedAttributes { + /// The `attributes` `app_version_id`. + #[serde(rename = "app_version_id")] + pub app_version_id: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DeploymentIncludedAttributes { + pub fn new() -> DeploymentIncludedAttributes { + DeploymentIncludedAttributes { + app_version_id: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn app_version_id(mut self, value: String) -> Self { + self.app_version_id = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for DeploymentIncludedAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for DeploymentIncludedAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DeploymentIncludedAttributesVisitor; + impl<'a> Visitor<'a> for DeploymentIncludedAttributesVisitor { + type Value = DeploymentIncludedAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut app_version_id: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "app_version_id" => { + if v.is_null() { + continue; + } + app_version_id = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = DeploymentIncludedAttributes { + app_version_id, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DeploymentIncludedAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_deployment_included_meta.rs b/src/datadogV2/model/model_deployment_included_meta.rs new file mode 100644 index 000000000..9161dc392 --- /dev/null +++ b/src/datadogV2/model/model_deployment_included_meta.rs @@ -0,0 +1,156 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DeploymentIncludedMeta` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DeploymentIncludedMeta { + /// The `meta` `created_at`. + #[serde(rename = "created_at")] + pub created_at: Option, + /// The `meta` `user_id`. + #[serde(rename = "user_id")] + pub user_id: Option, + /// The `meta` `user_name`. + #[serde(rename = "user_name")] + pub user_name: Option, + /// The `meta` `user_uuid`. + #[serde(rename = "user_uuid")] + pub user_uuid: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DeploymentIncludedMeta { + pub fn new() -> DeploymentIncludedMeta { + DeploymentIncludedMeta { + created_at: None, + user_id: None, + user_name: None, + user_uuid: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn created_at(mut self, value: String) -> Self { + self.created_at = Some(value); + self + } + + pub fn user_id(mut self, value: i64) -> Self { + self.user_id = Some(value); + self + } + + pub fn user_name(mut self, value: String) -> Self { + self.user_name = Some(value); + self + } + + pub fn user_uuid(mut self, value: String) -> Self { + self.user_uuid = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for DeploymentIncludedMeta { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for DeploymentIncludedMeta { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DeploymentIncludedMetaVisitor; + impl<'a> Visitor<'a> for DeploymentIncludedMetaVisitor { + type Value = DeploymentIncludedMeta; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut created_at: Option = None; + let mut user_id: Option = None; + let mut user_name: Option = None; + let mut user_uuid: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "created_at" => { + if v.is_null() { + continue; + } + created_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "user_id" => { + if v.is_null() { + continue; + } + user_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "user_name" => { + if v.is_null() { + continue; + } + user_name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "user_uuid" => { + if v.is_null() { + continue; + } + user_uuid = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = DeploymentIncludedMeta { + created_at, + user_id, + user_name, + user_uuid, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DeploymentIncludedMetaVisitor) + } +} diff --git a/src/datadogV2/model/model_deployment_included_type.rs b/src/datadogV2/model/model_deployment_included_type.rs new file mode 100644 index 000000000..37b7cc1e7 --- /dev/null +++ b/src/datadogV2/model/model_deployment_included_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum DeploymentIncludedType { + DEPLOYMENT, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for DeploymentIncludedType { + fn to_string(&self) -> String { + match self { + Self::DEPLOYMENT => String::from("deployment"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for DeploymentIncludedType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for DeploymentIncludedType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "deployment" => Self::DEPLOYMENT, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_deployment_meta.rs b/src/datadogV2/model/model_deployment_meta.rs new file mode 100644 index 000000000..126810396 --- /dev/null +++ b/src/datadogV2/model/model_deployment_meta.rs @@ -0,0 +1,156 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DeploymentMeta` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DeploymentMeta { + /// The `DeploymentMeta` `created_at`. + #[serde(rename = "created_at")] + pub created_at: Option, + /// The `DeploymentMeta` `user_id`. + #[serde(rename = "user_id")] + pub user_id: Option, + /// The `DeploymentMeta` `user_name`. + #[serde(rename = "user_name")] + pub user_name: Option, + /// The `DeploymentMeta` `user_uuid`. + #[serde(rename = "user_uuid")] + pub user_uuid: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DeploymentMeta { + pub fn new() -> DeploymentMeta { + DeploymentMeta { + created_at: None, + user_id: None, + user_name: None, + user_uuid: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn created_at(mut self, value: String) -> Self { + self.created_at = Some(value); + self + } + + pub fn user_id(mut self, value: i64) -> Self { + self.user_id = Some(value); + self + } + + pub fn user_name(mut self, value: String) -> Self { + self.user_name = Some(value); + self + } + + pub fn user_uuid(mut self, value: String) -> Self { + self.user_uuid = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for DeploymentMeta { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for DeploymentMeta { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DeploymentMetaVisitor; + impl<'a> Visitor<'a> for DeploymentMetaVisitor { + type Value = DeploymentMeta; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut created_at: Option = None; + let mut user_id: Option = None; + let mut user_name: Option = None; + let mut user_uuid: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "created_at" => { + if v.is_null() { + continue; + } + created_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "user_id" => { + if v.is_null() { + continue; + } + user_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "user_name" => { + if v.is_null() { + continue; + } + user_name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "user_uuid" => { + if v.is_null() { + continue; + } + user_uuid = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = DeploymentMeta { + created_at, + user_id, + user_name, + user_uuid, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DeploymentMetaVisitor) + } +} diff --git a/src/datadogV2/model/model_deployment_relationship.rs b/src/datadogV2/model/model_deployment_relationship.rs new file mode 100644 index 000000000..c1734804c --- /dev/null +++ b/src/datadogV2/model/model_deployment_relationship.rs @@ -0,0 +1,122 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DeploymentRelationship` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DeploymentRelationship { + /// The definition of `DeploymentRelationshipData` object. + #[serde(rename = "data")] + pub data: Option, + /// The definition of `DeploymentRelationshipMeta` object. + #[serde(rename = "meta")] + pub meta: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DeploymentRelationship { + pub fn new() -> DeploymentRelationship { + DeploymentRelationship { + data: None, + meta: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: crate::datadogV2::model::DeploymentRelationshipData) -> Self { + self.data = Some(value); + self + } + + pub fn meta(mut self, value: crate::datadogV2::model::DeploymentRelationshipMeta) -> Self { + self.meta = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for DeploymentRelationship { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for DeploymentRelationship { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DeploymentRelationshipVisitor; + impl<'a> Visitor<'a> for DeploymentRelationshipVisitor { + type Value = DeploymentRelationship; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut meta: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "meta" => { + if v.is_null() { + continue; + } + meta = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = DeploymentRelationship { + data, + meta, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DeploymentRelationshipVisitor) + } +} diff --git a/src/datadogV2/model/model_deployment_relationship_data.rs b/src/datadogV2/model/model_deployment_relationship_data.rs new file mode 100644 index 000000000..547f23282 --- /dev/null +++ b/src/datadogV2/model/model_deployment_relationship_data.rs @@ -0,0 +1,131 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DeploymentRelationshipData` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DeploymentRelationshipData { + /// The `data` `id`. + #[serde(rename = "id")] + pub id: Option, + /// The definition of `DeploymentRelationshipDataType` object. + #[serde(rename = "type")] + pub type_: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DeploymentRelationshipData { + pub fn new() -> DeploymentRelationshipData { + DeploymentRelationshipData { + id: None, + type_: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn type_(mut self, value: crate::datadogV2::model::DeploymentRelationshipDataType) -> Self { + self.type_ = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for DeploymentRelationshipData { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for DeploymentRelationshipData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DeploymentRelationshipDataVisitor; + impl<'a> Visitor<'a> for DeploymentRelationshipDataVisitor { + type Value = DeploymentRelationshipData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut id: Option = None; + let mut type_: Option = + None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + if v.is_null() { + continue; + } + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::DeploymentRelationshipDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = DeploymentRelationshipData { + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DeploymentRelationshipDataVisitor) + } +} diff --git a/src/datadogV2/model/model_deployment_relationship_data_type.rs b/src/datadogV2/model/model_deployment_relationship_data_type.rs new file mode 100644 index 000000000..83a68b220 --- /dev/null +++ b/src/datadogV2/model/model_deployment_relationship_data_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum DeploymentRelationshipDataType { + DEPLOYMENT, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for DeploymentRelationshipDataType { + fn to_string(&self) -> String { + match self { + Self::DEPLOYMENT => String::from("deployment"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for DeploymentRelationshipDataType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for DeploymentRelationshipDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "deployment" => Self::DEPLOYMENT, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_deployment_relationship_meta.rs b/src/datadogV2/model/model_deployment_relationship_meta.rs new file mode 100644 index 000000000..c99b9a1d0 --- /dev/null +++ b/src/datadogV2/model/model_deployment_relationship_meta.rs @@ -0,0 +1,156 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DeploymentRelationshipMeta` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DeploymentRelationshipMeta { + /// The `meta` `created_at`. + #[serde(rename = "created_at")] + pub created_at: Option, + /// The `meta` `user_id`. + #[serde(rename = "user_id")] + pub user_id: Option, + /// The `meta` `user_name`. + #[serde(rename = "user_name")] + pub user_name: Option, + /// The `meta` `user_uuid`. + #[serde(rename = "user_uuid")] + pub user_uuid: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DeploymentRelationshipMeta { + pub fn new() -> DeploymentRelationshipMeta { + DeploymentRelationshipMeta { + created_at: None, + user_id: None, + user_name: None, + user_uuid: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn created_at(mut self, value: String) -> Self { + self.created_at = Some(value); + self + } + + pub fn user_id(mut self, value: i64) -> Self { + self.user_id = Some(value); + self + } + + pub fn user_name(mut self, value: String) -> Self { + self.user_name = Some(value); + self + } + + pub fn user_uuid(mut self, value: String) -> Self { + self.user_uuid = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for DeploymentRelationshipMeta { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for DeploymentRelationshipMeta { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DeploymentRelationshipMetaVisitor; + impl<'a> Visitor<'a> for DeploymentRelationshipMetaVisitor { + type Value = DeploymentRelationshipMeta; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut created_at: Option = None; + let mut user_id: Option = None; + let mut user_name: Option = None; + let mut user_uuid: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "created_at" => { + if v.is_null() { + continue; + } + created_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "user_id" => { + if v.is_null() { + continue; + } + user_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "user_name" => { + if v.is_null() { + continue; + } + user_name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "user_uuid" => { + if v.is_null() { + continue; + } + user_uuid = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = DeploymentRelationshipMeta { + created_at, + user_id, + user_name, + user_uuid, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DeploymentRelationshipMetaVisitor) + } +} diff --git a/src/datadogV2/model/model_disable_app_response.rs b/src/datadogV2/model/model_disable_app_response.rs new file mode 100644 index 000000000..eea85cc6d --- /dev/null +++ b/src/datadogV2/model/model_disable_app_response.rs @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DisableAppResponse` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DisableAppResponse { + /// The definition of `DisableAppResponseData` object. + #[serde(rename = "data")] + pub data: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DisableAppResponse { + pub fn new() -> DisableAppResponse { + DisableAppResponse { + data: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: crate::datadogV2::model::DisableAppResponseData) -> Self { + self.data = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for DisableAppResponse { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for DisableAppResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DisableAppResponseVisitor; + impl<'a> Visitor<'a> for DisableAppResponseVisitor { + type Value = DisableAppResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = DisableAppResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DisableAppResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_disable_app_response_data.rs b/src/datadogV2/model/model_disable_app_response_data.rs new file mode 100644 index 000000000..1d6716873 --- /dev/null +++ b/src/datadogV2/model/model_disable_app_response_data.rs @@ -0,0 +1,169 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DisableAppResponseData` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DisableAppResponseData { + /// The definition of `DisableAppResponseDataAttributes` object. + #[serde(rename = "attributes")] + pub attributes: Option, + /// The `data` `id`. + #[serde(rename = "id")] + pub id: Option, + /// The definition of `DeploymentMeta` object. + #[serde(rename = "meta")] + pub meta: Option, + /// The definition of `DisableAppResponseDataType` object. + #[serde(rename = "type")] + pub type_: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DisableAppResponseData { + pub fn new() -> DisableAppResponseData { + DisableAppResponseData { + attributes: None, + id: None, + meta: None, + type_: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes( + mut self, + value: crate::datadogV2::model::DisableAppResponseDataAttributes, + ) -> Self { + self.attributes = Some(value); + self + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn meta(mut self, value: crate::datadogV2::model::DeploymentMeta) -> Self { + self.meta = Some(value); + self + } + + pub fn type_(mut self, value: crate::datadogV2::model::DisableAppResponseDataType) -> Self { + self.type_ = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for DisableAppResponseData { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for DisableAppResponseData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DisableAppResponseDataVisitor; + impl<'a> Visitor<'a> for DisableAppResponseDataVisitor { + type Value = DisableAppResponseData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::DisableAppResponseDataAttributes, + > = None; + let mut id: Option = None; + let mut meta: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + if v.is_null() { + continue; + } + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "meta" => { + if v.is_null() { + continue; + } + meta = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + if v.is_null() { + continue; + } + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::DisableAppResponseDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = DisableAppResponseData { + attributes, + id, + meta, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DisableAppResponseDataVisitor) + } +} diff --git a/src/datadogV2/model/model_disable_app_response_data_attributes.rs b/src/datadogV2/model/model_disable_app_response_data_attributes.rs new file mode 100644 index 000000000..e7678f884 --- /dev/null +++ b/src/datadogV2/model/model_disable_app_response_data_attributes.rs @@ -0,0 +1,106 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `DisableAppResponseDataAttributes` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DisableAppResponseDataAttributes { + /// The `attributes` `app_version_id`. + #[serde(rename = "app_version_id")] + pub app_version_id: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DisableAppResponseDataAttributes { + pub fn new() -> DisableAppResponseDataAttributes { + DisableAppResponseDataAttributes { + app_version_id: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn app_version_id(mut self, value: String) -> Self { + self.app_version_id = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for DisableAppResponseDataAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for DisableAppResponseDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DisableAppResponseDataAttributesVisitor; + impl<'a> Visitor<'a> for DisableAppResponseDataAttributesVisitor { + type Value = DisableAppResponseDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut app_version_id: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "app_version_id" => { + if v.is_null() { + continue; + } + app_version_id = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = DisableAppResponseDataAttributes { + app_version_id, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DisableAppResponseDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_disable_app_response_data_type.rs b/src/datadogV2/model/model_disable_app_response_data_type.rs new file mode 100644 index 000000000..37010fba7 --- /dev/null +++ b/src/datadogV2/model/model_disable_app_response_data_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum DisableAppResponseDataType { + DEPLOYMENT, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for DisableAppResponseDataType { + fn to_string(&self) -> String { + match self { + Self::DEPLOYMENT => String::from("deployment"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for DisableAppResponseDataType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for DisableAppResponseDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "deployment" => Self::DEPLOYMENT, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_get_app_response.rs b/src/datadogV2/model/model_get_app_response.rs new file mode 100644 index 000000000..0c9065bd0 --- /dev/null +++ b/src/datadogV2/model/model_get_app_response.rs @@ -0,0 +1,161 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `GetAppResponse` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GetAppResponse { + /// The definition of `GetAppResponseData` object. + #[serde(rename = "data")] + pub data: Option, + /// The `GetAppResponse` `included`. + #[serde(rename = "included")] + pub included: Option>, + /// The definition of `AppMeta` object. + #[serde(rename = "meta")] + pub meta: Option, + /// The definition of `GetAppResponseRelationship` object. + #[serde(rename = "relationship")] + pub relationship: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GetAppResponse { + pub fn new() -> GetAppResponse { + GetAppResponse { + data: None, + included: None, + meta: None, + relationship: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: crate::datadogV2::model::GetAppResponseData) -> Self { + self.data = Some(value); + self + } + + pub fn included(mut self, value: Vec) -> Self { + self.included = Some(value); + self + } + + pub fn meta(mut self, value: crate::datadogV2::model::AppMeta) -> Self { + self.meta = Some(value); + self + } + + pub fn relationship( + mut self, + value: crate::datadogV2::model::GetAppResponseRelationship, + ) -> Self { + self.relationship = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for GetAppResponse { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for GetAppResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GetAppResponseVisitor; + impl<'a> Visitor<'a> for GetAppResponseVisitor { + type Value = GetAppResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut included: Option> = None; + let mut meta: Option = None; + let mut relationship: Option = + None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "included" => { + if v.is_null() { + continue; + } + included = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "meta" => { + if v.is_null() { + continue; + } + meta = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "relationship" => { + if v.is_null() { + continue; + } + relationship = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = GetAppResponse { + data, + included, + meta, + relationship, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GetAppResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_get_app_response_data.rs b/src/datadogV2/model/model_get_app_response_data.rs new file mode 100644 index 000000000..e6957dc05 --- /dev/null +++ b/src/datadogV2/model/model_get_app_response_data.rs @@ -0,0 +1,125 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `GetAppResponseData` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GetAppResponseData { + /// The definition of `GetAppResponseDataAttributes` object. + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::GetAppResponseDataAttributes, + /// The `data` `id`. + #[serde(rename = "id")] + pub id: String, + /// The definition of `GetAppResponseDataType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::GetAppResponseDataType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GetAppResponseData { + pub fn new( + attributes: crate::datadogV2::model::GetAppResponseDataAttributes, + id: String, + type_: crate::datadogV2::model::GetAppResponseDataType, + ) -> GetAppResponseData { + GetAppResponseData { + attributes, + id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for GetAppResponseData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GetAppResponseDataVisitor; + impl<'a> Visitor<'a> for GetAppResponseDataVisitor { + type Value = GetAppResponseData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option = + None; + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::GetAppResponseDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = GetAppResponseData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GetAppResponseDataVisitor) + } +} diff --git a/src/datadogV2/model/model_get_app_response_data_attributes.rs b/src/datadogV2/model/model_get_app_response_data_attributes.rs new file mode 100644 index 000000000..36144953c --- /dev/null +++ b/src/datadogV2/model/model_get_app_response_data_attributes.rs @@ -0,0 +1,245 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `GetAppResponseDataAttributes` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GetAppResponseDataAttributes { + /// The `attributes` `components`. + #[serde(rename = "components")] + pub components: Option>, + /// The `attributes` `description`. + #[serde(rename = "description")] + pub description: Option, + /// The `attributes` `embeddedQueries`. + #[serde(rename = "embeddedQueries")] + pub embedded_queries: Option>, + /// The `attributes` `favorite`. + #[serde(rename = "favorite")] + pub favorite: Option, + /// The definition of `InputSchema` object. + #[serde(rename = "inputSchema")] + pub input_schema: Option, + /// The `attributes` `name`. + #[serde(rename = "name")] + pub name: Option, + /// The `attributes` `rootInstanceName`. + #[serde(rename = "rootInstanceName")] + pub root_instance_name: Option, + /// The `attributes` `scripts`. + #[serde(rename = "scripts")] + pub scripts: Option>, + /// The `attributes` `tags`. + #[serde(rename = "tags")] + pub tags: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GetAppResponseDataAttributes { + pub fn new() -> GetAppResponseDataAttributes { + GetAppResponseDataAttributes { + components: None, + description: None, + embedded_queries: None, + favorite: None, + input_schema: None, + name: None, + root_instance_name: None, + scripts: None, + tags: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn components(mut self, value: Vec) -> Self { + self.components = Some(value); + self + } + + pub fn description(mut self, value: String) -> Self { + self.description = Some(value); + self + } + + pub fn embedded_queries(mut self, value: Vec) -> Self { + self.embedded_queries = Some(value); + self + } + + pub fn favorite(mut self, value: bool) -> Self { + self.favorite = Some(value); + self + } + + pub fn input_schema(mut self, value: crate::datadogV2::model::InputSchema) -> Self { + self.input_schema = Some(value); + self + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn root_instance_name(mut self, value: String) -> Self { + self.root_instance_name = Some(value); + self + } + + pub fn scripts(mut self, value: Vec) -> Self { + self.scripts = Some(value); + self + } + + pub fn tags(mut self, value: Vec) -> Self { + self.tags = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for GetAppResponseDataAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for GetAppResponseDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GetAppResponseDataAttributesVisitor; + impl<'a> Visitor<'a> for GetAppResponseDataAttributesVisitor { + type Value = GetAppResponseDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut components: Option> = None; + let mut description: Option = None; + let mut embedded_queries: Option> = None; + let mut favorite: Option = None; + let mut input_schema: Option = None; + let mut name: Option = None; + let mut root_instance_name: Option = None; + let mut scripts: Option> = None; + let mut tags: Option> = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "components" => { + if v.is_null() { + continue; + } + components = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "description" => { + if v.is_null() { + continue; + } + description = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "embeddedQueries" => { + if v.is_null() { + continue; + } + embedded_queries = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "favorite" => { + if v.is_null() { + continue; + } + favorite = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "inputSchema" => { + if v.is_null() { + continue; + } + input_schema = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "rootInstanceName" => { + if v.is_null() { + continue; + } + root_instance_name = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "scripts" => { + if v.is_null() { + continue; + } + scripts = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "tags" => { + if v.is_null() { + continue; + } + tags = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = GetAppResponseDataAttributes { + components, + description, + embedded_queries, + favorite, + input_schema, + name, + root_instance_name, + scripts, + tags, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GetAppResponseDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_get_app_response_data_type.rs b/src/datadogV2/model/model_get_app_response_data_type.rs new file mode 100644 index 000000000..7f98d2bc2 --- /dev/null +++ b/src/datadogV2/model/model_get_app_response_data_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum GetAppResponseDataType { + APPDEFINITIONS, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for GetAppResponseDataType { + fn to_string(&self) -> String { + match self { + Self::APPDEFINITIONS => String::from("appDefinitions"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for GetAppResponseDataType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for GetAppResponseDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "appDefinitions" => Self::APPDEFINITIONS, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_get_app_response_relationship.rs b/src/datadogV2/model/model_get_app_response_relationship.rs new file mode 100644 index 000000000..dd4991bcf --- /dev/null +++ b/src/datadogV2/model/model_get_app_response_relationship.rs @@ -0,0 +1,123 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `GetAppResponseRelationship` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct GetAppResponseRelationship { + /// The `relationship` `connections`. + #[serde(rename = "connections")] + pub connections: Option>, + /// The definition of `DeploymentRelationship` object. + #[serde(rename = "deployment")] + pub deployment: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl GetAppResponseRelationship { + pub fn new() -> GetAppResponseRelationship { + GetAppResponseRelationship { + connections: None, + deployment: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn connections(mut self, value: Vec) -> Self { + self.connections = Some(value); + self + } + + pub fn deployment(mut self, value: crate::datadogV2::model::DeploymentRelationship) -> Self { + self.deployment = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for GetAppResponseRelationship { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for GetAppResponseRelationship { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct GetAppResponseRelationshipVisitor; + impl<'a> Visitor<'a> for GetAppResponseRelationshipVisitor { + type Value = GetAppResponseRelationship; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut connections: Option> = None; + let mut deployment: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "connections" => { + if v.is_null() { + continue; + } + connections = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "deployment" => { + if v.is_null() { + continue; + } + deployment = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = GetAppResponseRelationship { + connections, + deployment, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(GetAppResponseRelationshipVisitor) + } +} diff --git a/src/datadogV2/model/model_input_schema.rs b/src/datadogV2/model/model_input_schema.rs new file mode 100644 index 000000000..144228b34 --- /dev/null +++ b/src/datadogV2/model/model_input_schema.rs @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `InputSchema` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct InputSchema { + /// The definition of `InputSchemaData` object. + #[serde(rename = "data")] + pub data: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl InputSchema { + pub fn new() -> InputSchema { + InputSchema { + data: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: crate::datadogV2::model::InputSchemaData) -> Self { + self.data = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for InputSchema { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for InputSchema { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct InputSchemaVisitor; + impl<'a> Visitor<'a> for InputSchemaVisitor { + type Value = InputSchema; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = InputSchema { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(InputSchemaVisitor) + } +} diff --git a/src/datadogV2/model/model_input_schema_data.rs b/src/datadogV2/model/model_input_schema_data.rs new file mode 100644 index 000000000..6f161649d --- /dev/null +++ b/src/datadogV2/model/model_input_schema_data.rs @@ -0,0 +1,148 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `InputSchemaData` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct InputSchemaData { + /// The definition of `InputSchemaDataAttributes` object. + #[serde(rename = "attributes")] + pub attributes: Option, + /// The `data` `id`. + #[serde(rename = "id")] + pub id: Option, + /// The definition of `InputSchemaDataType` object. + #[serde(rename = "type")] + pub type_: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl InputSchemaData { + pub fn new() -> InputSchemaData { + InputSchemaData { + attributes: None, + id: None, + type_: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes(mut self, value: crate::datadogV2::model::InputSchemaDataAttributes) -> Self { + self.attributes = Some(value); + self + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn type_(mut self, value: crate::datadogV2::model::InputSchemaDataType) -> Self { + self.type_ = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for InputSchemaData { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for InputSchemaData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct InputSchemaDataVisitor; + impl<'a> Visitor<'a> for InputSchemaDataVisitor { + type Value = InputSchemaData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option = + None; + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + if v.is_null() { + continue; + } + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + if v.is_null() { + continue; + } + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::InputSchemaDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = InputSchemaData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(InputSchemaDataVisitor) + } +} diff --git a/src/datadogV2/model/model_input_schema_data_attributes.rs b/src/datadogV2/model/model_input_schema_data_attributes.rs new file mode 100644 index 000000000..6202839f0 --- /dev/null +++ b/src/datadogV2/model/model_input_schema_data_attributes.rs @@ -0,0 +1,110 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `InputSchemaDataAttributes` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct InputSchemaDataAttributes { + /// The `attributes` `parameters`. + #[serde(rename = "parameters")] + pub parameters: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl InputSchemaDataAttributes { + pub fn new() -> InputSchemaDataAttributes { + InputSchemaDataAttributes { + parameters: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn parameters( + mut self, + value: Vec, + ) -> Self { + self.parameters = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for InputSchemaDataAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for InputSchemaDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct InputSchemaDataAttributesVisitor; + impl<'a> Visitor<'a> for InputSchemaDataAttributesVisitor { + type Value = InputSchemaDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut parameters: Option< + Vec, + > = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "parameters" => { + if v.is_null() { + continue; + } + parameters = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = InputSchemaDataAttributes { + parameters, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(InputSchemaDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_input_schema_data_attributes_parameters_items.rs b/src/datadogV2/model/model_input_schema_data_attributes_parameters_items.rs new file mode 100644 index 000000000..6dffaebc7 --- /dev/null +++ b/src/datadogV2/model/model_input_schema_data_attributes_parameters_items.rs @@ -0,0 +1,110 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `InputSchemaDataAttributesParametersItems` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct InputSchemaDataAttributesParametersItems { + /// The definition of `InputSchemaDataAttributesParametersItemsData` object. + #[serde(rename = "data")] + pub data: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl InputSchemaDataAttributesParametersItems { + pub fn new() -> InputSchemaDataAttributesParametersItems { + InputSchemaDataAttributesParametersItems { + data: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data( + mut self, + value: crate::datadogV2::model::InputSchemaDataAttributesParametersItemsData, + ) -> Self { + self.data = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for InputSchemaDataAttributesParametersItems { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for InputSchemaDataAttributesParametersItems { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct InputSchemaDataAttributesParametersItemsVisitor; + impl<'a> Visitor<'a> for InputSchemaDataAttributesParametersItemsVisitor { + type Value = InputSchemaDataAttributesParametersItems; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option< + crate::datadogV2::model::InputSchemaDataAttributesParametersItemsData, + > = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = InputSchemaDataAttributesParametersItems { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(InputSchemaDataAttributesParametersItemsVisitor) + } +} diff --git a/src/datadogV2/model/model_input_schema_data_attributes_parameters_items_data.rs b/src/datadogV2/model/model_input_schema_data_attributes_parameters_items_data.rs new file mode 100644 index 000000000..dd194c22f --- /dev/null +++ b/src/datadogV2/model/model_input_schema_data_attributes_parameters_items_data.rs @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `InputSchemaDataAttributesParametersItemsData` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct InputSchemaDataAttributesParametersItemsData { + /// The definition of `InputSchemaDataAttributesParametersItemsDataAttributes` object. + #[serde(rename = "attributes")] + pub attributes: + Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl InputSchemaDataAttributesParametersItemsData { + pub fn new() -> InputSchemaDataAttributesParametersItemsData { + InputSchemaDataAttributesParametersItemsData { + attributes: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes( + mut self, + value: crate::datadogV2::model::InputSchemaDataAttributesParametersItemsDataAttributes, + ) -> Self { + self.attributes = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for InputSchemaDataAttributesParametersItemsData { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for InputSchemaDataAttributesParametersItemsData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct InputSchemaDataAttributesParametersItemsDataVisitor; + impl<'a> Visitor<'a> for InputSchemaDataAttributesParametersItemsDataVisitor { + type Value = InputSchemaDataAttributesParametersItemsData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::InputSchemaDataAttributesParametersItemsDataAttributes, + > = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + if v.is_null() { + continue; + } + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = InputSchemaDataAttributesParametersItemsData { + attributes, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(InputSchemaDataAttributesParametersItemsDataVisitor) + } +} diff --git a/src/datadogV2/model/model_input_schema_data_attributes_parameters_items_data_attributes.rs b/src/datadogV2/model/model_input_schema_data_attributes_parameters_items_data_attributes.rs new file mode 100644 index 000000000..0d6349e35 --- /dev/null +++ b/src/datadogV2/model/model_input_schema_data_attributes_parameters_items_data_attributes.rs @@ -0,0 +1,192 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `InputSchemaDataAttributesParametersItemsDataAttributes` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct InputSchemaDataAttributesParametersItemsDataAttributes { + /// The `attributes` `defaultValue`. + #[serde(rename = "defaultValue")] + pub default_value: Option, + /// The `attributes` `description`. + #[serde(rename = "description")] + pub description: Option, + /// The `attributes` `enum`. + #[serde(rename = "enum")] + pub enum_: Option>, + /// The `attributes` `label`. + #[serde(rename = "label")] + pub label: Option, + /// The `attributes` `name`. + #[serde(rename = "name")] + pub name: Option, + /// The `attributes` `type`. + #[serde(rename = "type")] + pub type_: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl InputSchemaDataAttributesParametersItemsDataAttributes { + pub fn new() -> InputSchemaDataAttributesParametersItemsDataAttributes { + InputSchemaDataAttributesParametersItemsDataAttributes { + default_value: None, + description: None, + enum_: None, + label: None, + name: None, + type_: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn default_value(mut self, value: serde_json::Value) -> Self { + self.default_value = Some(value); + self + } + + pub fn description(mut self, value: String) -> Self { + self.description = Some(value); + self + } + + pub fn enum_(mut self, value: Vec) -> Self { + self.enum_ = Some(value); + self + } + + pub fn label(mut self, value: String) -> Self { + self.label = Some(value); + self + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn type_(mut self, value: String) -> Self { + self.type_ = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for InputSchemaDataAttributesParametersItemsDataAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for InputSchemaDataAttributesParametersItemsDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct InputSchemaDataAttributesParametersItemsDataAttributesVisitor; + impl<'a> Visitor<'a> for InputSchemaDataAttributesParametersItemsDataAttributesVisitor { + type Value = InputSchemaDataAttributesParametersItemsDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut default_value: Option = None; + let mut description: Option = None; + let mut enum_: Option> = None; + let mut label: Option = None; + let mut name: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "defaultValue" => { + if v.is_null() { + continue; + } + default_value = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "description" => { + if v.is_null() { + continue; + } + description = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "enum" => { + if v.is_null() { + continue; + } + enum_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "label" => { + if v.is_null() { + continue; + } + label = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + if v.is_null() { + continue; + } + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = InputSchemaDataAttributesParametersItemsDataAttributes { + default_value, + description, + enum_, + label, + name, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(InputSchemaDataAttributesParametersItemsDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_input_schema_data_type.rs b/src/datadogV2/model/model_input_schema_data_type.rs new file mode 100644 index 000000000..758399682 --- /dev/null +++ b/src/datadogV2/model/model_input_schema_data_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum InputSchemaDataType { + INPUTSCHEMA, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for InputSchemaDataType { + fn to_string(&self) -> String { + match self { + Self::INPUTSCHEMA => String::from("inputSchema"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for InputSchemaDataType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for InputSchemaDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "inputSchema" => Self::INPUTSCHEMA, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_list_apps_response.rs b/src/datadogV2/model/model_list_apps_response.rs new file mode 100644 index 000000000..3bf0b219e --- /dev/null +++ b/src/datadogV2/model/model_list_apps_response.rs @@ -0,0 +1,140 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `ListAppsResponse` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ListAppsResponse { + /// The `ListAppsResponse` `data`. + #[serde(rename = "data")] + pub data: Option>, + /// The `ListAppsResponse` `included`. + #[serde(rename = "included")] + pub included: Option>, + /// The definition of `ListAppsResponseMeta` object. + #[serde(rename = "meta")] + pub meta: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ListAppsResponse { + pub fn new() -> ListAppsResponse { + ListAppsResponse { + data: None, + included: None, + meta: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: Vec) -> Self { + self.data = Some(value); + self + } + + pub fn included(mut self, value: Vec) -> Self { + self.included = Some(value); + self + } + + pub fn meta(mut self, value: crate::datadogV2::model::ListAppsResponseMeta) -> Self { + self.meta = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for ListAppsResponse { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for ListAppsResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ListAppsResponseVisitor; + impl<'a> Visitor<'a> for ListAppsResponseVisitor { + type Value = ListAppsResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option> = + None; + let mut included: Option> = None; + let mut meta: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "included" => { + if v.is_null() { + continue; + } + included = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "meta" => { + if v.is_null() { + continue; + } + meta = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = ListAppsResponse { + data, + included, + meta, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ListAppsResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_list_apps_response_data_items.rs b/src/datadogV2/model/model_list_apps_response_data_items.rs new file mode 100644 index 000000000..482216951 --- /dev/null +++ b/src/datadogV2/model/model_list_apps_response_data_items.rs @@ -0,0 +1,167 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `ListAppsResponseDataItems` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ListAppsResponseDataItems { + /// The definition of `ListAppsResponseDataItemsAttributes` object. + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::ListAppsResponseDataItemsAttributes, + /// The `items` `id`. + #[serde(rename = "id")] + pub id: String, + /// The definition of `AppMeta` object. + #[serde(rename = "meta")] + pub meta: Option, + /// The definition of `ListAppsResponseDataItemsRelationships` object. + #[serde(rename = "relationships")] + pub relationships: Option, + /// The definition of `ListAppsResponseDataItemsType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::ListAppsResponseDataItemsType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ListAppsResponseDataItems { + pub fn new( + attributes: crate::datadogV2::model::ListAppsResponseDataItemsAttributes, + id: String, + type_: crate::datadogV2::model::ListAppsResponseDataItemsType, + ) -> ListAppsResponseDataItems { + ListAppsResponseDataItems { + attributes, + id, + meta: None, + relationships: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn meta(mut self, value: crate::datadogV2::model::AppMeta) -> Self { + self.meta = Some(value); + self + } + + pub fn relationships( + mut self, + value: crate::datadogV2::model::ListAppsResponseDataItemsRelationships, + ) -> Self { + self.relationships = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for ListAppsResponseDataItems { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ListAppsResponseDataItemsVisitor; + impl<'a> Visitor<'a> for ListAppsResponseDataItemsVisitor { + type Value = ListAppsResponseDataItems; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::ListAppsResponseDataItemsAttributes, + > = None; + let mut id: Option = None; + let mut meta: Option = None; + let mut relationships: Option< + crate::datadogV2::model::ListAppsResponseDataItemsRelationships, + > = None; + let mut type_: Option = + None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "meta" => { + if v.is_null() { + continue; + } + meta = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "relationships" => { + if v.is_null() { + continue; + } + relationships = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::ListAppsResponseDataItemsType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = ListAppsResponseDataItems { + attributes, + id, + meta, + relationships, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ListAppsResponseDataItemsVisitor) + } +} diff --git a/src/datadogV2/model/model_list_apps_response_data_items_attributes.rs b/src/datadogV2/model/model_list_apps_response_data_items_attributes.rs new file mode 100644 index 000000000..6826be218 --- /dev/null +++ b/src/datadogV2/model/model_list_apps_response_data_items_attributes.rs @@ -0,0 +1,175 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `ListAppsResponseDataItemsAttributes` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ListAppsResponseDataItemsAttributes { + /// The `attributes` `description`. + #[serde(rename = "description")] + pub description: Option, + /// The `attributes` `favorite`. + #[serde(rename = "favorite")] + pub favorite: Option, + /// The `attributes` `name`. + #[serde(rename = "name")] + pub name: Option, + /// The `attributes` `selfService`. + #[serde(rename = "selfService")] + pub self_service: Option, + /// The `attributes` `tags`. + #[serde(rename = "tags")] + pub tags: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ListAppsResponseDataItemsAttributes { + pub fn new() -> ListAppsResponseDataItemsAttributes { + ListAppsResponseDataItemsAttributes { + description: None, + favorite: None, + name: None, + self_service: None, + tags: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn description(mut self, value: String) -> Self { + self.description = Some(value); + self + } + + pub fn favorite(mut self, value: bool) -> Self { + self.favorite = Some(value); + self + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn self_service(mut self, value: bool) -> Self { + self.self_service = Some(value); + self + } + + pub fn tags(mut self, value: Vec) -> Self { + self.tags = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for ListAppsResponseDataItemsAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for ListAppsResponseDataItemsAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ListAppsResponseDataItemsAttributesVisitor; + impl<'a> Visitor<'a> for ListAppsResponseDataItemsAttributesVisitor { + type Value = ListAppsResponseDataItemsAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut description: Option = None; + let mut favorite: Option = None; + let mut name: Option = None; + let mut self_service: Option = None; + let mut tags: Option> = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "description" => { + if v.is_null() { + continue; + } + description = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "favorite" => { + if v.is_null() { + continue; + } + favorite = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "selfService" => { + if v.is_null() { + continue; + } + self_service = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "tags" => { + if v.is_null() { + continue; + } + tags = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = ListAppsResponseDataItemsAttributes { + description, + favorite, + name, + self_service, + tags, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ListAppsResponseDataItemsAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_list_apps_response_data_items_relationships.rs b/src/datadogV2/model/model_list_apps_response_data_items_relationships.rs new file mode 100644 index 000000000..d434b06ee --- /dev/null +++ b/src/datadogV2/model/model_list_apps_response_data_items_relationships.rs @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `ListAppsResponseDataItemsRelationships` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ListAppsResponseDataItemsRelationships { + /// The definition of `DeploymentRelationship` object. + #[serde(rename = "deployment")] + pub deployment: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ListAppsResponseDataItemsRelationships { + pub fn new() -> ListAppsResponseDataItemsRelationships { + ListAppsResponseDataItemsRelationships { + deployment: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn deployment(mut self, value: crate::datadogV2::model::DeploymentRelationship) -> Self { + self.deployment = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for ListAppsResponseDataItemsRelationships { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for ListAppsResponseDataItemsRelationships { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ListAppsResponseDataItemsRelationshipsVisitor; + impl<'a> Visitor<'a> for ListAppsResponseDataItemsRelationshipsVisitor { + type Value = ListAppsResponseDataItemsRelationships; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut deployment: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "deployment" => { + if v.is_null() { + continue; + } + deployment = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = ListAppsResponseDataItemsRelationships { + deployment, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ListAppsResponseDataItemsRelationshipsVisitor) + } +} diff --git a/src/datadogV2/model/model_list_apps_response_data_items_type.rs b/src/datadogV2/model/model_list_apps_response_data_items_type.rs new file mode 100644 index 000000000..cc83fe004 --- /dev/null +++ b/src/datadogV2/model/model_list_apps_response_data_items_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum ListAppsResponseDataItemsType { + APPDEFINITIONS, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for ListAppsResponseDataItemsType { + fn to_string(&self) -> String { + match self { + Self::APPDEFINITIONS => String::from("appDefinitions"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for ListAppsResponseDataItemsType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for ListAppsResponseDataItemsType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "appDefinitions" => Self::APPDEFINITIONS, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_list_apps_response_meta.rs b/src/datadogV2/model/model_list_apps_response_meta.rs new file mode 100644 index 000000000..a54bedf47 --- /dev/null +++ b/src/datadogV2/model/model_list_apps_response_meta.rs @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `ListAppsResponseMeta` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ListAppsResponseMeta { + /// The definition of `ListAppsResponseMetaPage` object. + #[serde(rename = "page")] + pub page: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ListAppsResponseMeta { + pub fn new() -> ListAppsResponseMeta { + ListAppsResponseMeta { + page: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn page(mut self, value: crate::datadogV2::model::ListAppsResponseMetaPage) -> Self { + self.page = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for ListAppsResponseMeta { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for ListAppsResponseMeta { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ListAppsResponseMetaVisitor; + impl<'a> Visitor<'a> for ListAppsResponseMetaVisitor { + type Value = ListAppsResponseMeta; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut page: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "page" => { + if v.is_null() { + continue; + } + page = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = ListAppsResponseMeta { + page, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ListAppsResponseMetaVisitor) + } +} diff --git a/src/datadogV2/model/model_list_apps_response_meta_page.rs b/src/datadogV2/model/model_list_apps_response_meta_page.rs new file mode 100644 index 000000000..b1408b5f2 --- /dev/null +++ b/src/datadogV2/model/model_list_apps_response_meta_page.rs @@ -0,0 +1,124 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `ListAppsResponseMetaPage` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ListAppsResponseMetaPage { + /// The `page` `totalCount`. + #[serde(rename = "totalCount")] + pub total_count: Option, + /// The `page` `totalFilteredCount`. + #[serde(rename = "totalFilteredCount")] + pub total_filtered_count: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ListAppsResponseMetaPage { + pub fn new() -> ListAppsResponseMetaPage { + ListAppsResponseMetaPage { + total_count: None, + total_filtered_count: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn total_count(mut self, value: i64) -> Self { + self.total_count = Some(value); + self + } + + pub fn total_filtered_count(mut self, value: i64) -> Self { + self.total_filtered_count = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for ListAppsResponseMetaPage { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for ListAppsResponseMetaPage { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ListAppsResponseMetaPageVisitor; + impl<'a> Visitor<'a> for ListAppsResponseMetaPageVisitor { + type Value = ListAppsResponseMetaPage; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut total_count: Option = None; + let mut total_filtered_count: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "totalCount" => { + if v.is_null() { + continue; + } + total_count = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "totalFilteredCount" => { + if v.is_null() { + continue; + } + total_filtered_count = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = ListAppsResponseMetaPage { + total_count, + total_filtered_count, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ListAppsResponseMetaPageVisitor) + } +} diff --git a/src/datadogV2/model/model_query.rs b/src/datadogV2/model/model_query.rs new file mode 100644 index 000000000..e90511857 --- /dev/null +++ b/src/datadogV2/model/model_query.rs @@ -0,0 +1,154 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `Query` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct Query { + /// The `Query` `events`. + #[serde(rename = "events")] + pub events: Option>, + /// The `Query` `id`. + #[serde(rename = "id")] + pub id: String, + /// The `Query` `name`. + #[serde(rename = "name")] + pub name: String, + /// The `Query` `properties`. + #[serde(rename = "properties")] + pub properties: Option, + /// The definition of `QueryType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::QueryType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl Query { + pub fn new(id: String, name: String, type_: crate::datadogV2::model::QueryType) -> Query { + Query { + events: None, + id, + name, + properties: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn events(mut self, value: Vec) -> Self { + self.events = Some(value); + self + } + + pub fn properties(mut self, value: serde_json::Value) -> Self { + self.properties = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for Query { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct QueryVisitor; + impl<'a> Visitor<'a> for QueryVisitor { + type Value = Query; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut events: Option> = None; + let mut id: Option = None; + let mut name: Option = None; + let mut properties: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "events" => { + if v.is_null() { + continue; + } + events = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "properties" => { + if v.is_null() { + continue; + } + properties = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::QueryType::UnparsedObject(_type_) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let name = name.ok_or_else(|| M::Error::missing_field("name"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = Query { + events, + id, + name, + properties, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(QueryVisitor) + } +} diff --git a/src/datadogV2/model/model_query_type.rs b/src/datadogV2/model/model_query_type.rs new file mode 100644 index 000000000..b0f11af15 --- /dev/null +++ b/src/datadogV2/model/model_query_type.rs @@ -0,0 +1,54 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum QueryType { + ACTION, + STATEVARIABLE, + DATATRANSFORM, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for QueryType { + fn to_string(&self) -> String { + match self { + Self::ACTION => String::from("action"), + Self::STATEVARIABLE => String::from("stateVariable"), + Self::DATATRANSFORM => String::from("dataTransform"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for QueryType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for QueryType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "action" => Self::ACTION, + "stateVariable" => Self::STATEVARIABLE, + "dataTransform" => Self::DATATRANSFORM, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_script.rs b/src/datadogV2/model/model_script.rs new file mode 100644 index 000000000..af656f432 --- /dev/null +++ b/src/datadogV2/model/model_script.rs @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `Script` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct Script { + /// The definition of `ScriptData` object. + #[serde(rename = "data")] + pub data: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl Script { + pub fn new() -> Script { + Script { + data: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: crate::datadogV2::model::ScriptData) -> Self { + self.data = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for Script { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for Script { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ScriptVisitor; + impl<'a> Visitor<'a> for ScriptVisitor { + type Value = Script; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = Script { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ScriptVisitor) + } +} diff --git a/src/datadogV2/model/model_script_data.rs b/src/datadogV2/model/model_script_data.rs new file mode 100644 index 000000000..587926c66 --- /dev/null +++ b/src/datadogV2/model/model_script_data.rs @@ -0,0 +1,149 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `ScriptData` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ScriptData { + /// The definition of `ScriptDataAttributes` object. + #[serde(rename = "attributes")] + pub attributes: Option, + /// The `data` `id`. + #[serde(rename = "id")] + pub id: Option, + /// The definition of `ScriptDataType` object. + #[serde(rename = "type")] + pub type_: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ScriptData { + pub fn new() -> ScriptData { + ScriptData { + attributes: None, + id: None, + type_: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes(mut self, value: crate::datadogV2::model::ScriptDataAttributes) -> Self { + self.attributes = Some(value); + self + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn type_(mut self, value: crate::datadogV2::model::ScriptDataType) -> Self { + self.type_ = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for ScriptData { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for ScriptData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ScriptDataVisitor; + impl<'a> Visitor<'a> for ScriptDataVisitor { + type Value = ScriptData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option = None; + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + if v.is_null() { + continue; + } + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + if v.is_null() { + continue; + } + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::ScriptDataType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = ScriptData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ScriptDataVisitor) + } +} diff --git a/src/datadogV2/model/model_script_data_attributes.rs b/src/datadogV2/model/model_script_data_attributes.rs new file mode 100644 index 000000000..4181b8383 --- /dev/null +++ b/src/datadogV2/model/model_script_data_attributes.rs @@ -0,0 +1,139 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `ScriptDataAttributes` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ScriptDataAttributes { + /// The `attributes` `name`. + #[serde(rename = "name")] + pub name: Option, + /// The `attributes` `src`. + #[serde(rename = "src")] + pub src: Option, + /// The `attributes` `type`. + #[serde(rename = "type")] + pub type_: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ScriptDataAttributes { + pub fn new() -> ScriptDataAttributes { + ScriptDataAttributes { + name: None, + src: None, + type_: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn src(mut self, value: String) -> Self { + self.src = Some(value); + self + } + + pub fn type_(mut self, value: String) -> Self { + self.type_ = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for ScriptDataAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for ScriptDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ScriptDataAttributesVisitor; + impl<'a> Visitor<'a> for ScriptDataAttributesVisitor { + type Value = ScriptDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut name: Option = None; + let mut src: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "src" => { + if v.is_null() { + continue; + } + src = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + if v.is_null() { + continue; + } + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = ScriptDataAttributes { + name, + src, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ScriptDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_script_data_type.rs b/src/datadogV2/model/model_script_data_type.rs new file mode 100644 index 000000000..53ab43d20 --- /dev/null +++ b/src/datadogV2/model/model_script_data_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum ScriptDataType { + SCRIPTS, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for ScriptDataType { + fn to_string(&self) -> String { + match self { + Self::SCRIPTS => String::from("scripts"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for ScriptDataType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for ScriptDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "scripts" => Self::SCRIPTS, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_update_app_request.rs b/src/datadogV2/model/model_update_app_request.rs new file mode 100644 index 000000000..4103d111a --- /dev/null +++ b/src/datadogV2/model/model_update_app_request.rs @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `UpdateAppRequest` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct UpdateAppRequest { + /// The definition of `UpdateAppRequestData` object. + #[serde(rename = "data")] + pub data: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl UpdateAppRequest { + pub fn new() -> UpdateAppRequest { + UpdateAppRequest { + data: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: crate::datadogV2::model::UpdateAppRequestData) -> Self { + self.data = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for UpdateAppRequest { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for UpdateAppRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct UpdateAppRequestVisitor; + impl<'a> Visitor<'a> for UpdateAppRequestVisitor { + type Value = UpdateAppRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = UpdateAppRequest { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(UpdateAppRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_update_app_request_data.rs b/src/datadogV2/model/model_update_app_request_data.rs new file mode 100644 index 000000000..b58b70629 --- /dev/null +++ b/src/datadogV2/model/model_update_app_request_data.rs @@ -0,0 +1,139 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `UpdateAppRequestData` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct UpdateAppRequestData { + /// The definition of `UpdateAppRequestDataAttributes` object. + #[serde(rename = "attributes")] + pub attributes: Option, + /// The `data` `id`. + #[serde(rename = "id")] + pub id: Option, + /// The definition of `UpdateAppRequestDataType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::UpdateAppRequestDataType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl UpdateAppRequestData { + pub fn new(type_: crate::datadogV2::model::UpdateAppRequestDataType) -> UpdateAppRequestData { + UpdateAppRequestData { + attributes: None, + id: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes( + mut self, + value: crate::datadogV2::model::UpdateAppRequestDataAttributes, + ) -> Self { + self.attributes = Some(value); + self + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for UpdateAppRequestData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct UpdateAppRequestDataVisitor; + impl<'a> Visitor<'a> for UpdateAppRequestDataVisitor { + type Value = UpdateAppRequestData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::UpdateAppRequestDataAttributes, + > = None; + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + if v.is_null() { + continue; + } + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::UpdateAppRequestDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = UpdateAppRequestData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(UpdateAppRequestDataVisitor) + } +} diff --git a/src/datadogV2/model/model_update_app_request_data_attributes.rs b/src/datadogV2/model/model_update_app_request_data_attributes.rs new file mode 100644 index 000000000..28d184fb4 --- /dev/null +++ b/src/datadogV2/model/model_update_app_request_data_attributes.rs @@ -0,0 +1,228 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `UpdateAppRequestDataAttributes` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct UpdateAppRequestDataAttributes { + /// The `attributes` `components`. + #[serde(rename = "components")] + pub components: Option>, + /// The `attributes` `description`. + #[serde(rename = "description")] + pub description: Option, + /// The `attributes` `embeddedQueries`. + #[serde(rename = "embeddedQueries")] + pub embedded_queries: Option>, + /// The definition of `InputSchema` object. + #[serde(rename = "inputSchema")] + pub input_schema: Option, + /// The `attributes` `name`. + #[serde(rename = "name")] + pub name: Option, + /// The `attributes` `rootInstanceName`. + #[serde(rename = "rootInstanceName")] + pub root_instance_name: Option, + /// The `attributes` `scripts`. + #[serde(rename = "scripts")] + pub scripts: Option>, + /// The `attributes` `tags`. + #[serde(rename = "tags")] + pub tags: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl UpdateAppRequestDataAttributes { + pub fn new() -> UpdateAppRequestDataAttributes { + UpdateAppRequestDataAttributes { + components: None, + description: None, + embedded_queries: None, + input_schema: None, + name: None, + root_instance_name: None, + scripts: None, + tags: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn components(mut self, value: Vec) -> Self { + self.components = Some(value); + self + } + + pub fn description(mut self, value: String) -> Self { + self.description = Some(value); + self + } + + pub fn embedded_queries(mut self, value: Vec) -> Self { + self.embedded_queries = Some(value); + self + } + + pub fn input_schema(mut self, value: crate::datadogV2::model::InputSchema) -> Self { + self.input_schema = Some(value); + self + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn root_instance_name(mut self, value: String) -> Self { + self.root_instance_name = Some(value); + self + } + + pub fn scripts(mut self, value: Vec) -> Self { + self.scripts = Some(value); + self + } + + pub fn tags(mut self, value: Vec) -> Self { + self.tags = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for UpdateAppRequestDataAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for UpdateAppRequestDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct UpdateAppRequestDataAttributesVisitor; + impl<'a> Visitor<'a> for UpdateAppRequestDataAttributesVisitor { + type Value = UpdateAppRequestDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut components: Option> = None; + let mut description: Option = None; + let mut embedded_queries: Option> = None; + let mut input_schema: Option = None; + let mut name: Option = None; + let mut root_instance_name: Option = None; + let mut scripts: Option> = None; + let mut tags: Option> = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "components" => { + if v.is_null() { + continue; + } + components = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "description" => { + if v.is_null() { + continue; + } + description = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "embeddedQueries" => { + if v.is_null() { + continue; + } + embedded_queries = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "inputSchema" => { + if v.is_null() { + continue; + } + input_schema = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "rootInstanceName" => { + if v.is_null() { + continue; + } + root_instance_name = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "scripts" => { + if v.is_null() { + continue; + } + scripts = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "tags" => { + if v.is_null() { + continue; + } + tags = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = UpdateAppRequestDataAttributes { + components, + description, + embedded_queries, + input_schema, + name, + root_instance_name, + scripts, + tags, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(UpdateAppRequestDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_update_app_request_data_type.rs b/src/datadogV2/model/model_update_app_request_data_type.rs new file mode 100644 index 000000000..6d9021318 --- /dev/null +++ b/src/datadogV2/model/model_update_app_request_data_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum UpdateAppRequestDataType { + APPDEFINITIONS, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for UpdateAppRequestDataType { + fn to_string(&self) -> String { + match self { + Self::APPDEFINITIONS => String::from("appDefinitions"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for UpdateAppRequestDataType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for UpdateAppRequestDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "appDefinitions" => Self::APPDEFINITIONS, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_update_app_response.rs b/src/datadogV2/model/model_update_app_response.rs new file mode 100644 index 000000000..91f40efc6 --- /dev/null +++ b/src/datadogV2/model/model_update_app_response.rs @@ -0,0 +1,162 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `UpdateAppResponse` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct UpdateAppResponse { + /// The definition of `UpdateAppResponseData` object. + #[serde(rename = "data")] + pub data: Option, + /// The `UpdateAppResponse` `included`. + #[serde(rename = "included")] + pub included: Option>, + /// The definition of `AppMeta` object. + #[serde(rename = "meta")] + pub meta: Option, + /// The definition of `UpdateAppResponseRelationship` object. + #[serde(rename = "relationship")] + pub relationship: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl UpdateAppResponse { + pub fn new() -> UpdateAppResponse { + UpdateAppResponse { + data: None, + included: None, + meta: None, + relationship: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: crate::datadogV2::model::UpdateAppResponseData) -> Self { + self.data = Some(value); + self + } + + pub fn included(mut self, value: Vec) -> Self { + self.included = Some(value); + self + } + + pub fn meta(mut self, value: crate::datadogV2::model::AppMeta) -> Self { + self.meta = Some(value); + self + } + + pub fn relationship( + mut self, + value: crate::datadogV2::model::UpdateAppResponseRelationship, + ) -> Self { + self.relationship = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for UpdateAppResponse { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for UpdateAppResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct UpdateAppResponseVisitor; + impl<'a> Visitor<'a> for UpdateAppResponseVisitor { + type Value = UpdateAppResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut included: Option> = None; + let mut meta: Option = None; + let mut relationship: Option< + crate::datadogV2::model::UpdateAppResponseRelationship, + > = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "included" => { + if v.is_null() { + continue; + } + included = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "meta" => { + if v.is_null() { + continue; + } + meta = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "relationship" => { + if v.is_null() { + continue; + } + relationship = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = UpdateAppResponse { + data, + included, + meta, + relationship, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(UpdateAppResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_update_app_response_data.rs b/src/datadogV2/model/model_update_app_response_data.rs new file mode 100644 index 000000000..849552d4c --- /dev/null +++ b/src/datadogV2/model/model_update_app_response_data.rs @@ -0,0 +1,126 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `UpdateAppResponseData` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct UpdateAppResponseData { + /// The definition of `UpdateAppResponseDataAttributes` object. + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::UpdateAppResponseDataAttributes, + /// The `data` `id`. + #[serde(rename = "id")] + pub id: String, + /// The definition of `UpdateAppResponseDataType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::UpdateAppResponseDataType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl UpdateAppResponseData { + pub fn new( + attributes: crate::datadogV2::model::UpdateAppResponseDataAttributes, + id: String, + type_: crate::datadogV2::model::UpdateAppResponseDataType, + ) -> UpdateAppResponseData { + UpdateAppResponseData { + attributes, + id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for UpdateAppResponseData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct UpdateAppResponseDataVisitor; + impl<'a> Visitor<'a> for UpdateAppResponseDataVisitor { + type Value = UpdateAppResponseData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::UpdateAppResponseDataAttributes, + > = None; + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::UpdateAppResponseDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = UpdateAppResponseData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(UpdateAppResponseDataVisitor) + } +} diff --git a/src/datadogV2/model/model_update_app_response_data_attributes.rs b/src/datadogV2/model/model_update_app_response_data_attributes.rs new file mode 100644 index 000000000..4e92f96bc --- /dev/null +++ b/src/datadogV2/model/model_update_app_response_data_attributes.rs @@ -0,0 +1,245 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `UpdateAppResponseDataAttributes` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct UpdateAppResponseDataAttributes { + /// The `attributes` `components`. + #[serde(rename = "components")] + pub components: Option>, + /// The `attributes` `description`. + #[serde(rename = "description")] + pub description: Option, + /// The `attributes` `embeddedQueries`. + #[serde(rename = "embeddedQueries")] + pub embedded_queries: Option>, + /// The `attributes` `favorite`. + #[serde(rename = "favorite")] + pub favorite: Option, + /// The definition of `InputSchema` object. + #[serde(rename = "inputSchema")] + pub input_schema: Option, + /// The `attributes` `name`. + #[serde(rename = "name")] + pub name: Option, + /// The `attributes` `rootInstanceName`. + #[serde(rename = "rootInstanceName")] + pub root_instance_name: Option, + /// The `attributes` `scripts`. + #[serde(rename = "scripts")] + pub scripts: Option>, + /// The `attributes` `tags`. + #[serde(rename = "tags")] + pub tags: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl UpdateAppResponseDataAttributes { + pub fn new() -> UpdateAppResponseDataAttributes { + UpdateAppResponseDataAttributes { + components: None, + description: None, + embedded_queries: None, + favorite: None, + input_schema: None, + name: None, + root_instance_name: None, + scripts: None, + tags: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn components(mut self, value: Vec) -> Self { + self.components = Some(value); + self + } + + pub fn description(mut self, value: String) -> Self { + self.description = Some(value); + self + } + + pub fn embedded_queries(mut self, value: Vec) -> Self { + self.embedded_queries = Some(value); + self + } + + pub fn favorite(mut self, value: bool) -> Self { + self.favorite = Some(value); + self + } + + pub fn input_schema(mut self, value: crate::datadogV2::model::InputSchema) -> Self { + self.input_schema = Some(value); + self + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn root_instance_name(mut self, value: String) -> Self { + self.root_instance_name = Some(value); + self + } + + pub fn scripts(mut self, value: Vec) -> Self { + self.scripts = Some(value); + self + } + + pub fn tags(mut self, value: Vec) -> Self { + self.tags = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for UpdateAppResponseDataAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for UpdateAppResponseDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct UpdateAppResponseDataAttributesVisitor; + impl<'a> Visitor<'a> for UpdateAppResponseDataAttributesVisitor { + type Value = UpdateAppResponseDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut components: Option> = None; + let mut description: Option = None; + let mut embedded_queries: Option> = None; + let mut favorite: Option = None; + let mut input_schema: Option = None; + let mut name: Option = None; + let mut root_instance_name: Option = None; + let mut scripts: Option> = None; + let mut tags: Option> = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "components" => { + if v.is_null() { + continue; + } + components = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "description" => { + if v.is_null() { + continue; + } + description = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "embeddedQueries" => { + if v.is_null() { + continue; + } + embedded_queries = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "favorite" => { + if v.is_null() { + continue; + } + favorite = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "inputSchema" => { + if v.is_null() { + continue; + } + input_schema = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "rootInstanceName" => { + if v.is_null() { + continue; + } + root_instance_name = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "scripts" => { + if v.is_null() { + continue; + } + scripts = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "tags" => { + if v.is_null() { + continue; + } + tags = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = UpdateAppResponseDataAttributes { + components, + description, + embedded_queries, + favorite, + input_schema, + name, + root_instance_name, + scripts, + tags, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(UpdateAppResponseDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_update_app_response_data_type.rs b/src/datadogV2/model/model_update_app_response_data_type.rs new file mode 100644 index 000000000..e4f6610d0 --- /dev/null +++ b/src/datadogV2/model/model_update_app_response_data_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum UpdateAppResponseDataType { + APPDEFINITIONS, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for UpdateAppResponseDataType { + fn to_string(&self) -> String { + match self { + Self::APPDEFINITIONS => String::from("appDefinitions"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for UpdateAppResponseDataType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for UpdateAppResponseDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "appDefinitions" => Self::APPDEFINITIONS, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_update_app_response_relationship.rs b/src/datadogV2/model/model_update_app_response_relationship.rs new file mode 100644 index 000000000..73cc2083c --- /dev/null +++ b/src/datadogV2/model/model_update_app_response_relationship.rs @@ -0,0 +1,123 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The definition of `UpdateAppResponseRelationship` object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct UpdateAppResponseRelationship { + /// The `relationship` `connections`. + #[serde(rename = "connections")] + pub connections: Option>, + /// The definition of `DeploymentRelationship` object. + #[serde(rename = "deployment")] + pub deployment: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl UpdateAppResponseRelationship { + pub fn new() -> UpdateAppResponseRelationship { + UpdateAppResponseRelationship { + connections: None, + deployment: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn connections(mut self, value: Vec) -> Self { + self.connections = Some(value); + self + } + + pub fn deployment(mut self, value: crate::datadogV2::model::DeploymentRelationship) -> Self { + self.deployment = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for UpdateAppResponseRelationship { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for UpdateAppResponseRelationship { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct UpdateAppResponseRelationshipVisitor; + impl<'a> Visitor<'a> for UpdateAppResponseRelationshipVisitor { + type Value = UpdateAppResponseRelationship; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut connections: Option> = None; + let mut deployment: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "connections" => { + if v.is_null() { + continue; + } + connections = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "deployment" => { + if v.is_null() { + continue; + } + deployment = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = UpdateAppResponseRelationship { + connections, + deployment, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(UpdateAppResponseRelationshipVisitor) + } +} diff --git a/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Bad-Request-response.frozen b/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Bad-Request-response.frozen new file mode 100644 index 000000000..70eab29e2 --- /dev/null +++ b/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2024-12-10T19:57:35.320Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Bad-Request-response.json b/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Bad-Request-response.json new file mode 100644 index 000000000..3edd87946 --- /dev/null +++ b/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Bad-Request-response.json @@ -0,0 +1,33 @@ +{ + "http_interactions": [ + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/invalid-uuid/deployment" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"detail\":\"invalid path parameter\",\"source\":{\"parameter\":\"appId\"}}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 400, + "message": "Bad Request" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:35 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Created-response.frozen b/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Created-response.frozen new file mode 100644 index 000000000..12cd09b1d --- /dev/null +++ b/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Created-response.frozen @@ -0,0 +1 @@ +2024-12-12T20:29:22.668Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Created-response.json b/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Created-response.json new file mode 100644 index 000000000..0f33d71b0 --- /dev/null +++ b/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Created-response.json @@ -0,0 +1,95 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"components\":[{\"events\":[],\"name\":\"grid0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"gridCell0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"calloutValue0\",\"properties\":{\"isDisabled\":false,\"isLoading\":false,\"isVisible\":true,\"label\":\"CPU Usage\",\"size\":\"sm\",\"style\":\"vivid_yellow\",\"unit\":\"kB\",\"value\":\"42\"},\"type\":\"calloutValue\"}],\"isVisible\":\"true\",\"layout\":{\"default\":{\"height\":8,\"width\":2,\"x\":0,\"y\":0}}},\"type\":\"gridCell\"}]},\"type\":\"grid\"}],\"description\":\"This is a simple example app\",\"embeddedQueries\":[],\"name\":\"Example App\",\"rootInstanceName\":\"grid0\"},\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"d9f547cd-bc8d-46be-b321-336856723728\",\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 201, + "message": "Created" + } + }, + "recorded_at": "Thu, 12 Dec 2024 20:29:22 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/d9f547cd-bc8d-46be-b321-336856723728/deployment" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"7e1d147c-815e-46fa-8be0-278783311881\",\"type\":\"deployment\",\"attributes\":{\"app_version_id\":\"f8567809-049e-49c2-b5c0-e5cb0e8e0f5e\"},\"meta\":{\"created_at\":\"2024-12-12T20:29:23.253704Z\",\"user_id\":2320499,\"user_uuid\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"user_name\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 201, + "message": "Created" + } + }, + "recorded_at": "Thu, 12 Dec 2024 20:29:22 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/d9f547cd-bc8d-46be-b321-336856723728" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"d9f547cd-bc8d-46be-b321-336856723728\",\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Thu, 12 Dec 2024 20:29:22 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Not-Found-response.frozen b/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Not-Found-response.frozen new file mode 100644 index 000000000..c11fe09d7 --- /dev/null +++ b/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2024-12-10T19:57:35.984Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Not-Found-response.json b/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Not-Found-response.json new file mode 100644 index 000000000..973dda706 --- /dev/null +++ b/tests/scenarios/cassettes/v2/app_deployment/Deploy-App-returns-Not-Found-response.json @@ -0,0 +1,33 @@ +{ + "http_interactions": [ + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/7addb29b-f935-472c-ae79-d1963979a23e/deployment" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"detail\":\"app not found\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 404, + "message": "Not Found" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:35 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Bad-Request-response.frozen b/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Bad-Request-response.frozen new file mode 100644 index 000000000..bf3af7629 --- /dev/null +++ b/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2024-12-10T19:57:36.091Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Bad-Request-response.json b/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Bad-Request-response.json new file mode 100644 index 000000000..bcf179101 --- /dev/null +++ b/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Bad-Request-response.json @@ -0,0 +1,33 @@ +{ + "http_interactions": [ + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/invalid-uuid/deployment" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"detail\":\"invalid path parameter\",\"source\":{\"parameter\":\"appId\"}}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 400, + "message": "Bad Request" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:36 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Not-Found-response.frozen b/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Not-Found-response.frozen new file mode 100644 index 000000000..8dc6b57d7 --- /dev/null +++ b/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2024-12-10T19:57:36.179Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Not-Found-response.json b/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Not-Found-response.json new file mode 100644 index 000000000..9f596d72c --- /dev/null +++ b/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-Not-Found-response.json @@ -0,0 +1,33 @@ +{ + "http_interactions": [ + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/7addb29b-f935-472c-ae79-d1963979a23e/deployment" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"detail\":\"app not found\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 404, + "message": "Not Found" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:36 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-OK-response.frozen new file mode 100644 index 000000000..883ce61de --- /dev/null +++ b/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-OK-response.frozen @@ -0,0 +1 @@ +2024-12-12T20:29:23.546Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-OK-response.json b/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-OK-response.json new file mode 100644 index 000000000..63d219481 --- /dev/null +++ b/tests/scenarios/cassettes/v2/app_deployment/Disable-App-returns-OK-response.json @@ -0,0 +1,95 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"components\":[{\"events\":[],\"name\":\"grid0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"gridCell0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"calloutValue0\",\"properties\":{\"isDisabled\":false,\"isLoading\":false,\"isVisible\":true,\"label\":\"CPU Usage\",\"size\":\"sm\",\"style\":\"vivid_yellow\",\"unit\":\"kB\",\"value\":\"42\"},\"type\":\"calloutValue\"}],\"isVisible\":\"true\",\"layout\":{\"default\":{\"height\":8,\"width\":2,\"x\":0,\"y\":0}}},\"type\":\"gridCell\"}]},\"type\":\"grid\"}],\"description\":\"This is a simple example app\",\"embeddedQueries\":[],\"name\":\"Example App\",\"rootInstanceName\":\"grid0\"},\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"6fdd1eb3-bd2c-4fe3-a3cf-38d0af4913ad\",\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 201, + "message": "Created" + } + }, + "recorded_at": "Thu, 12 Dec 2024 20:29:23 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/6fdd1eb3-bd2c-4fe3-a3cf-38d0af4913ad/deployment" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"be510de8-34d8-45fc-830f-85c208a42920\",\"type\":\"deployment\",\"attributes\":{\"app_version_id\":\"00000000-0000-0000-0000-000000000000\"},\"meta\":{\"created_at\":\"2024-12-12T20:29:23.883145Z\",\"user_id\":2320499,\"user_uuid\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"user_name\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Thu, 12 Dec 2024 20:29:23 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/6fdd1eb3-bd2c-4fe3-a3cf-38d0af4913ad" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"6fdd1eb3-bd2c-4fe3-a3cf-38d0af4913ad\",\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Thu, 12 Dec 2024 20:29:23 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Create-App-returns-App-Created-response.frozen b/tests/scenarios/cassettes/v2/apps/Create-App-returns-App-Created-response.frozen new file mode 100644 index 000000000..6dfadcf60 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Create-App-returns-App-Created-response.frozen @@ -0,0 +1 @@ +2024-12-12T20:29:24.182Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Create-App-returns-App-Created-response.json b/tests/scenarios/cassettes/v2/apps/Create-App-returns-App-Created-response.json new file mode 100644 index 000000000..311006b82 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Create-App-returns-App-Created-response.json @@ -0,0 +1,67 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"components\":[{\"events\":[],\"name\":\"grid0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"gridCell0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"calloutValue0\",\"properties\":{\"isDisabled\":false,\"isLoading\":false,\"isVisible\":true,\"label\":\"CPU Usage\",\"size\":\"sm\",\"style\":\"vivid_yellow\",\"unit\":\"kB\",\"value\":\"42\"},\"type\":\"calloutValue\"}],\"isVisible\":\"true\",\"layout\":{\"default\":{\"height\":8,\"width\":2,\"x\":0,\"y\":0}}},\"type\":\"gridCell\"}]},\"type\":\"grid\"}],\"description\":\"This is a simple example app\",\"embeddedQueries\":[],\"name\":\"Example App\",\"rootInstanceName\":\"grid0\"},\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"2d9dd18e-c574-454c-8d43-3045b731d6a2\",\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 201, + "message": "Created" + } + }, + "recorded_at": "Thu, 12 Dec 2024 20:29:24 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/2d9dd18e-c574-454c-8d43-3045b731d6a2" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"2d9dd18e-c574-454c-8d43-3045b731d6a2\",\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Thu, 12 Dec 2024 20:29:24 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Create-App-returns-Bad-Request-response.frozen b/tests/scenarios/cassettes/v2/apps/Create-App-returns-Bad-Request-response.frozen new file mode 100644 index 000000000..5912dc344 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Create-App-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2024-12-10T19:57:10.031Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Create-App-returns-Bad-Request-response.json b/tests/scenarios/cassettes/v2/apps/Create-App-returns-Bad-Request-response.json new file mode 100644 index 000000000..e834634c8 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Create-App-returns-Bad-Request-response.json @@ -0,0 +1,39 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"description\":\"This is a bad example app\",\"embeddedQueries\":[],\"rootInstanceName\":\"grid0\"},\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"detail\":\"missing required field\",\"source\":{\"pointer\":\"/data/attributes/name\"}}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 400, + "message": "Bad Request" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:10 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Delete-App-returns-Bad-Request-response.frozen b/tests/scenarios/cassettes/v2/apps/Delete-App-returns-Bad-Request-response.frozen new file mode 100644 index 000000000..3925b1b25 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Delete-App-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2024-12-10T19:57:10.128Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Delete-App-returns-Bad-Request-response.json b/tests/scenarios/cassettes/v2/apps/Delete-App-returns-Bad-Request-response.json new file mode 100644 index 000000000..b94026f89 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Delete-App-returns-Bad-Request-response.json @@ -0,0 +1,33 @@ +{ + "http_interactions": [ + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/bad-app-id" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"detail\":\"invalid path parameter\",\"source\":{\"parameter\":\"appId\"}}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 400, + "message": "Bad Request" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:10 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Delete-App-returns-Not-Found-response.frozen b/tests/scenarios/cassettes/v2/apps/Delete-App-returns-Not-Found-response.frozen new file mode 100644 index 000000000..cfa34bd9b --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Delete-App-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2024-12-10T19:57:10.225Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Delete-App-returns-Not-Found-response.json b/tests/scenarios/cassettes/v2/apps/Delete-App-returns-Not-Found-response.json new file mode 100644 index 000000000..1fa48dc29 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Delete-App-returns-Not-Found-response.json @@ -0,0 +1,33 @@ +{ + "http_interactions": [ + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/7addb29b-f935-472c-ae79-d1963979a23e" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"detail\":\"app not found\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 404, + "message": "Not Found" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:10 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Delete-App-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/apps/Delete-App-returns-OK-response.frozen new file mode 100644 index 000000000..81a74305a --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Delete-App-returns-OK-response.frozen @@ -0,0 +1 @@ +2024-12-12T20:29:24.659Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Delete-App-returns-OK-response.json b/tests/scenarios/cassettes/v2/apps/Delete-App-returns-OK-response.json new file mode 100644 index 000000000..2d351871d --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Delete-App-returns-OK-response.json @@ -0,0 +1,95 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"components\":[{\"events\":[],\"name\":\"grid0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"gridCell0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"calloutValue0\",\"properties\":{\"isDisabled\":false,\"isLoading\":false,\"isVisible\":true,\"label\":\"CPU Usage\",\"size\":\"sm\",\"style\":\"vivid_yellow\",\"unit\":\"kB\",\"value\":\"42\"},\"type\":\"calloutValue\"}],\"isVisible\":\"true\",\"layout\":{\"default\":{\"height\":8,\"width\":2,\"x\":0,\"y\":0}}},\"type\":\"gridCell\"}]},\"type\":\"grid\"}],\"description\":\"This is a simple example app\",\"embeddedQueries\":[],\"name\":\"Example App\",\"rootInstanceName\":\"grid0\"},\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"5cb67134-d7bd-4320-9cda-d79ec98cff4c\",\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 201, + "message": "Created" + } + }, + "recorded_at": "Thu, 12 Dec 2024 20:29:24 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/5cb67134-d7bd-4320-9cda-d79ec98cff4c" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"5cb67134-d7bd-4320-9cda-d79ec98cff4c\",\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Thu, 12 Dec 2024 20:29:24 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/5cb67134-d7bd-4320-9cda-d79ec98cff4c" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"detail\":\"app not found\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 404, + "message": "Not Found" + } + }, + "recorded_at": "Thu, 12 Dec 2024 20:29:24 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Bad-Request-response.frozen b/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Bad-Request-response.frozen new file mode 100644 index 000000000..47c84b21b --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2024-12-10T19:57:10.845Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Bad-Request-response.json b/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Bad-Request-response.json new file mode 100644 index 000000000..f92a0f7b4 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Bad-Request-response.json @@ -0,0 +1,39 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":[{\"id\":\"71c0d358-eac5-41e3-892d-a7467571b9b\",\"type\":\"appDefinitions\"},{\"id\":\"71c0d358-eac5-41e3-892d-a7467571b9b0\",\"type\":\"appDefinitions\"},{\"id\":\"98e7e44d-1562-474a-90f7-3a94e739c006\",\"type\":\"appDefinitions\"}]}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"status\":\"400\",\"title\":\"Bad Request\",\"detail\":\"invalid UUID length: 35\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 400, + "message": "Bad Request" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:10 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Not-Found-response.frozen b/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Not-Found-response.frozen new file mode 100644 index 000000000..0fbfbe769 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2024-12-10T19:57:10.942Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Not-Found-response.json b/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Not-Found-response.json new file mode 100644 index 000000000..0264cf115 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-Not-Found-response.json @@ -0,0 +1,39 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":[{\"id\":\"29494ddd-ac13-46a7-8558-b05b050ee755\",\"type\":\"appDefinitions\"},{\"id\":\"71c0d358-eac5-41e3-892d-a7467571b9b0\",\"type\":\"appDefinitions\"},{\"id\":\"98e7e44d-1562-474a-90f7-3a94e739c006\",\"type\":\"appDefinitions\"}]}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"detail\":\"one or more apps not found\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 404, + "message": "Not Found" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:10 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-OK-response.frozen new file mode 100644 index 000000000..5848314b7 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-OK-response.frozen @@ -0,0 +1 @@ +2024-12-12T20:29:25.239Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-OK-response.json b/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-OK-response.json new file mode 100644 index 000000000..3a1f55ef4 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Delete-Multiple-Apps-returns-OK-response.json @@ -0,0 +1,101 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"components\":[{\"events\":[],\"name\":\"grid0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"gridCell0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"calloutValue0\",\"properties\":{\"isDisabled\":false,\"isLoading\":false,\"isVisible\":true,\"label\":\"CPU Usage\",\"size\":\"sm\",\"style\":\"vivid_yellow\",\"unit\":\"kB\",\"value\":\"42\"},\"type\":\"calloutValue\"}],\"isVisible\":\"true\",\"layout\":{\"default\":{\"height\":8,\"width\":2,\"x\":0,\"y\":0}}},\"type\":\"gridCell\"}]},\"type\":\"grid\"}],\"description\":\"This is a simple example app\",\"embeddedQueries\":[],\"name\":\"Example App\",\"rootInstanceName\":\"grid0\"},\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"61d36766-5d27-47ea-a3e7-aa7bd77b1da3\",\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 201, + "message": "Created" + } + }, + "recorded_at": "Thu, 12 Dec 2024 20:29:25 GMT" + }, + { + "request": { + "body": { + "string": "{\"data\":[{\"id\":\"61d36766-5d27-47ea-a3e7-aa7bd77b1da3\",\"type\":\"appDefinitions\"}]}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" + }, + "response": { + "body": { + "string": "{\"data\":[{\"id\":\"61d36766-5d27-47ea-a3e7-aa7bd77b1da3\",\"type\":\"appDefinitions\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Thu, 12 Dec 2024 20:29:25 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/61d36766-5d27-47ea-a3e7-aa7bd77b1da3" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"detail\":\"app not found\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 404, + "message": "Not Found" + } + }, + "recorded_at": "Thu, 12 Dec 2024 20:29:25 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Get-App-returns-Bad-Request-response.frozen b/tests/scenarios/cassettes/v2/apps/Get-App-returns-Bad-Request-response.frozen new file mode 100644 index 000000000..9a1b4493f --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Get-App-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2024-12-10T19:57:11.519Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Get-App-returns-Bad-Request-response.json b/tests/scenarios/cassettes/v2/apps/Get-App-returns-Bad-Request-response.json new file mode 100644 index 000000000..4d47e8159 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Get-App-returns-Bad-Request-response.json @@ -0,0 +1,33 @@ +{ + "http_interactions": [ + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "get", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/invalid-uuid" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"detail\":\"invalid path parameter\",\"source\":{\"parameter\":\"appId\"}}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 400, + "message": "Bad Request" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:11 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Get-App-returns-Not-Found-response.frozen b/tests/scenarios/cassettes/v2/apps/Get-App-returns-Not-Found-response.frozen new file mode 100644 index 000000000..0d42c7607 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Get-App-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2024-12-10T19:57:11.612Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Get-App-returns-Not-Found-response.json b/tests/scenarios/cassettes/v2/apps/Get-App-returns-Not-Found-response.json new file mode 100644 index 000000000..a83cb8847 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Get-App-returns-Not-Found-response.json @@ -0,0 +1,33 @@ +{ + "http_interactions": [ + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "get", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/7addb29b-f935-472c-ae79-d1963979a23e" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"detail\":\"app not found\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 404, + "message": "Not Found" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:11 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Get-App-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/apps/Get-App-returns-OK-response.frozen new file mode 100644 index 000000000..7b34332de --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Get-App-returns-OK-response.frozen @@ -0,0 +1 @@ +2024-12-12T20:29:25.770Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Get-App-returns-OK-response.json b/tests/scenarios/cassettes/v2/apps/Get-App-returns-OK-response.json new file mode 100644 index 000000000..859a655f6 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Get-App-returns-OK-response.json @@ -0,0 +1,95 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"components\":[{\"events\":[],\"name\":\"grid0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"gridCell0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"calloutValue0\",\"properties\":{\"isDisabled\":false,\"isLoading\":false,\"isVisible\":true,\"label\":\"CPU Usage\",\"size\":\"sm\",\"style\":\"vivid_yellow\",\"unit\":\"kB\",\"value\":\"42\"},\"type\":\"calloutValue\"}],\"isVisible\":\"true\",\"layout\":{\"default\":{\"height\":8,\"width\":2,\"x\":0,\"y\":0}}},\"type\":\"gridCell\"}]},\"type\":\"grid\"}],\"description\":\"This is a simple example app\",\"embeddedQueries\":[],\"name\":\"Example App\",\"rootInstanceName\":\"grid0\"},\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"4937a273-31f5-4375-a9cf-b71eeb92f89c\",\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 201, + "message": "Created" + } + }, + "recorded_at": "Thu, 12 Dec 2024 20:29:25 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "get", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/4937a273-31f5-4375-a9cf-b71eeb92f89c" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"4937a273-31f5-4375-a9cf-b71eeb92f89c\",\"type\":\"appDefinitions\",\"attributes\":{\"components\":[{\"events\":[],\"name\":\"grid0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"gridCell0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"calloutValue0\",\"properties\":{\"isDisabled\":false,\"isLoading\":false,\"isVisible\":true,\"label\":\"CPU Usage\",\"size\":\"sm\",\"style\":\"vivid_yellow\",\"unit\":\"kB\",\"value\":\"42\"},\"type\":\"calloutValue\"}],\"isVisible\":\"true\",\"layout\":{\"default\":{\"height\":8,\"width\":2,\"x\":0,\"y\":0}}},\"type\":\"gridCell\"}]},\"type\":\"grid\"}],\"description\":\"This is a simple example app\",\"embeddedQueries\":[],\"favorite\":false,\"name\":\"Example App\",\"rootInstanceName\":\"grid0\",\"selfService\":false,\"tags\":[]},\"meta\":{\"org_id\":321813,\"user_id\":2320499,\"user_uuid\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"user_name\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"version\":1,\"updated_since_deployment\":false,\"created_at\":\"2024-12-12T20:29:25.869968Z\",\"updated_at\":\"2024-12-12T20:29:25.869968Z\",\"deleted_at\":\"0001-01-01T00:00:00Z\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Thu, 12 Dec 2024 20:29:25 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/4937a273-31f5-4375-a9cf-b71eeb92f89c" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"4937a273-31f5-4375-a9cf-b71eeb92f89c\",\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Thu, 12 Dec 2024 20:29:25 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/List-Apps-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/apps/List-Apps-returns-OK-response.frozen new file mode 100644 index 000000000..1cb2468dc --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/List-Apps-returns-OK-response.frozen @@ -0,0 +1 @@ +2024-12-10T19:57:12.227Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/List-Apps-returns-OK-response.json b/tests/scenarios/cassettes/v2/apps/List-Apps-returns-OK-response.json new file mode 100644 index 000000000..ec7b8dc71 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/List-Apps-returns-OK-response.json @@ -0,0 +1,33 @@ +{ + "http_interactions": [ + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "get", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" + }, + "response": { + "body": { + "string": "{\"data\":[{\"id\":\"d595693a-473d-4671-9da3-fce89e3a5c5d\",\"type\":\"appDefinitions\",\"attributes\":{\"description\":\"\",\"favorite\":false,\"name\":\"Max's App Fri, Jul 12, 11:10:35 am\",\"selfService\":false,\"tags\":[]},\"meta\":{\"org_id\":1107852,\"user_id\":7571362,\"user_uuid\":\"3114f3a0-3fc9-11ef-acbe-a6def6551924\",\"user_name\":\"max.gale@datadoghq.com\",\"version\":0,\"updated_since_deployment\":false,\"created_at\":\"2024-07-12T15:10:48.690305Z\",\"updated_at\":\"2024-07-12T15:10:48.690305Z\",\"deleted_at\":\"0001-01-01T00:00:00Z\"}}],\"meta\":{\"page\":{\"totalCount\":1,\"totalFilteredCount\":1}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Tue, 10 Dec 2024 19:57:12 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Update-App-returns-Bad-Request-response.frozen b/tests/scenarios/cassettes/v2/apps/Update-App-returns-Bad-Request-response.frozen new file mode 100644 index 000000000..561628303 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Update-App-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2024-12-12T20:29:26.349Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Update-App-returns-Bad-Request-response.json b/tests/scenarios/cassettes/v2/apps/Update-App-returns-Bad-Request-response.json new file mode 100644 index 000000000..acf146ab6 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Update-App-returns-Bad-Request-response.json @@ -0,0 +1,101 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"components\":[{\"events\":[],\"name\":\"grid0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"gridCell0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"calloutValue0\",\"properties\":{\"isDisabled\":false,\"isLoading\":false,\"isVisible\":true,\"label\":\"CPU Usage\",\"size\":\"sm\",\"style\":\"vivid_yellow\",\"unit\":\"kB\",\"value\":\"42\"},\"type\":\"calloutValue\"}],\"isVisible\":\"true\",\"layout\":{\"default\":{\"height\":8,\"width\":2,\"x\":0,\"y\":0}}},\"type\":\"gridCell\"}]},\"type\":\"grid\"}],\"description\":\"This is a simple example app\",\"embeddedQueries\":[],\"name\":\"Example App\",\"rootInstanceName\":\"grid0\"},\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"9d2ee93b-6ac5-4b0e-abd8-829916f2365d\",\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 201, + "message": "Created" + } + }, + "recorded_at": "Thu, 12 Dec 2024 20:29:26 GMT" + }, + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"rootInstanceName\":\"\"},\"id\":\"9d2ee93b-6ac5-4b0e-abd8-829916f2365d\",\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "patch", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/9d2ee93b-6ac5-4b0e-abd8-829916f2365d" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"detail\":\"missing required field\",\"source\":{\"pointer\":\"/data/attributes/rootInstanceName\"}}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 400, + "message": "Bad Request" + } + }, + "recorded_at": "Thu, 12 Dec 2024 20:29:26 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/9d2ee93b-6ac5-4b0e-abd8-829916f2365d" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"9d2ee93b-6ac5-4b0e-abd8-829916f2365d\",\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Thu, 12 Dec 2024 20:29:26 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Update-App-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/apps/Update-App-returns-OK-response.frozen new file mode 100644 index 000000000..9a62b8023 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Update-App-returns-OK-response.frozen @@ -0,0 +1 @@ +2024-12-12T20:29:26.986Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/apps/Update-App-returns-OK-response.json b/tests/scenarios/cassettes/v2/apps/Update-App-returns-OK-response.json new file mode 100644 index 000000000..0583caf07 --- /dev/null +++ b/tests/scenarios/cassettes/v2/apps/Update-App-returns-OK-response.json @@ -0,0 +1,101 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"components\":[{\"events\":[],\"name\":\"grid0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"gridCell0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"calloutValue0\",\"properties\":{\"isDisabled\":false,\"isLoading\":false,\"isVisible\":true,\"label\":\"CPU Usage\",\"size\":\"sm\",\"style\":\"vivid_yellow\",\"unit\":\"kB\",\"value\":\"42\"},\"type\":\"calloutValue\"}],\"isVisible\":\"true\",\"layout\":{\"default\":{\"height\":8,\"width\":2,\"x\":0,\"y\":0}}},\"type\":\"gridCell\"}]},\"type\":\"grid\"}],\"description\":\"This is a simple example app\",\"embeddedQueries\":[],\"name\":\"Example App\",\"rootInstanceName\":\"grid0\"},\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"5a5e6785-d3f8-41bf-9d5d-95a179362e02\",\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 201, + "message": "Created" + } + }, + "recorded_at": "Thu, 12 Dec 2024 20:29:26 GMT" + }, + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"name\":\"Updated Name\",\"rootInstanceName\":\"grid0\"},\"id\":\"5a5e6785-d3f8-41bf-9d5d-95a179362e02\",\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "patch", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/5a5e6785-d3f8-41bf-9d5d-95a179362e02" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"5a5e6785-d3f8-41bf-9d5d-95a179362e02\",\"type\":\"appDefinitions\",\"attributes\":{\"components\":[{\"events\":[],\"name\":\"grid0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"gridCell0\",\"properties\":{\"children\":[{\"events\":[],\"name\":\"calloutValue0\",\"properties\":{\"isDisabled\":false,\"isLoading\":false,\"isVisible\":true,\"label\":\"CPU Usage\",\"size\":\"sm\",\"style\":\"vivid_yellow\",\"unit\":\"kB\",\"value\":\"42\"},\"type\":\"calloutValue\"}],\"isVisible\":\"true\",\"layout\":{\"default\":{\"height\":8,\"width\":2,\"x\":0,\"y\":0}}},\"type\":\"gridCell\"}]},\"type\":\"grid\"}],\"description\":\"This is a simple example app\",\"embeddedQueries\":[],\"favorite\":false,\"name\":\"Updated Name\",\"rootInstanceName\":\"grid0\",\"selfService\":false,\"tags\":[]},\"meta\":{\"org_id\":321813,\"user_id\":2320499,\"user_uuid\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"user_name\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"version\":2,\"updated_since_deployment\":false,\"created_at\":\"2024-12-12T20:29:27.115629Z\",\"updated_at\":\"2024-12-12T20:29:27.362767Z\",\"deleted_at\":\"0001-01-01T00:00:00Z\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Thu, 12 Dec 2024 20:29:26 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/app-builder/apps/5a5e6785-d3f8-41bf-9d5d-95a179362e02" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"5a5e6785-d3f8-41bf-9d5d-95a179362e02\",\"type\":\"appDefinitions\"}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Thu, 12 Dec 2024 20:29:26 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/features/v2/app_deployment.feature b/tests/scenarios/features/v2/app_deployment.feature new file mode 100644 index 000000000..b76bc1d88 --- /dev/null +++ b/tests/scenarios/features/v2/app_deployment.feature @@ -0,0 +1,58 @@ +@endpoint(app-deployment) @endpoint(app-deployment-v2) +Feature: App Deployment + Deploy and disable apps in App Builder. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "AppDeployment" API + + @skip-typescript @team:DataDog/app-builder-backend + Scenario: Deploy App returns "Bad Request" response + Given operation "DeployApp" enabled + And new "DeployApp" request + And request contains "app_id" parameter with value "invalid-uuid" + When the request is sent + Then the response status is 400 Bad Request + + @skip-typescript @team:DataDog/app-builder-backend + Scenario: Deploy App returns "Created" response + Given operation "DeployApp" enabled + And new "DeployApp" request + And there is a valid "app" in the system + And request contains "app_id" parameter from "app.data.id" + When the request is sent + Then the response status is 201 Created + + @skip-typescript @team:DataDog/app-builder-backend + Scenario: Deploy App returns "Not Found" response + Given operation "DeployApp" enabled + And new "DeployApp" request + And request contains "app_id" parameter with value "7addb29b-f935-472c-ae79-d1963979a23e" + When the request is sent + Then the response status is 404 Not Found + + @skip-typescript @team:DataDog/app-builder-backend + Scenario: Disable App returns "Bad Request" response + Given operation "DisableApp" enabled + And new "DisableApp" request + And request contains "app_id" parameter with value "invalid-uuid" + When the request is sent + Then the response status is 400 Bad Request + + @skip-typescript @team:DataDog/app-builder-backend + Scenario: Disable App returns "Not Found" response + Given operation "DisableApp" enabled + And new "DisableApp" request + And request contains "app_id" parameter with value "7addb29b-f935-472c-ae79-d1963979a23e" + When the request is sent + Then the response status is 404 Not Found + + @skip-typescript @team:DataDog/app-builder-backend + Scenario: Disable App returns "OK" response + Given operation "DisableApp" enabled + And new "DisableApp" request + And there is a valid "app" in the system + And request contains "app_id" parameter from "app.data.id" + When the request is sent + Then the response status is 200 OK diff --git a/tests/scenarios/features/v2/apps.feature b/tests/scenarios/features/v2/apps.feature new file mode 100644 index 000000000..531cc3826 --- /dev/null +++ b/tests/scenarios/features/v2/apps.feature @@ -0,0 +1,155 @@ +@endpoint(apps) @endpoint(apps-v2) +Feature: Apps + Create, read, update, and delete apps in App Builder. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "Apps" API + + @skip-typescript @team:DataDog/app-builder-backend + Scenario: Create App returns "App Created" response + Given operation "CreateApp" enabled + And new "CreateApp" request + And body with value {"data": {"attributes": {"components": [{"events": [], "name": "grid0", "properties": {"children": [{"events": [], "name": "gridCell0", "properties": {"children": [{"events": [], "name": "calloutValue0", "properties": {"isVisible": true, "isDisabled": false, "isLoading": false, "label": "CPU Usage", "size": "sm", "style": "vivid_yellow", "unit": "kB", "value": "42"}, "type": "calloutValue"}], "isVisible": "true", "layout": {"default": {"height": 8, "width": 2, "x": 0, "y": 0}}}, "type": "gridCell"}]}, "type": "grid"}], "description": "This is a simple example app", "embeddedQueries": [], "name": "Example App", "rootInstanceName": "grid0"}, "type": "appDefinitions"}} + When the request is sent + Then the response status is 201 App Created + And the response "data.type" is equal to "appDefinitions" + + @skip-typescript @team:DataDog/app-builder-backend + Scenario: Create App returns "Bad Request" response + Given operation "CreateApp" enabled + And new "CreateApp" request + And body with value {"data": {"attributes": {"description": "This is a bad example app", "embeddedQueries": [], "rootInstanceName": "grid0"}, "type": "appDefinitions"}} + When the request is sent + Then the response status is 400 Bad Request + And the response "errors" has length 1 + And the response "errors[0].detail" is equal to "missing required field" + + @skip-typescript @team:DataDog/app-builder-backend + Scenario: Delete App returns "Bad Request" response + Given operation "DeleteApp" enabled + And new "DeleteApp" request + And request contains "app_id" parameter with value "bad-app-id" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/app-builder-backend + Scenario: Delete App returns "Gone" response + Given operation "DeleteApp" enabled + And new "DeleteApp" request + And request contains "app_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 410 Gone + + @skip-typescript @team:DataDog/app-builder-backend + Scenario: Delete App returns "Not Found" response + Given operation "DeleteApp" enabled + And new "DeleteApp" request + And request contains "app_id" parameter with value "7addb29b-f935-472c-ae79-d1963979a23e" + When the request is sent + Then the response status is 404 Not Found + + @skip-typescript @team:DataDog/app-builder-backend + Scenario: Delete App returns "OK" response + Given operation "DeleteApp" enabled + And there is a valid "app" in the system + And new "DeleteApp" request + And request contains "app_id" parameter from "app.data.id" + When the request is sent + Then the response status is 200 OK + And the response "data.id" has the same value as "app.data.id" + And the response "data.type" is equal to "appDefinitions" + + @skip-typescript @team:DataDog/app-builder-backend + Scenario: Delete Multiple Apps returns "Bad Request" response + Given operation "DeleteApps" enabled + And new "DeleteApps" request + And body with value {"data": [{"id": "71c0d358-eac5-41e3-892d-a7467571b9b", "type": "appDefinitions"}, {"id": "71c0d358-eac5-41e3-892d-a7467571b9b0", "type": "appDefinitions"}, {"id": "98e7e44d-1562-474a-90f7-3a94e739c006", "type": "appDefinitions"}]} + When the request is sent + Then the response status is 400 Bad Request + + @skip-typescript @team:DataDog/app-builder-backend + Scenario: Delete Multiple Apps returns "Not Found" response + Given operation "DeleteApps" enabled + And new "DeleteApps" request + And body with value {"data": [{"id": "29494ddd-ac13-46a7-8558-b05b050ee755", "type": "appDefinitions"}, {"id": "71c0d358-eac5-41e3-892d-a7467571b9b0", "type": "appDefinitions"}, {"id": "98e7e44d-1562-474a-90f7-3a94e739c006", "type": "appDefinitions"}]} + When the request is sent + Then the response status is 404 Not Found + + @skip-typescript @team:DataDog/app-builder-backend + Scenario: Delete Multiple Apps returns "OK" response + Given operation "DeleteApps" enabled + And new "DeleteApps" request + And there is a valid "app" in the system + And body with value {"data": [{"id": "{{ app.data.id }}", "type": "appDefinitions"}]} + When the request is sent + Then the response status is 200 OK + And the response "data" has length 1 + And the response "data[0].id" has the same value as "app.data.id" + + @skip-typescript @team:DataDog/app-builder-backend + Scenario: Get App returns "Bad Request" response + Given operation "GetApp" enabled + And new "GetApp" request + And request contains "app_id" parameter with value "invalid-uuid" + When the request is sent + Then the response status is 400 Bad Request + + @skip-typescript @team:DataDog/app-builder-backend + Scenario: Get App returns "Not Found" response + Given operation "GetApp" enabled + And new "GetApp" request + And request contains "app_id" parameter with value "7addb29b-f935-472c-ae79-d1963979a23e" + When the request is sent + Then the response status is 404 Not Found + + @skip-typescript @team:DataDog/app-builder-backend + Scenario: Get App returns "OK" response + Given operation "GetApp" enabled + And new "GetApp" request + And there is a valid "app" in the system + And request contains "app_id" parameter from "app.data.id" + When the request is sent + Then the response status is 200 OK + And the response "data.id" has the same value as "app.data.id" + And the response "data.type" is equal to "appDefinitions" + + @generated @skip @team:DataDog/app-builder-backend + Scenario: List Apps returns "Bad Request, e.g. invalid sort parameter" response + Given operation "ListApps" enabled + And new "ListApps" request + When the request is sent + Then the response status is 400 Bad Request, e.g. invalid sort parameter + + @skip-typescript @team:DataDog/app-builder-backend + Scenario: List Apps returns "OK" response + Given operation "ListApps" enabled + And new "ListApps" request + When the request is sent + Then the response status is 200 OK + + @skip-typescript @team:DataDog/app-builder-backend + Scenario: Update App returns "Bad Request" response + Given operation "UpdateApp" enabled + And new "UpdateApp" request + And there is a valid "app" in the system + And request contains "app_id" parameter from "app.data.id" + And body with value {"data": {"attributes": {"rootInstanceName": ""}, "id": "{{ app.data.id }}", "type": "appDefinitions"}} + When the request is sent + Then the response status is 400 Bad Request + And the response "errors" has length 1 + And the response "errors[0].detail" is equal to "missing required field" + + @skip-typescript @team:DataDog/app-builder-backend + Scenario: Update App returns "OK" response + Given operation "UpdateApp" enabled + And new "UpdateApp" request + And there is a valid "app" in the system + And request contains "app_id" parameter from "app.data.id" + And body with value {"data": {"attributes": {"name": "Updated Name", "rootInstanceName": "grid0"}, "id": "{{ app.data.id }}", "type": "appDefinitions"}} + When the request is sent + Then the response status is 200 OK + And the response "data.id" has the same value as "app.data.id" + And the response "data.type" is equal to "appDefinitions" + And the response "data.attributes.name" is equal to "Updated Name" diff --git a/tests/scenarios/features/v2/given.json b/tests/scenarios/features/v2/given.json index 21d526af2..29503a6ae 100644 --- a/tests/scenarios/features/v2/given.json +++ b/tests/scenarios/features/v2/given.json @@ -47,6 +47,18 @@ "tag": "APM Retention Filters", "operationId": "CreateApmRetentionFilter" }, + { + "parameters": [ + { + "name": "body", + "value": "{\"data\": {\"attributes\": {\"components\": [{\"events\": [], \"name\": \"grid0\", \"properties\": {\"children\": [{\"events\": [], \"name\": \"gridCell0\", \"properties\": {\"children\": [{\"events\": [], \"name\": \"calloutValue0\", \"properties\": {\"isVisible\": true, \"isDisabled\": false, \"isLoading\": false, \"label\": \"CPU Usage\", \"size\": \"sm\", \"style\": \"vivid_yellow\", \"unit\": \"kB\", \"value\": \"42\"}, \"type\": \"calloutValue\"}], \"isVisible\": \"true\", \"layout\": {\"default\": {\"height\": 8, \"width\": 2, \"x\": 0, \"y\": 0}}}, \"type\": \"gridCell\"}]}, \"type\": \"grid\"}], \"description\": \"This is a simple example app\", \"embeddedQueries\": [], \"name\": \"Example App\", \"rootInstanceName\": \"grid0\"}, \"type\": \"appDefinitions\"}}" + } + ], + "step": "there is a valid \"app\" in the system", + "key": "app", + "tag": "Apps", + "operationId": "CreateApp" + }, { "parameters": [ { diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index 8a00411a3..b1ed2db69 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -153,6 +153,61 @@ "type": "idempotent" } }, + "DeleteApps": { + "tag": "Apps", + "undo": { + "type": "idempotent" + } + }, + "ListApps": { + "tag": "Apps", + "undo": { + "type": "safe" + } + }, + "CreateApp": { + "tag": "Apps", + "undo": { + "operationId": "DeleteApp", + "parameters": [ + { + "name": "app_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteApp": { + "tag": "Apps", + "undo": { + "type": "idempotent" + } + }, + "GetApp": { + "tag": "Apps", + "undo": { + "type": "safe" + } + }, + "UpdateApp": { + "tag": "Apps", + "undo": { + "type": "idempotent" + } + }, + "DisableApp": { + "tag": "App Deployment", + "undo": { + "type": "idempotent" + } + }, + "DeployApp": { + "tag": "App Deployment", + "undo": { + "type": "idempotent" + } + }, "ListApplicationKeys": { "tag": "Key Management", "undo": { diff --git a/tests/scenarios/function_mappings.rs b/tests/scenarios/function_mappings.rs index 6c1ba80e8..43ad48ae7 100644 --- a/tests/scenarios/function_mappings.rs +++ b/tests/scenarios/function_mappings.rs @@ -54,6 +54,8 @@ pub struct ApiInstances { pub v2_api_spans_metrics: Option, pub v2_api_apm_retention_filters: Option, + pub v2_api_apps: Option, + pub v2_api_app_deployment: Option, pub v2_api_audit: Option, pub v2_api_authn_mappings: Option, pub v2_api_case_management: Option, @@ -476,6 +478,21 @@ pub fn initialize_api_instance(world: &mut DatadogWorld, api: String) { world.http_client.as_ref().unwrap().clone() )); } + "Apps" => { + world.api_instances.v2_api_apps = + Some(datadogV2::api_apps::AppsAPI::with_client_and_config( + world.config.clone(), + world.http_client.as_ref().unwrap().clone(), + )); + } + "AppDeployment" => { + world.api_instances.v2_api_app_deployment = Some( + datadogV2::api_app_deployment::AppDeploymentAPI::with_client_and_config( + world.config.clone(), + world.http_client.as_ref().unwrap().clone(), + ), + ); + } "Audit" => { world.api_instances.v2_api_audit = Some(datadogV2::api_audit::AuditAPI::with_client_and_config( @@ -1722,6 +1739,30 @@ pub fn collect_function_calls(world: &mut DatadogWorld) { "v2.UpdateApmRetentionFilter".into(), test_v2_update_apm_retention_filter, ); + world + .function_mappings + .insert("v2.DeleteApps".into(), test_v2_delete_apps); + world + .function_mappings + .insert("v2.ListApps".into(), test_v2_list_apps); + world + .function_mappings + .insert("v2.CreateApp".into(), test_v2_create_app); + world + .function_mappings + .insert("v2.DeleteApp".into(), test_v2_delete_app); + world + .function_mappings + .insert("v2.GetApp".into(), test_v2_get_app); + world + .function_mappings + .insert("v2.UpdateApp".into(), test_v2_update_app); + world + .function_mappings + .insert("v2.DisableApp".into(), test_v2_disable_app); + world + .function_mappings + .insert("v2.DeployApp".into(), test_v2_deploy_app); world .function_mappings .insert("v2.ListAuditLogs".into(), test_v2_list_audit_logs); @@ -11279,6 +11320,247 @@ fn test_v2_update_apm_retention_filter( world.response.code = response.status.as_u16(); } +fn test_v2_delete_apps(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_apps + .as_ref() + .expect("api instance not found"); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = match block_on(api.delete_apps_with_http_info(body)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_list_apps(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_apps + .as_ref() + .expect("api instance not found"); + let limit = _parameters + .get("limit") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let page = _parameters + .get("page") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let filter_user_name = _parameters + .get("filter[user_name]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let filter_user_uuid = _parameters + .get("filter[user_uuid]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let filter_name = _parameters + .get("filter[name]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let filter_query = _parameters + .get("filter[query]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let filter_deployed = _parameters + .get("filter[deployed]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let filter_tags = _parameters + .get("filter[tags]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let filter_favorite = _parameters + .get("filter[favorite]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let sort = _parameters + .get("sort") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let mut params = datadogV2::api_apps::ListAppsOptionalParams::default(); + params.limit = limit; + params.page = page; + params.filter_user_name = filter_user_name; + params.filter_user_uuid = filter_user_uuid; + params.filter_name = filter_name; + params.filter_query = filter_query; + params.filter_deployed = filter_deployed; + params.filter_tags = filter_tags; + params.filter_favorite = filter_favorite; + params.sort = sort; + let response = match block_on(api.list_apps_with_http_info(params)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_create_app(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_apps + .as_ref() + .expect("api instance not found"); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = match block_on(api.create_app_with_http_info(body)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_delete_app(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_apps + .as_ref() + .expect("api instance not found"); + let app_id = serde_json::from_value(_parameters.get("app_id").unwrap().clone()).unwrap(); + let response = match block_on(api.delete_app_with_http_info(app_id)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_get_app(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_apps + .as_ref() + .expect("api instance not found"); + let app_id = serde_json::from_value(_parameters.get("app_id").unwrap().clone()).unwrap(); + let response = match block_on(api.get_app_with_http_info(app_id)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_update_app(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_apps + .as_ref() + .expect("api instance not found"); + let app_id = serde_json::from_value(_parameters.get("app_id").unwrap().clone()).unwrap(); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = match block_on(api.update_app_with_http_info(app_id, body)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_disable_app(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_app_deployment + .as_ref() + .expect("api instance not found"); + let app_id = serde_json::from_value(_parameters.get("app_id").unwrap().clone()).unwrap(); + let response = match block_on(api.disable_app_with_http_info(app_id)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_deploy_app(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_app_deployment + .as_ref() + .expect("api instance not found"); + let app_id = serde_json::from_value(_parameters.get("app_id").unwrap().clone()).unwrap(); + let response = match block_on(api.deploy_app_with_http_info(app_id)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + fn test_v2_list_audit_logs(world: &mut DatadogWorld, _parameters: &HashMap) { let api = world .api_instances